mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Fixes #3474, Plugin Models Not Loading for 1.2.0.5875 pre-beta release.
Remove deprecated loadPluginController() from basics.php Fixed changed loadPluginController to loadController in CacheHelper git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5905 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
f41aa80b78
commit
7bc90a2eb1
3 changed files with 11 additions and 61 deletions
|
@ -108,9 +108,10 @@
|
|||
if (!class_exists('AppModel')) {
|
||||
loadModel();
|
||||
}
|
||||
|
||||
$plugin = Inflector::underscore($plugin);
|
||||
$pluginAppModel = Inflector::camelize($plugin . '_app_model');
|
||||
$pluginAppModelFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_model.php';
|
||||
|
||||
if (!class_exists($pluginAppModel)) {
|
||||
if (file_exists($pluginAppModelFile)) {
|
||||
require($pluginAppModelFile);
|
||||
|
@ -192,9 +193,10 @@
|
|||
|
||||
if (strpos($name, '.') !== false) {
|
||||
list($plugin, $name) = explode('.', $name);
|
||||
|
||||
$plugin = Inflector::underscore($plugin);
|
||||
$pluginAppModel = Inflector::camelize($plugin . '_app_model');
|
||||
$pluginAppModelFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_model.php';
|
||||
|
||||
if (!class_exists($pluginAppModel)) {
|
||||
if (file_exists($pluginAppModelFile)) {
|
||||
require($pluginAppModelFile);
|
||||
|
@ -357,12 +359,7 @@
|
|||
}
|
||||
|
||||
if (empty($name)) {
|
||||
if (!class_exists(Inflector::camelize($plugin . 'Controller'))) {
|
||||
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
|
||||
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!class_exists($name . 'Controller')) {
|
||||
|
@ -371,11 +368,6 @@
|
|||
if (file_exists($file)) {
|
||||
require($file);
|
||||
return true;
|
||||
} elseif (!class_exists(Inflector::camelize($plugin) . 'Controller')) {
|
||||
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
|
||||
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -419,53 +411,6 @@
|
|||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Loads a plugin's controller.
|
||||
*
|
||||
* @param string $plugin Name of plugin
|
||||
* @param string $controller Name of controller to load
|
||||
* @return boolean Success
|
||||
* @deprecated
|
||||
*/
|
||||
function loadPluginController($plugin, $controller) {
|
||||
$pluginAppController = Inflector::camelize($plugin . '_app_controller');
|
||||
$plugin = Inflector::underscore($plugin);
|
||||
$pluginAppControllerFile = APP . 'plugins' . DS . $plugin . DS . $plugin . '_app_controller.php';
|
||||
if (!class_exists($pluginAppController)) {
|
||||
if (file_exists($pluginAppControllerFile)) {
|
||||
require($pluginAppControllerFile);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($controller)) {
|
||||
if (!class_exists(Inflector::camelize($plugin . 'controller'))) {
|
||||
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
|
||||
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!class_exists($controller . 'Controller')) {
|
||||
$controller = Inflector::underscore($controller);
|
||||
$file = APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $controller . '_controller.php';
|
||||
|
||||
if (file_exists($file)) {
|
||||
require($file);
|
||||
return true;
|
||||
} elseif (!class_exists(Inflector::camelize($plugin) . 'Controller')) {
|
||||
if (file_exists(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php')) {
|
||||
require(APP . 'plugins' . DS . $plugin . DS . 'controllers' . DS . $plugin . '_controller.php');
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* Loads a helper
|
||||
*
|
||||
|
|
|
@ -375,6 +375,11 @@ class Controller extends Object {
|
|||
$plugin = $this->plugin . '.';
|
||||
}
|
||||
|
||||
if (strpos($modelClass, '.') !== false) {
|
||||
list($plugin, $modelClass) = explode('.', $modelClass);
|
||||
$plugin = $plugin . '.';
|
||||
}
|
||||
|
||||
$modelKey = Inflector::underscore($modelClass);
|
||||
|
||||
if (!class_exists($modelClass)) {
|
||||
|
|
|
@ -223,7 +223,7 @@ class CacheHelper extends AppHelper {
|
|||
require(\''.CAKE . 'app_controller.php\');
|
||||
}
|
||||
}
|
||||
loadPluginController(\''.$this->plugin.'\',\''.$this->controllerName.'\');
|
||||
loadController(\'' . $this->plugin . '.' . $this->controllerName . '\');
|
||||
loadPluginModels(\''.$this->plugin.'\');
|
||||
';
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue