mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
Fixing CacheHelper after removal of controller from View
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3962 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
c680a98eea
commit
e0096f0528
2 changed files with 22 additions and 22 deletions
|
@ -191,7 +191,6 @@ class CacheHelper extends AppHelper {
|
||||||
*/
|
*/
|
||||||
function __writeFile($file, $timestamp) {
|
function __writeFile($file, $timestamp) {
|
||||||
$now = time();
|
$now = time();
|
||||||
$view =& ClassRegistry::getObject('_view_');
|
|
||||||
|
|
||||||
if (is_numeric($timestamp)) {
|
if (is_numeric($timestamp)) {
|
||||||
$cacheTime = $now + $timestamp;
|
$cacheTime = $now + $timestamp;
|
||||||
|
@ -201,21 +200,21 @@ class CacheHelper extends AppHelper {
|
||||||
|
|
||||||
$cache = convertSlash($this->here) . '.php';
|
$cache = convertSlash($this->here) . '.php';
|
||||||
$file = '<!--cachetime:' . $cacheTime . '--><?php
|
$file = '<!--cachetime:' . $cacheTime . '--><?php
|
||||||
loadController(\'' . $view->name . '\');
|
loadController(\'' . $this->controllerName . '\');
|
||||||
loadModels();
|
loadModels();
|
||||||
$this->controller = new ' . $view->name . 'Controller();
|
$this->controller = new ' . $this->controllerName . 'Controller();
|
||||||
$this->helpers = unserialize(\'' . serialize($view->helpers) . '\');
|
$this->helpers = unserialize(\'' . serialize($this->helpers) . '\');
|
||||||
$this->base = \'' . $view->base . '\';
|
$this->base = \'' . $this->base . '\';
|
||||||
$this->layout = \'' . $view->layout. '\';
|
$this->layout = \'' . $this->layout. '\';
|
||||||
$this->webroot = \'' . $view->webroot . '\';
|
$this->webroot = \'' . $this->webroot . '\';
|
||||||
$this->here = \'' . $view->here . '\';
|
$this->here = \'' . $this->here . '\';
|
||||||
$this->namedArgs = \'' . $view->namedArgs . '\';
|
$this->namedArgs = \'' . $this->namedArgs . '\';
|
||||||
$this->argSeparator = \'' . $view->argSeparator . '\';
|
$this->argSeparator = \'' . $this->argSeparator . '\';
|
||||||
$this->params = unserialize(\'' . serialize($view->params) . '\');
|
$this->params = unserialize(\'' . serialize($this->params) . '\');
|
||||||
$this->action = unserialize(\'' . serialize($view->action) . '\');
|
$this->action = unserialize(\'' . serialize($this->action) . '\');
|
||||||
$this->data = unserialize(\'' . serialize($view->data) . '\');
|
$this->data = unserialize(\'' . serialize($this->data) . '\');
|
||||||
$this->themeWeb = \'' . $view->themeWeb . '\';
|
$this->themeWeb = \'' . $this->themeWeb . '\';
|
||||||
$this->plugin = \'' . $view->plugin . '\';
|
$this->plugin = \'' . $this->plugin . '\';
|
||||||
$loadedHelpers = array();
|
$loadedHelpers = array();
|
||||||
$loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
|
$loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
|
||||||
foreach(array_keys($loadedHelpers) as $helper)
|
foreach(array_keys($loadedHelpers) as $helper)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
/**
|
/**
|
||||||
* Included libraries.
|
* Included libraries.
|
||||||
*/
|
*/
|
||||||
uses ('view' . DS . 'helper');
|
uses ('view' . DS . 'helper', 'class_registry');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* View, the V in the MVC triad.
|
* View, the V in the MVC triad.
|
||||||
|
@ -253,7 +253,7 @@ class View extends Object {
|
||||||
* @var array
|
* @var array
|
||||||
* @access protected
|
* @access protected
|
||||||
*/
|
*/
|
||||||
var $__passedVars = array('_viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot', 'helpers', 'here', 'layout', 'modelNames', 'name', 'pageTitle', 'layoutPath', 'viewPath', 'params', 'data', 'webservices', 'plugin', 'namedArgs', 'argSeparator');
|
var $__passedVars = array('_viewVars', 'action', 'autoLayout', 'autoRender', 'ext', 'base', 'webroot', 'helpers', 'here', 'layout', 'modelNames', 'name', 'pageTitle', 'layoutPath', 'viewPath', 'params', 'data', 'webservices', 'plugin', 'namedArgs', 'argSeparator', 'cacheAction');
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -330,7 +330,7 @@ class View extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($action, 'missingView') === false) {
|
if (strpos($action, 'missingView') === false) {
|
||||||
return $this->cakeError('missingView', array(array('className' => $this->controller->name,
|
return $this->cakeError('missingView', array(array('className' => $this->name,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'file' => $viewFileName,
|
'file' => $viewFileName,
|
||||||
'base' => $this->base
|
'base' => $this->base
|
||||||
|
@ -365,7 +365,7 @@ class View extends Object {
|
||||||
if ($out !== false) {
|
if ($out !== false) {
|
||||||
if ($this->layout && $this->autoLayout) {
|
if ($this->layout && $this->autoLayout) {
|
||||||
$out = $this->renderLayout($out);
|
$out = $this->renderLayout($out);
|
||||||
if (isset($this->loaded['cache']) && ((isset($this->controller) && $this->controller->cacheAction != false)) && (defined('CACHE_CHECK') && CACHE_CHECK === true)) {
|
if (isset($this->loaded['cache']) && (($this->cacheAction != false)) && (defined('CACHE_CHECK') && CACHE_CHECK === true)) {
|
||||||
$replace = array('<cake:nocache>', '</cake:nocache>');
|
$replace = array('<cake:nocache>', '</cake:nocache>');
|
||||||
$out = str_replace($replace, '', $out);
|
$out = str_replace($replace, '', $out);
|
||||||
}
|
}
|
||||||
|
@ -720,7 +720,7 @@ class View extends Object {
|
||||||
|
|
||||||
$out = ob_get_clean();
|
$out = ob_get_clean();
|
||||||
|
|
||||||
if (isset($this->loaded['cache']) && ((isset($this->controller) && $this->controller->cacheAction != false)) && (defined('CACHE_CHECK') && CACHE_CHECK === true)) {
|
if (isset($this->loaded['cache']) && (($this->cacheAction != false)) && (defined('CACHE_CHECK') && CACHE_CHECK === true)) {
|
||||||
if (is_a($this->loaded['cache'], 'CacheHelper')) {
|
if (is_a($this->loaded['cache'], 'CacheHelper')) {
|
||||||
$cache =& $this->loaded['cache'];
|
$cache =& $this->loaded['cache'];
|
||||||
|
|
||||||
|
@ -732,7 +732,8 @@ class View extends Object {
|
||||||
$cache->here = $this->here;
|
$cache->here = $this->here;
|
||||||
$cache->action = $this->action;
|
$cache->action = $this->action;
|
||||||
$cache->controllerName = $this->name;
|
$cache->controllerName = $this->name;
|
||||||
$cache->cacheAction = $this->controller->cacheAction;
|
$cache->layout = $this->layout;
|
||||||
|
$cache->cacheAction = $this->cacheAction;
|
||||||
$cache->cache($___viewFn, $out, $cached);
|
$cache->cache($___viewFn, $out, $cached);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -817,7 +818,7 @@ class View extends Object {
|
||||||
$this->render($action, $layout, $viewFileName);
|
$this->render($action, $layout, $viewFileName);
|
||||||
} else {
|
} else {
|
||||||
return $this->cakeError('missingView', array(array(
|
return $this->cakeError('missingView', array(array(
|
||||||
'className' => $this->controller->name,
|
'className' => $this->name,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'file' => $viewFileName,
|
'file' => $viewFileName,
|
||||||
'base' => $this->base
|
'base' => $this->base
|
||||||
|
|
Loading…
Add table
Reference in a new issue