mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Replacing some of the App::import by App::uses
This commit is contained in:
parent
848461f7a0
commit
b8344ecd33
43 changed files with 127 additions and 147 deletions
|
@ -17,8 +17,8 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Component', 'Acl');
|
App::uses('AclComponent', 'Controller/Component');
|
||||||
App::import('Model', 'DbAcl');
|
App::uses('DbAcl', 'Model');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shell for ACL management. This console is known to have issues with zend.ze1_compatibility_mode
|
* Shell for ACL management. This console is known to have issues with zend.ze1_compatibility_mode
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.5012
|
* @since CakePHP(tm) v 1.2.0.5012
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'File');
|
App::uses('File', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API shell to show method signatures of CakePHP core classes.
|
* API shell to show method signatures of CakePHP core classes.
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::uses('Model', 'Model');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bake is a command-line code generation utility for automating programmer chores.
|
* Bake is a command-line code generation utility for automating programmer chores.
|
||||||
*
|
*
|
||||||
|
@ -151,11 +153,11 @@ class BakeShell extends Shell {
|
||||||
|
|
||||||
$modelExists = false;
|
$modelExists = false;
|
||||||
$model = $this->_modelName($name);
|
$model = $this->_modelName($name);
|
||||||
if (App::import('Model', $model)) {
|
App::uses($model, 'Model');
|
||||||
|
if (class_exists($model)) {
|
||||||
$object = new $model();
|
$object = new $model();
|
||||||
$modelExists = true;
|
$modelExists = true;
|
||||||
} else {
|
} else {
|
||||||
App::import('Model', 'Model', false);
|
|
||||||
$object = new Model(array('name' => $name, 'ds' => $this->connection));
|
$object = new Model(array('name' => $name, 'ds' => $this->connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +178,8 @@ class BakeShell extends Shell {
|
||||||
$this->Controller->bakeTest($controller);
|
$this->Controller->bakeTest($controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (App::import('Controller', $controller)) {
|
App::uses($controller . 'Controller', 'Controller')
|
||||||
|
if (class_exists($controller . 'Controller')) {
|
||||||
$this->View->args = array($controller);
|
$this->View->args = array($controller);
|
||||||
$this->View->execute();
|
$this->View->execute();
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,11 +56,11 @@ class ConsoleShell extends Shell {
|
||||||
App::uses('Dispatcher', 'Routing');
|
App::uses('Dispatcher', 'Routing');
|
||||||
$this->Dispatcher = new Dispatcher();
|
$this->Dispatcher = new Dispatcher();
|
||||||
$this->models = App::objects('model');
|
$this->models = App::objects('model');
|
||||||
App::import('Model', $this->models);
|
|
||||||
|
|
||||||
foreach ($this->models as $model) {
|
foreach ($this->models as $model) {
|
||||||
$class = Inflector::camelize(str_replace('.php', '', $model));
|
$class = Inflector::camelize(str_replace('.php', '', $model));
|
||||||
$this->models[$model] = $class;
|
$this->models[$model] = $class;
|
||||||
|
App::uses($class, 'Model');
|
||||||
$this->{$class} = new $class();
|
$this->{$class} = new $class();
|
||||||
}
|
}
|
||||||
$this->out('Model classes:');
|
$this->out('Model classes:');
|
||||||
|
|
|
@ -108,7 +108,8 @@ class ControllerTask extends BakeTask {
|
||||||
foreach ($this->__tables as $table) {
|
foreach ($this->__tables as $table) {
|
||||||
$model = $this->_modelName($table);
|
$model = $this->_modelName($table);
|
||||||
$controller = $this->_controllerName($model);
|
$controller = $this->_controllerName($model);
|
||||||
if (App::import('Model', $model)) {
|
App::uses($model, 'Model');
|
||||||
|
if (!class_exists($model)) {
|
||||||
$actions = $this->bakeActions($controller);
|
$actions = $this->bakeActions($controller);
|
||||||
if ($this->bake($controller, $actions) && $unitTestExists) {
|
if ($this->bake($controller, $actions) && $unitTestExists) {
|
||||||
$this->bakeTest($controller);
|
$this->bakeTest($controller);
|
||||||
|
@ -273,7 +274,8 @@ class ControllerTask extends BakeTask {
|
||||||
if ($plugin) {
|
if ($plugin) {
|
||||||
$modelImport = $plugin . '.' . $modelImport;
|
$modelImport = $plugin . '.' . $modelImport;
|
||||||
}
|
}
|
||||||
if (!App::import('Model', $modelImport)) {
|
App::uses($modelImport, 'Model');
|
||||||
|
if (!class_exists($modelImport)) {
|
||||||
$this->err(__('You must have a model for this class to build basic methods. Please try again.'));
|
$this->err(__('You must have a model for this class to build basic methods. Please try again.'));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,7 +353,7 @@ class DbConfigTask extends Shell {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function getConfig() {
|
public function getConfig() {
|
||||||
App::import('Model', 'ConnectionManager', false);
|
App::uses('ConnectionManager', 'Model');
|
||||||
|
|
||||||
$useDbConfig = 'default';
|
$useDbConfig = 'default';
|
||||||
$configs = get_class_vars($this->databaseClassName);
|
$configs = get_class_vars($this->databaseClassName);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::uses('BakeTask', 'Console/Command/Task');
|
App::uses('BakeTask', 'Console/Command/Task');
|
||||||
|
App::uses('Model', 'Model');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task class for creating and updating fixtures files.
|
* Task class for creating and updating fixtures files.
|
||||||
|
@ -186,9 +187,7 @@ class FixtureTask extends BakeTask {
|
||||||
* @return string Baked fixture content
|
* @return string Baked fixture content
|
||||||
*/
|
*/
|
||||||
public function bake($model, $useTable = false, $importOptions = array()) {
|
public function bake($model, $useTable = false, $importOptions = array()) {
|
||||||
if (!class_exists('CakeSchema')) {
|
App::uses('CakeSchema', 'Model');
|
||||||
App::import('Model', 'CakeSchema', false);
|
|
||||||
}
|
|
||||||
$table = $schema = $records = $import = $modelImport = $recordImport = null;
|
$table = $schema = $records = $import = $modelImport = $recordImport = null;
|
||||||
if (!$useTable) {
|
if (!$useTable) {
|
||||||
$useTable = Inflector::tableize($model);
|
$useTable = Inflector::tableize($model);
|
||||||
|
@ -394,7 +393,6 @@ class FixtureTask extends BakeTask {
|
||||||
} else {
|
} else {
|
||||||
$condition = 'WHERE 1=1 LIMIT ' . (isset($this->params['count']) ? $this->params['count'] : 10);
|
$condition = 'WHERE 1=1 LIMIT ' . (isset($this->params['count']) ? $this->params['count'] : 10);
|
||||||
}
|
}
|
||||||
App::import('Model', 'Model', false);
|
|
||||||
$modelObject = new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
|
$modelObject = new Model(array('name' => $modelName, 'table' => $useTable, 'ds' => $this->connection));
|
||||||
$records = $modelObject->find('all', array(
|
$records = $modelObject->find('all', array(
|
||||||
'conditions' => $condition,
|
'conditions' => $condition,
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
App::uses('BakeTask', 'Console/Command/Task');
|
App::uses('BakeTask', 'Console/Command/Task');
|
||||||
App::uses('ConnectionManager', 'Model');
|
App::uses('ConnectionManager', 'Model');
|
||||||
|
App::uses('Model', 'Model');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task class for creating and updating model files.
|
* Task class for creating and updating model files.
|
||||||
|
@ -74,7 +75,6 @@ class ModelTask extends BakeTask {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function execute() {
|
public function execute() {
|
||||||
App::import('Model', 'Model', false);
|
|
||||||
parent::execute();
|
parent::execute();
|
||||||
|
|
||||||
if (empty($this->args)) {
|
if (empty($this->args)) {
|
||||||
|
|
|
@ -17,7 +17,8 @@
|
||||||
* @since CakePHP(tm) v 1.2
|
* @since CakePHP(tm) v 1.2
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'File');
|
|
||||||
|
App::uses('File', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task class for creating a plugin
|
* Task class for creating a plugin
|
||||||
|
|
|
@ -191,7 +191,8 @@ class ViewTask extends BakeTask {
|
||||||
$model = $this->_modelName($table);
|
$model = $this->_modelName($table);
|
||||||
$this->controllerName = $this->_controllerName($model);
|
$this->controllerName = $this->_controllerName($model);
|
||||||
$this->controllerPath = Inflector::underscore($this->controllerName);
|
$this->controllerPath = Inflector::underscore($this->controllerName);
|
||||||
if (App::import('Model', $model)) {
|
App::uses($model, 'Model');
|
||||||
|
if (class_exists($model)) {
|
||||||
$vars = $this->__loadController();
|
$vars = $this->__loadController();
|
||||||
if (!$actions) {
|
if (!$actions) {
|
||||||
$actions = $this->_methodsToBake();
|
$actions = $this->_methodsToBake();
|
||||||
|
@ -272,17 +273,18 @@ class ViewTask extends BakeTask {
|
||||||
$this->err(__('Controller not found'));
|
$this->err(__('Controller not found'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$import = $this->controllerName;
|
$plugin = null;
|
||||||
if ($this->plugin) {
|
if ($this->plugin) {
|
||||||
$import = $this->plugin . '.' . $this->controllerName;
|
$plugin = $this->plugin . '.';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!App::import('Controller', $import)) {
|
$controllerClassName = $this->controllerName . 'Controller';
|
||||||
$file = $this->controllerPath . '_controller.php';
|
App::uses($controllerName, $plugin . 'Controller');
|
||||||
|
if (!class_exists($controllerClassName)) {
|
||||||
|
$file = $controllerClassName . '.php';
|
||||||
$this->err(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));
|
$this->err(__("The file '%s' could not be found.\nIn order to bake a view, you'll need to first create the controller.", $file));
|
||||||
$this->_stop();
|
$this->_stop();
|
||||||
}
|
}
|
||||||
$controllerClassName = $this->controllerName . 'Controller';
|
|
||||||
$controllerObj = new $controllerClassName();
|
$controllerObj = new $controllerClassName();
|
||||||
$controllerObj->plugin = $this->plugin;
|
$controllerObj->plugin = $this->plugin;
|
||||||
$controllerObj->constructClasses();
|
$controllerObj->constructClasses();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
App::uses('ErrorHandler', 'Error');
|
App::uses('ErrorHandler', 'Error');
|
||||||
App::uses('ConsoleOutput', 'Console');
|
App::uses('ConsoleOutput', 'Console');
|
||||||
|
App::uses('CakeLog', 'Log');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Error Handler for Cake console. Does simple printing of the
|
* Error Handler for Cake console. Does simple printing of the
|
||||||
|
@ -79,7 +80,6 @@ class ConsoleErrorHandler extends ErrorHandler {
|
||||||
$stderr->write(__("<error>%s Error:</error> %s\n", $name, $message));
|
$stderr->write(__("<error>%s Error:</error> %s\n", $name, $message));
|
||||||
|
|
||||||
if (Configure::read('debug') == 0) {
|
if (Configure::read('debug') == 0) {
|
||||||
App::import('Core', 'CakeLog');
|
|
||||||
CakeLog::write($log, $message);
|
CakeLog::write($log, $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,7 +662,7 @@ class IniAcl extends Object implements AclInterface {
|
||||||
* @return array INI section structure
|
* @return array INI section structure
|
||||||
*/
|
*/
|
||||||
public function readConfigFile($filename) {
|
public function readConfigFile($filename) {
|
||||||
App::import('Core', 'config/IniReader');
|
App::uses('IniReader', 'Configure');
|
||||||
$iniFile = new IniReader(dirname($filename) . DS);
|
$iniFile = new IniReader(dirname($filename) . DS);
|
||||||
return $iniFile->read(basename($filename));
|
return $iniFile->read(basename($filename));
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,9 +433,9 @@ class EmailComponent extends Component {
|
||||||
$viewClass = $this->Controller->view;
|
$viewClass = $this->Controller->view;
|
||||||
|
|
||||||
if ($viewClass != 'View') {
|
if ($viewClass != 'View') {
|
||||||
list($plugin, $viewClass) = pluginSplit($viewClass);
|
list($plugin, $viewClass) = pluginSplit($viewClass, true);
|
||||||
$viewClass = $viewClass . 'View';
|
$viewClass = $viewClass . 'View';
|
||||||
App::import('View', $this->Controller->view);
|
App::uses($viewClass, $plugin . 'View');
|
||||||
}
|
}
|
||||||
|
|
||||||
$View = new $viewClass($this->Controller, false);
|
$View = new $viewClass($this->Controller, false);
|
||||||
|
@ -810,7 +810,7 @@ class EmailComponent extends Component {
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
function _smtp() {
|
function _smtp() {
|
||||||
App::import('Core', 'CakeSocket');
|
App::uses('CakeSocket', 'Network');
|
||||||
|
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
|
|
|
@ -542,7 +542,8 @@ class RequestHandlerComponent extends Component {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$isAdded) {
|
if (!$isAdded) {
|
||||||
if (App::import('Helper', $helper)) {
|
App::uses($helper . 'Helper', 'Helper');
|
||||||
|
if (class_exists($helper . 'Helper')) {
|
||||||
$controller->helpers[] = $helper;
|
$controller->helpers[] = $helper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -789,9 +789,9 @@ class Controller extends Object {
|
||||||
|
|
||||||
$viewClass = $this->view;
|
$viewClass = $this->view;
|
||||||
if ($this->view != 'View') {
|
if ($this->view != 'View') {
|
||||||
list($plugin, $viewClass) = pluginSplit($viewClass);
|
list($plugin, $viewClass) = pluginSplit($viewClass, true);
|
||||||
$viewClass = $viewClass . 'View';
|
$viewClass = $viewClass . 'View';
|
||||||
App::import('View', $this->view);
|
App::uses($viewClass, $plugin . 'View');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->request->params['models'] = $this->modelNames;
|
$this->request->params['models'] = $this->modelNames;
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
* ### Adding paths
|
* ### Adding paths
|
||||||
*
|
*
|
||||||
* You can add paths to the search indexes App uses to find classes using `App::build()`. Adding
|
* You can add paths to the search indexes App uses to find classes using `App::build()`. Adding
|
||||||
* additional controller paths for example would alter where CakePHP looks for controllers when you
|
* additional controller paths for example would alter where CakePHP looks for controllers.
|
||||||
* call App::import('Controller', 'Posts'); This allows you to split your application up across the filesystem.
|
* This allows you to split your application up across the filesystem.
|
||||||
*
|
*
|
||||||
* ### Inspecting loaded paths
|
* ### Inspecting loaded paths
|
||||||
*
|
*
|
||||||
|
@ -261,7 +261,7 @@ class App {
|
||||||
'View' => array(VIEWS),
|
'View' => array(VIEWS),
|
||||||
'View/Helper' => array(HELPERS),
|
'View/Helper' => array(HELPERS),
|
||||||
'locales' => array(APP . 'locale' . DS),
|
'locales' => array(APP . 'locale' . DS),
|
||||||
'shells' => array(
|
'Console' => array(
|
||||||
APP . 'console' . DS . 'shells' . DS,
|
APP . 'console' . DS . 'shells' . DS,
|
||||||
APP . 'vendors' . DS . 'shells' . DS,
|
APP . 'vendors' . DS . 'shells' . DS,
|
||||||
VENDORS . 'shells' . DS
|
VENDORS . 'shells' . DS
|
||||||
|
|
|
@ -113,7 +113,7 @@ class ErrorHandler {
|
||||||
CakeLog::write(LOG_ERR, '[' . get_class($exception) . '] ' . $exception->getMessage());
|
CakeLog::write(LOG_ERR, '[' . get_class($exception) . '] ' . $exception->getMessage());
|
||||||
}
|
}
|
||||||
if ($config['renderer'] !== 'ExceptionRenderer') {
|
if ($config['renderer'] !== 'ExceptionRenderer') {
|
||||||
App::import('Lib', $config['renderer']);
|
App::uses($config['renderer'], 'Error');
|
||||||
}
|
}
|
||||||
$error = new $config['renderer']($exception);
|
$error = new $config['renderer']($exception);
|
||||||
$error->render();
|
$error->render();
|
||||||
|
|
|
@ -20,6 +20,9 @@
|
||||||
* @since CakePHP(tm) v 2.0
|
* @since CakePHP(tm) v 2.0
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
App::import('Sanitize', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Exception Renderer.
|
* Exception Renderer.
|
||||||
*
|
*
|
||||||
|
@ -88,8 +91,6 @@ class ExceptionRenderer {
|
||||||
* @param array $messages Error messages
|
* @param array $messages Error messages
|
||||||
*/
|
*/
|
||||||
function __construct(Exception $exception) {
|
function __construct(Exception $exception) {
|
||||||
App::import('Core', 'Sanitize');
|
|
||||||
|
|
||||||
$this->controller = $this->_getController($exception);
|
$this->controller = $this->_getController($exception);
|
||||||
|
|
||||||
if (method_exists($this->controller, 'apperror')) {
|
if (method_exists($this->controller, 'apperror')) {
|
||||||
|
|
|
@ -101,7 +101,7 @@ class I18n {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used by the translation functions in basics.php
|
* Used by the translation functions in basics.php
|
||||||
* Can also be used like I18n::translate(); but only if the App::import('I18n'); has been used to load the class.
|
* Returns a translated string based on current language and translation files stored in locale folder
|
||||||
*
|
*
|
||||||
* @param string $singular String to translate
|
* @param string $singular String to translate
|
||||||
* @param string $plural Plural string (if any)
|
* @param string $plural Plural string (if any)
|
||||||
|
|
|
@ -1078,7 +1078,7 @@ class Multibyte {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!Configure::configured('_cake_core_')) {
|
if (!Configure::configured('_cake_core_')) {
|
||||||
App::import('Core', 'config/PhpReader');
|
App::uses('PhpReader', 'Configure');
|
||||||
Configure::config('_cake_core_', new PhpReader(CAKE . 'config' . DS));
|
Configure::config('_cake_core_', new PhpReader(CAKE . 'config' . DS));
|
||||||
}
|
}
|
||||||
Configure::load('unicode' . DS . 'casefolding' . DS . $range, '_cake_core_');
|
Configure::load('unicode' . DS . 'casefolding' . DS . $range, '_cake_core_');
|
||||||
|
|
|
@ -94,12 +94,7 @@ class BehaviorCollection extends ObjectCollection {
|
||||||
list($plugin, $name) = pluginSplit($behavior);
|
list($plugin, $name) = pluginSplit($behavior);
|
||||||
$class = $name . 'Behavior';
|
$class = $name . 'Behavior';
|
||||||
|
|
||||||
if (!App::import('Behavior', $behavior)) {
|
App::uses($class, 'Model/Behavior');
|
||||||
throw new MissingBehaviorFileException(array(
|
|
||||||
'file' => Inflector::underscore($behavior) . '.php',
|
|
||||||
'class' => $class
|
|
||||||
));
|
|
||||||
}
|
|
||||||
if (!class_exists($class)) {
|
if (!class_exists($class)) {
|
||||||
throw new MissingBehaviorClassException(array(
|
throw new MissingBehaviorClassException(array(
|
||||||
'file' => Inflector::underscore($behavior) . '.php',
|
'file' => Inflector::underscore($behavior) . '.php',
|
||||||
|
|
|
@ -207,9 +207,8 @@ class CakeSchema extends Object {
|
||||||
));
|
));
|
||||||
$db = ConnectionManager::getDataSource($connection);
|
$db = ConnectionManager::getDataSource($connection);
|
||||||
|
|
||||||
App::import('Model', 'AppModel');
|
|
||||||
if (isset($this->plugin)) {
|
if (isset($this->plugin)) {
|
||||||
App::import('Model', Inflector::camelize($this->plugin) . 'AppModel');
|
App::uses(Inflector::camelize($this->plugin) . 'AppModel', $this->plugin . '.Model');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tables = array();
|
$tables = array();
|
||||||
|
@ -234,7 +233,8 @@ class CakeSchema extends Object {
|
||||||
if (isset($this->plugin)) {
|
if (isset($this->plugin)) {
|
||||||
$importModel = $this->plugin . '.' . $model;
|
$importModel = $this->plugin . '.' . $model;
|
||||||
}
|
}
|
||||||
if (!App::import('Model', $importModel)) {
|
App::uses($importModel, 'Model');
|
||||||
|
if (!class_exists($importModel)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$vars = get_class_vars($model);
|
$vars = get_class_vars($model);
|
||||||
|
|
|
@ -17,7 +17,9 @@
|
||||||
* @since CakePHP(tm) v 0.10.0.1076
|
* @since CakePHP(tm) v 0.10.0.1076
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::uses('String', 'Utility');
|
App::uses('String', 'Utility');
|
||||||
|
App::uses('View', 'View');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DboSource
|
* DboSource
|
||||||
|
@ -763,7 +765,6 @@ class DboSource extends DataSource {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (PHP_SAPI != 'cli') {
|
if (PHP_SAPI != 'cli') {
|
||||||
App::import('Core', 'View');
|
|
||||||
$controller = null;
|
$controller = null;
|
||||||
$View = new View($controller, false);
|
$View = new View($controller, false);
|
||||||
$View->set('logs', array($this->configKeyName => $log));
|
$View->set('logs', array($this->configKeyName => $log));
|
||||||
|
|
|
@ -585,7 +585,7 @@ class Set {
|
||||||
|
|
||||||
if (is_string($path) && strpos($path, '{') !== false) {
|
if (is_string($path) && strpos($path, '{') !== false) {
|
||||||
$path = String::tokenize($path, '.', '{', '}');
|
$path = String::tokenize($path, '.', '{', '}');
|
||||||
} else {
|
} elseif (is_string($path)) {
|
||||||
$path = explode('.', $path);
|
$path = explode('.', $path);
|
||||||
}
|
}
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
|
|
|
@ -24,7 +24,7 @@ endif;
|
||||||
<a href="http://cakephp.org/changelogs/1.3.6"><?php __('Read the changelog'); ?> </a>
|
<a href="http://cakephp.org/changelogs/1.3.6"><?php __('Read the changelog'); ?> </a>
|
||||||
<?php
|
<?php
|
||||||
if (Configure::read('debug') > 0):
|
if (Configure::read('debug') > 0):
|
||||||
Debugger::checkSecurityKeys();
|
//Debugger::checkSecurityKeys();
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
|
|
|
@ -670,9 +670,7 @@ if (!function_exists('sortByKey')) {
|
||||||
* @param string $message Message to write to log
|
* @param string $message Message to write to log
|
||||||
*/
|
*/
|
||||||
function LogError($message) {
|
function LogError($message) {
|
||||||
if (!class_exists('CakeLog')) {
|
App::uses('CakeLog', 'Log');
|
||||||
App::import('Core', 'CakeLog');
|
|
||||||
}
|
|
||||||
$bad = array("\n", "\r", "\t");
|
$bad = array("\n", "\r", "\t");
|
||||||
$good = ' ';
|
$good = ' ';
|
||||||
CakeLog::write('error', str_replace($bad, $good, $message));
|
CakeLog::write('error', str_replace($bad, $good, $message));
|
||||||
|
|
|
@ -17,8 +17,9 @@
|
||||||
* @since CakePHP(tm) v 1.2.0.4206
|
* @since CakePHP(tm) v 1.2.0.4206
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once CAKE . 'basics.php';
|
require_once CAKE . 'basics.php';
|
||||||
App::import('Core', 'Folder');
|
App::uses('Folder', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BasicsTest class
|
* BasicsTest class
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
App::import('Shell', 'TaskCollection', false);
|
App::uses('TaskCollection', 'Console');
|
||||||
App::import('Shell', 'Shell', false);
|
App::uses('Shell', 'Console');
|
||||||
|
|
||||||
class TaskCollectionTest extends CakeTestCase {
|
class TaskCollectionTest extends CakeTestCase {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,10 +17,10 @@
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.2.0.7726
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'Acl');
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('AclShell', 'Console/Command');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AclShellTest class
|
* AclShellTest class
|
||||||
|
|
|
@ -17,11 +17,10 @@
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.2.0.7726
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'Api');
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
|
||||||
|
|
||||||
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('ApiShell', 'Console/Command');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ApiShellTest class
|
* ApiShellTest class
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'Bake', false);
|
|
||||||
App::import('Shell', 'tasks/model', false);
|
|
||||||
App::import('Shell', 'tasks/controller', false);
|
|
||||||
App::import('Shell', 'tasks/db_config', false);
|
|
||||||
|
|
||||||
App::import('Core', 'Controller');
|
App::uses('ShellDispatcher', 'Console');
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('BakeShell', 'Console/Command');
|
||||||
|
App::uses('ModelTask', 'Console/Command/Task');
|
||||||
|
App::uses('ControllerTask', 'Console/Command/Task');
|
||||||
|
App::uses('DbConfigTask', 'Console/Command/Task');
|
||||||
|
App::uses('Controller', 'Controller');
|
||||||
|
|
||||||
if (!class_exists('UsersController')) {
|
if (!class_exists('UsersController')) {
|
||||||
class UsersController extends Controller {
|
class UsersController extends Controller {
|
||||||
|
@ -76,7 +76,7 @@ class BakeShellTest extends CakeTestCase {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testAllWithModelName() {
|
public function testAllWithModelName() {
|
||||||
App::import('Model', 'User');
|
App::uses('User', 'Model');
|
||||||
$userExists = class_exists('User');
|
$userExists = class_exists('User');
|
||||||
if ($this->skipIf($userExists, 'User class exists, cannot test `bake all [param]`. %s')) {
|
if ($this->skipIf($userExists, 'User class exists, cannot test `bake all [param]`. %s')) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* @since CakePHP v 2.0
|
* @since CakePHP v 2.0
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'CommandList', false);
|
App::import('CommandListShell', 'Console/Command');
|
||||||
|
|
||||||
|
|
||||||
class TestStringOutput extends ConsoleOutput {
|
class TestStringOutput extends ConsoleOutput {
|
||||||
|
|
|
@ -17,13 +17,10 @@
|
||||||
* @since CakePHP v 1.3
|
* @since CakePHP v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'Schema', false);
|
|
||||||
App::import('Model', 'CakeSchema', false);
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
|
||||||
|
|
||||||
|
|
||||||
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('CakeSchema', 'Model');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test for Schema database management
|
* Test for Schema database management
|
||||||
|
|
|
@ -19,10 +19,10 @@
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.2.0.7726
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'Folder');
|
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('Folder', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ShellTestShell class
|
* ShellTestShell class
|
||||||
|
|
|
@ -17,33 +17,27 @@
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'ClassRegistry');
|
|
||||||
App::import('View', 'Helper', false);
|
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', array(
|
|
||||||
'tasks/project',
|
|
||||||
'tasks/controller',
|
|
||||||
'tasks/model',
|
|
||||||
'tasks/template',
|
|
||||||
'tasks/test'
|
|
||||||
));
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('CakeSchema', 'Model');
|
||||||
|
App::uses('ClassRegistry', 'Utility');
|
||||||
|
App::uses('Helper', 'View/Helper');
|
||||||
|
App::uses('ProjectTask', 'Console/Command/Task');
|
||||||
|
App::uses('ControllerTask', 'Console/Command/Task');
|
||||||
|
App::uses('ModelTask', 'Console/Command/Task');
|
||||||
|
App::uses('TemplateTask', 'Console/Command/Task');
|
||||||
|
App::uses('TestTask', 'Console/Command/Task');
|
||||||
|
App::uses('Model', 'Model');
|
||||||
|
|
||||||
$imported = App::import('Model', 'BakeArticle');
|
if (class_exists('BakeArticle')) {
|
||||||
$imported = $imported || App::import('Model', 'BakeComment');
|
|
||||||
$imported = $imported || App::import('Model', 'BakeTag');
|
|
||||||
|
|
||||||
if (!$imported) {
|
|
||||||
define('ARTICLE_MODEL_CREATED', true);
|
define('ARTICLE_MODEL_CREATED', true);
|
||||||
App::import('Core', 'Model');
|
|
||||||
|
|
||||||
class BakeArticle extends Model {
|
class BakeArticle extends Model {
|
||||||
public $name = 'BakeArticle';
|
public $name = 'BakeArticle';
|
||||||
public $hasMany = array('BakeComment');
|
public $hasMany = array('BakeComment');
|
||||||
public $hasAndBelongsToMany = array('BakeTag');
|
public $hasAndBelongsToMany = array('BakeTag');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -17,11 +17,10 @@
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'tasks/DbConfig');
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
|
||||||
|
|
||||||
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('DbConfigTask', 'Console/Command/Task');
|
||||||
|
|
||||||
class TEST_DATABASE_CONFIG {
|
class TEST_DATABASE_CONFIG {
|
||||||
public $default = array(
|
public $default = array(
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.2.0.7726
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Core', 'Folder');
|
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'tasks/Extract', false);
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('Folder', 'Utility');
|
||||||
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('ExtractTask', 'Console/Command/Task');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ExtractTaskTest class
|
* ExtractTaskTest class
|
||||||
|
|
|
@ -17,14 +17,12 @@
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', array(
|
|
||||||
'tasks/fixture',
|
|
||||||
'tasks/template',
|
|
||||||
'tasks/db_config'
|
|
||||||
));
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('FixtureTask', 'Console/Command/Task');
|
||||||
|
App::uses('TemplateTask', 'Console/Command/Task');
|
||||||
|
App::uses('DbConfigTask', 'Console/Command/Task');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FixtureTaskTest class
|
* FixtureTaskTest class
|
||||||
|
|
|
@ -19,14 +19,12 @@
|
||||||
* @since CakePHP v 1.2.6
|
* @since CakePHP v 1.2.6
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', array(
|
|
||||||
'tasks/model',
|
|
||||||
'tasks/fixture',
|
|
||||||
'tasks/template'
|
|
||||||
));
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('FixtureTask', 'Console/Command/Task');
|
||||||
|
App::uses('TemplateTask', 'Console/Command/Task');
|
||||||
|
App::uses('ModelTask', 'Console/Command/Task');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelTaskTest class
|
* ModelTaskTest class
|
||||||
|
|
|
@ -19,15 +19,12 @@
|
||||||
* @since CakePHP v 1.3.0
|
* @since CakePHP v 1.3.0
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', array(
|
|
||||||
'tasks/plugin',
|
|
||||||
'tasks/model'
|
|
||||||
));
|
|
||||||
|
|
||||||
App::import('Core', array('File'));
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('PluginTask', 'Console/Command/Task');
|
||||||
|
App::uses('ModelTask', 'Console/Command/Task');
|
||||||
|
App::import('File', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PluginTaskPlugin class
|
* PluginTaskPlugin class
|
||||||
|
|
|
@ -19,12 +19,11 @@
|
||||||
* @since CakePHP v 1.3.0
|
* @since CakePHP v 1.3.0
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'tasks/project');
|
|
||||||
|
|
||||||
App::import('Core', 'File');
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('ProjecTask', 'Console/Command/Task');
|
||||||
|
App::import('File', 'Utility');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProjectTask Test class
|
* ProjectTask Test class
|
||||||
|
|
|
@ -20,11 +20,10 @@
|
||||||
* @since CakePHP(tm) v 1.3
|
* @since CakePHP(tm) v 1.3
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', 'tasks/template');
|
|
||||||
|
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
|
||||||
|
|
||||||
|
App::uses('ShellDispatcher', 'Console');
|
||||||
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('TemplateTask', 'Console/Command/Task');
|
||||||
/**
|
/**
|
||||||
* TemplateTaskTest class
|
* TemplateTaskTest class
|
||||||
*
|
*
|
||||||
|
|
|
@ -19,16 +19,13 @@
|
||||||
* @since CakePHP v 1.2.0.7726
|
* @since CakePHP v 1.2.0.7726
|
||||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||||
*/
|
*/
|
||||||
App::import('Shell', 'Shell', false);
|
|
||||||
App::import('Shell', array(
|
|
||||||
'tasks/test',
|
|
||||||
'tasks/template'
|
|
||||||
));
|
|
||||||
|
|
||||||
App::import('Controller', 'Controller', false);
|
App::uses('ShellDispatcher', 'Console');
|
||||||
App::import('Model', 'Model', false);
|
App::uses('Shell', 'Console');
|
||||||
|
App::uses('TestTask', 'Console/Command/Task');
|
||||||
require_once CAKE . 'console' . DS . 'shell_dispatcher.php';
|
App::uses('TemplateTask', 'Console/Command/Task');
|
||||||
|
App::uses('Controller', 'Controller');
|
||||||
|
App::uses('Model', 'Model');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Article model
|
* Test Article model
|
||||||
|
|
Loading…
Reference in a new issue