diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php index c76b92917..f860580b1 100644 --- a/cake/libs/view/helpers/cache.php +++ b/cake/libs/view/helpers/cache.php @@ -191,7 +191,6 @@ class CacheHelper extends AppHelper { */ function __writeFile($file, $timestamp) { $now = time(); - $view =& ClassRegistry::getObject('_view_'); if (is_numeric($timestamp)) { $cacheTime = $now + $timestamp; @@ -201,21 +200,21 @@ class CacheHelper extends AppHelper { $cache = convertSlash($this->here) . '.php'; $file = 'name . '\'); + loadController(\'' . $this->controllerName . '\'); loadModels(); - $this->controller = new ' . $view->name . 'Controller(); - $this->helpers = unserialize(\'' . serialize($view->helpers) . '\'); - $this->base = \'' . $view->base . '\'; - $this->layout = \'' . $view->layout. '\'; - $this->webroot = \'' . $view->webroot . '\'; - $this->here = \'' . $view->here . '\'; - $this->namedArgs = \'' . $view->namedArgs . '\'; - $this->argSeparator = \'' . $view->argSeparator . '\'; - $this->params = unserialize(\'' . serialize($view->params) . '\'); - $this->action = unserialize(\'' . serialize($view->action) . '\'); - $this->data = unserialize(\'' . serialize($view->data) . '\'); - $this->themeWeb = \'' . $view->themeWeb . '\'; - $this->plugin = \'' . $view->plugin . '\'; + $this->controller = new ' . $this->controllerName . 'Controller(); + $this->helpers = unserialize(\'' . serialize($this->helpers) . '\'); + $this->base = \'' . $this->base . '\'; + $this->layout = \'' . $this->layout. '\'; + $this->webroot = \'' . $this->webroot . '\'; + $this->here = \'' . $this->here . '\'; + $this->namedArgs = \'' . $this->namedArgs . '\'; + $this->argSeparator = \'' . $this->argSeparator . '\'; + $this->params = unserialize(\'' . serialize($this->params) . '\'); + $this->action = unserialize(\'' . serialize($this->action) . '\'); + $this->data = unserialize(\'' . serialize($this->data) . '\'); + $this->themeWeb = \'' . $this->themeWeb . '\'; + $this->plugin = \'' . $this->plugin . '\'; $loadedHelpers = array(); $loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers); foreach(array_keys($loadedHelpers) as $helper) diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 71a12aa62..24bf462d0 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -30,7 +30,7 @@ /** * Included libraries. */ -uses ('view' . DS . 'helper'); +uses ('view' . DS . 'helper', 'class_registry'); /** * View, the V in the MVC triad. @@ -253,7 +253,7 @@ class View extends Object { * @var array * @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 * @@ -330,7 +330,7 @@ class View extends Object { } 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, 'file' => $viewFileName, 'base' => $this->base @@ -365,7 +365,7 @@ class View extends Object { if ($out !== false) { if ($this->layout && $this->autoLayout) { $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('', ''); $out = str_replace($replace, '', $out); } @@ -720,7 +720,7 @@ class View extends Object { $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')) { $cache =& $this->loaded['cache']; @@ -732,7 +732,8 @@ class View extends Object { $cache->here = $this->here; $cache->action = $this->action; $cache->controllerName = $this->name; - $cache->cacheAction = $this->controller->cacheAction; + $cache->layout = $this->layout; + $cache->cacheAction = $this->cacheAction; $cache->cache($___viewFn, $out, $cached); } } @@ -817,7 +818,7 @@ class View extends Object { $this->render($action, $layout, $viewFileName); } else { return $this->cakeError('missingView', array(array( - 'className' => $this->controller->name, + 'className' => $this->name, 'action' => $action, 'file' => $viewFileName, 'base' => $this->base