From 16eaa990df971baca4664641dc8c6c92f9785d66 Mon Sep 17 00:00:00 2001 From: Robust Solution <hussein_elharake@yahoo.com> Date: Wed, 20 Jan 2010 22:18:55 +0000 Subject: [PATCH] optimization in AuthComponent class startup method Signed-off-by: Mark Story <mark@mark-story.com> --- cake/libs/controller/components/auth.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cake/libs/controller/components/auth.php b/cake/libs/controller/components/auth.php index abebeb0f5..574481a7a 100644 --- a/cake/libs/controller/components/auth.php +++ b/cake/libs/controller/components/auth.php @@ -262,10 +262,6 @@ class AuthComponent extends Object { * @access public */ function startup(&$controller) { - $methods = array_flip($controller->methods); - $action = strtolower($controller->params['action']); - $allowedActions = array_map('strtolower', $this->allowedActions); - $isErrorOrTests = ( strtolower($controller->name) == 'cakeerror' || (strtolower($controller->name) == 'tests' && Configure::read() > 0) @@ -274,6 +270,8 @@ class AuthComponent extends Object { return true; } + $methods = array_flip($controller->methods); + $action = strtolower($controller->params['action']); $isMissingAction = ( $controller->scaffold === false && !isset($methods[$action]) @@ -296,6 +294,7 @@ class AuthComponent extends Object { $url = Router::normalize($url); $loginAction = Router::normalize($this->loginAction); + $allowedActions = array_map('strtolower', $this->allowedActions); $isAllowed = ( $this->allowedActions == array('*') || in_array($action, $allowedActions)