Added a utility controller, for calling actions that really aren't related to any other controller (we've been using accounts up to this point).
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@809 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -254,6 +254,11 @@ class AppController extends Controller {
|
||||
array('controller' => 'tenders', 'action' => 'deposit'), null,
|
||||
'SITE', $this->op_area);
|
||||
|
||||
if (sandbox())
|
||||
$this->addSideMenuLink('Rebuild Sandbox',
|
||||
array('controller' => 'util', 'action' => 'rebuild_sandbox'), null,
|
||||
'SITE', $this->op_area);
|
||||
|
||||
// REVISIT <AP>: 20090824
|
||||
// Depending on preference, we may put this into the gridView
|
||||
// function, making the links available only when navigating.
|
||||
@@ -398,36 +403,6 @@ class AppController extends Controller {
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: reset_data
|
||||
* - Development function. TO BE DELETED
|
||||
*/
|
||||
|
||||
function reset_data() {
|
||||
$this->layout = null;
|
||||
$this->autoLayout = false;
|
||||
$this->autoRender = false;
|
||||
Configure::write('debug', '0');
|
||||
$script = $_SERVER['DOCUMENT_ROOT'] . '/pmgr/build.cmd';
|
||||
echo "<P>" . date('r') . "\n";
|
||||
//echo "<P>Script: $script" . "\n";
|
||||
$db = & $this->Account->getDataSource();
|
||||
$script .= ' "' . $db->config['database'] . '"';
|
||||
$script .= ' "' . $db->config['login'] . '"';
|
||||
$script .= ' "' . $db->config['password'] . '"';
|
||||
$handle = popen($script . ' 2>&1', 'r');
|
||||
//echo "<P>Handle: $handle; " . gettype($handle) . "\n";
|
||||
echo "<P><PRE>\n";
|
||||
while (($read = fread($handle, 2096))) {
|
||||
echo $read;
|
||||
}
|
||||
echo "</PRE>\n";
|
||||
pclose($handle);
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
@@ -509,7 +509,7 @@ class AppModel extends Model {
|
||||
|
||||
function INTERNAL_ERROR($msg, $depth = 0, $force_stop = false) {
|
||||
INTERNAL_ERROR($msg, $force_stop, $depth+1);
|
||||
echo $this->requestAction(array('controller' => 'accounts',
|
||||
echo $this->requestAction(array('controller' => 'util',
|
||||
'action' => 'render_empty'),
|
||||
array('return', 'bare' => false)
|
||||
);
|
||||
|
||||
60
site/controllers/util_controller.php
Normal file
60
site/controllers/util_controller.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
class UtilController extends AppController {
|
||||
|
||||
var $uses = array();
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: reset_data
|
||||
* - Development function. TO BE DELETED
|
||||
*/
|
||||
|
||||
function reset_data() {
|
||||
$this->layout = null;
|
||||
$this->autoLayout = false;
|
||||
$this->autoRender = false;
|
||||
Configure::write('debug', '0');
|
||||
$script = $_SERVER['DOCUMENT_ROOT'] . '/pmgr/build.cmd';
|
||||
echo "<P>" . date('r') . "\n";
|
||||
//echo "<P>Script: $script" . "\n";
|
||||
$handle = popen($script . ' 2>&1', 'r');
|
||||
//echo "<P>Handle: $handle; " . gettype($handle) . "\n";
|
||||
echo "<P><PRE>\n";
|
||||
while (($read = fread($handle, 2096))) {
|
||||
echo $read;
|
||||
}
|
||||
echo "</PRE>\n";
|
||||
pclose($handle);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: rebuild_sandbox
|
||||
*/
|
||||
|
||||
function rebuild_sandbox() {
|
||||
$this->layout = null;
|
||||
$this->autoLayout = false;
|
||||
$this->autoRender = false;
|
||||
Configure::write('debug', '2');
|
||||
$script = preg_replace('%/webroot/index.php%',
|
||||
'/build_sandbox.cmd',
|
||||
$_SERVER['SCRIPT_FILENAME']);
|
||||
echo "<P>" . date('r') . "\n";
|
||||
echo "<P>Script: $script" . "\n";
|
||||
$handle = popen($script . ' 2>&1', 'r');
|
||||
//echo "<P>Handle: $handle; " . gettype($handle) . "\n";
|
||||
echo "<P><PRE>\n";
|
||||
while (($read = fread($handle, 2096))) {
|
||||
echo $read;
|
||||
}
|
||||
echo "</PRE>\n";
|
||||
pclose($handle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user