mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
merging fixes into trunk from [869]
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@870 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
29a1ee9043
commit
00aa3c66d2
9 changed files with 137 additions and 75 deletions
|
@ -1,7 +1,9 @@
|
|||
<h1>Missing action</h1>
|
||||
<?php $controller = Inflector::camelize($this->name)."Controller"; ?>
|
||||
|
||||
<p class="error">You are seeing this error because the action <em><?=$this->missingAction;?></em>
|
||||
is not defined in controller <em><?=Inflector::camelize($this->name);?></em>
|
||||
<h1>Missing Method in <?php echo $controller;?></h1>
|
||||
|
||||
<p class="error">You are seeing this error because the action <em><?php echo $this->controller->missingAction;?></em>
|
||||
is not defined in controller <em><?php echo $controller;?></em>
|
||||
</p>
|
||||
|
||||
|
||||
|
@ -10,18 +12,29 @@
|
|||
view file, a user-customizable error page for handling invalid action dispatches.</span>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Error</strong>: Unable to execute action <em><?=$this->missingAction;?></em> on
|
||||
<em><?=Inflector::camelize($this->name);?></em>
|
||||
<strong>Fatal</strong>: Create Method:
|
||||
</p>
|
||||
<p>
|
||||
<?php echo "<pre><?php\n\nclass " . $controller ." extends AppController {\n
|
||||
function ".$this->controller->missingAction."()
|
||||
{
|
||||
}
|
||||
}\n?></pre>"; ?>
|
||||
in file : <?php echo "app".DS."controllers".DS.Inflector::underscore($controller).".php"; ?>
|
||||
</p>
|
||||
|
||||
<?if (DEBUG>1):?>
|
||||
<p>
|
||||
<strong>Error</strong>: Unable to execute action <em><?php echo $this->controller->missingAction;?></em> in
|
||||
<em><?php echo $controller;?></em>
|
||||
</p>
|
||||
|
||||
<?php if (DEBUG>1):?>
|
||||
<h2>Controller dump:</h2>
|
||||
<pre>
|
||||
<?
|
||||
<?php
|
||||
unset($this->db);
|
||||
print_r($this);
|
||||
?>
|
||||
</pre>
|
||||
<?endif?>
|
||||
<?php endif?>
|
|
@ -1,6 +1,6 @@
|
|||
<h1>Missing controller</h1>
|
||||
|
||||
<p class="error">You are seeing this error because controller <em><?=$this->missingController;?></em>
|
||||
<?php $missing = $this->controller->missingController; ?>
|
||||
<p class="error">You are seeing this error because controller <em><?php echo $missing;?></em>
|
||||
could not be found.
|
||||
</p>
|
||||
|
||||
|
@ -10,15 +10,21 @@ view file, a user-customizable error page for handling invalid controller dispat
|
|||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Fatal</strong>: Unable to load controller <em><?=$this->missingController;?></em>
|
||||
<strong>Fatal</strong>: Unable to load controller <em><?php echo $missing;?></em>
|
||||
</p>
|
||||
|
||||
<?if (DEBUG>1):?>
|
||||
<p>
|
||||
<strong>Fatal</strong>: Create Class:
|
||||
</p>
|
||||
<p>
|
||||
<?php echo "<pre><?php\n\nclass " . $missing ." extends AppController {\n}\n\n?></pre>"; ?>
|
||||
in file : <?php echo "app".DS."controllers".DS.Inflector::underscore($missing).".php"; ?>
|
||||
</p>
|
||||
<?php if (DEBUG>1):?>
|
||||
<h2>Controller dump:</h2>
|
||||
<pre>
|
||||
<?
|
||||
<?php
|
||||
unset($this->db);
|
||||
print_r($this);
|
||||
?>
|
||||
</pre>
|
||||
<?endif?>
|
||||
<?php endif?>
|
|
@ -1,6 +1,6 @@
|
|||
<h1>Scaffold Requires a Database Connection</h1>
|
||||
<h1>Requires a Database Connection</h1>
|
||||
|
||||
<p class="error">Missing Database Connection
|
||||
<p class="error">Missing Database Connection: Model <?php echo $this->controller->missingConnection;?> requires a database connection
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
|
19
app/views/errors/missing_scaffolddb.thtml
Normal file
19
app/views/errors/missing_scaffolddb.thtml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<h1>Scaffold Requires a Database Connection</h1>
|
||||
|
||||
<p class="error">Missing Database Connection: Scaffold Does not work without a database connection
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<span class="notice"><strong>Notice:</strong> this error is being rendered by the <code>app/views/errors/missing_database.thtml</code>
|
||||
view file, a user-customizable error page for handling errors within CakePHP.</span>
|
||||
</p>
|
||||
|
||||
<?if (DEBUG>1):?>
|
||||
<h2>Controller dump:</h2>
|
||||
<pre>
|
||||
<?
|
||||
unset($this->db);
|
||||
print_r($this);
|
||||
?>
|
||||
</pre>
|
||||
<?endif?>
|
8
app/views/errors/missing_table.thtml
Normal file
8
app/views/errors/missing_table.thtml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php $missing = $this->controller->missingTable;?>
|
||||
<h1>Missing Database Table</h1>
|
||||
<p class="error">No Database table for model <?php echo $missing;?> (expected "<? echo $this->controller->missingTableName;?>"), create it first.
|
||||
</p>
|
||||
<p>
|
||||
<span class="notice"><strong>Notice:</strong> this error is being rendered by the <code>app/views/errors/missing_table.thtml</code>
|
||||
view file, a user-customizable error page.</span>
|
||||
</p>
|
|
@ -359,42 +359,59 @@ class Controller extends Object
|
|||
return $view->render($action, $layout, $file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function missingController()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingController');
|
||||
}
|
||||
/**
|
||||
* Renders the Missing Controller web page.
|
||||
*
|
||||
*/
|
||||
function missingController()
|
||||
{
|
||||
$this->pageTitle = 'Missing Controller';
|
||||
$this->render('../errors/missingController');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function missingAction()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingAction');
|
||||
}
|
||||
|
||||
/**
|
||||
* Enter description here...
|
||||
*
|
||||
*/
|
||||
function missingView()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingView');
|
||||
}
|
||||
/**
|
||||
* Renders the Missing Action web page.
|
||||
*
|
||||
*/
|
||||
function missingAction()
|
||||
{
|
||||
$this->pageTitle = 'Missing Method in Controller';
|
||||
$this->render('../errors/missingAction');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Missing Database web page.
|
||||
*
|
||||
*/
|
||||
function missingDatabase()
|
||||
{
|
||||
$this->pageTitle = 'Scaffold Missing Database Connection';
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingScaffolddb');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Missing Table web page.
|
||||
*
|
||||
*/
|
||||
function missingTable($table_name)
|
||||
{
|
||||
$this->missingTableName = $table_name;
|
||||
$this->pageTitle = 'Missing Database Table';
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingTable');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Missing Table web page.
|
||||
*
|
||||
*/
|
||||
function missingConnection()
|
||||
{
|
||||
$this->pageTitle = 'Missing Database Connection';
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->render('../errors/missingDatabase');
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Displays an error page to the user. Uses layouts/error.html to render the page.
|
||||
// *
|
||||
|
|
|
@ -112,6 +112,7 @@ class Dispatcher extends Object
|
|||
$ctrlClass = 'AppController';
|
||||
$controller = new $ctrlClass($this);
|
||||
$params['action'] = 'missingController';
|
||||
$params['controller'] = Inflector::camelize($params['controller']."Controller");
|
||||
$controller->missingController = $params['controller'];
|
||||
}
|
||||
else
|
||||
|
@ -415,7 +416,8 @@ class Dispatcher extends Object
|
|||
}
|
||||
else
|
||||
{
|
||||
$this->errorUnknownAction($url, get_class($controller_class), $params['action']);
|
||||
$controller_class->missingAction = $params['action'];
|
||||
call_user_func_array(array(&$controller_class, 'missingAction'), null);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -216,7 +216,11 @@ class Model extends Object
|
|||
else
|
||||
{
|
||||
$dboFactory = DboFactory::getInstance();
|
||||
$this->db =& $dboFactory ;
|
||||
$this->db =& $dboFactory ;
|
||||
if(empty($this->db))
|
||||
{
|
||||
$this->_throwMissingConnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -754,7 +758,7 @@ class Model extends Object
|
|||
{
|
||||
if (!in_array(strtolower($table_name), $this->db->tables()))
|
||||
{
|
||||
trigger_error (sprintf(ERROR_NO_MODEL_TABLE, get_class($this), $table_name), E_USER_ERROR);
|
||||
$this->_throwMissingModel($table_name);
|
||||
die();
|
||||
}
|
||||
else
|
||||
|
@ -924,7 +928,7 @@ class Model extends Object
|
|||
*/
|
||||
function saveField($name, $value)
|
||||
{
|
||||
return Model::save(array($name=>$value), false);
|
||||
return Model::save(array($this->table=>array($name=>$value)), false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1610,6 +1614,22 @@ class Model extends Object
|
|||
{
|
||||
return $this->db->lastInsertId($this->table, 'id');
|
||||
}
|
||||
|
||||
function _throwMissingTable($table_name)
|
||||
{
|
||||
$error = new AppController();
|
||||
$error->missingTable = get_class($this);
|
||||
call_user_func_array(array(&$error, 'missingTable'), $table_name);
|
||||
exit;
|
||||
}
|
||||
|
||||
function _throwMissingConnection()
|
||||
{
|
||||
$error = new AppController();
|
||||
$error->missingConnection = get_class($this);
|
||||
call_user_func_array(array(&$error, 'missingConnection'), null);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -431,29 +431,6 @@ class View extends Object
|
|||
print ($this->_render(VIEWS.'layouts/error.thtml', array('code'=>$code,'name'=>$name,'message'=>$message)));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Renders the Missing Controller web page.
|
||||
*
|
||||
*/
|
||||
function missingController()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->missingController = $this->name;
|
||||
$this->render('../errors/missingController');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Missing Action web page.
|
||||
*
|
||||
*/
|
||||
function missingAction()
|
||||
{
|
||||
//We are simulating action call below, this is not a filename!
|
||||
$this->missingAction = $this->name;
|
||||
$this->render('../errors/missingAction');
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the Missing View web page.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue