Minor optimization in cache views.

This commit is contained in:
Juan Basso 2010-12-18 19:41:57 -02:00
parent a7c7436d8e
commit 5d2b4c758d
2 changed files with 6 additions and 6 deletions

View file

@ -225,15 +225,15 @@ class CacheHelper extends AppHelper {
$file .= '$controller =& new ' . $this->controllerName . 'Controller();
$controller->plugin = $this->plugin = \''.$this->plugin.'\';
$controller->helpers = $this->helpers = unserialize(\'' . serialize($this->helpers) . '\');
$controller->helpers = $this->helpers = ' . var_export($this->helpers, true) . ';
$controller->base = $this->base = \'' . $this->base . '\';
$controller->layout = $this->layout = \'' . $this->layout. '\';
$controller->webroot = $this->webroot = \'' . $this->webroot . '\';
$controller->here = $this->here = \'' . $this->here . '\';
$controller->params = $this->params = unserialize(stripslashes(\'' . addslashes(serialize($this->params)) . '\'));
$controller->action = $this->action = unserialize(\'' . serialize($this->action) . '\');
$controller->data = $this->data = unserialize(stripslashes(\'' . addslashes(serialize($this->data)) . '\'));
$controller->viewVars = $this->viewVars = unserialize(stripslashes(\'' . addslashes(serialize($this->viewVars)) . '\'));
$controller->params = $this->params = ' . var_export($this->params, true) . ';
$controller->action = $this->action = ' . var_export($this->action, true) . ';
$controller->data = $this->data = ' . var_export($this->data, true) . ';
$controller->viewVars = $this->viewVars = ' . var_export($this->viewVars, true) . ';
$controller->theme = $this->theme = \'' . $this->theme . '\';
Router::setRequestInfo(array($this->params, array(\'base\' => $this->base, \'webroot\' => $this->webroot)));';

View file

@ -336,7 +336,7 @@ class CacheHelperTest extends CakeTestCase {
$this->assertTrue(file_exists($filename));
$contents = file_get_contents($filename);
$this->assertPattern('/\$this\-\>viewVars.*variable/', $contents);
$this->assertPattern('/\$this\-\>viewVars/', $contents);
$this->assertPattern('/extract\(\$this\-\>viewVars, EXTR_SKIP\);/', $contents);
$this->assertPattern('/php echo \$variable/', $contents);
$this->assertPattern('/variableValue/', $contents);