Allowing actions to be cached if before they was excluded from caching actions

@param Controller $controller
@param string $action
@return $this
196271
public function allowActions($controller, $action){
		$cid = $controller->id;

		// If NULL remove all excluded actions
		if(is_null($action)){
			$this->excluded_actions[$cid] = array();
			return $this;
		}

		$action = is_array($action) ? $action : array($action);

		if(!isset($this->excluded_actions[$cid])){
			$this->excluded_actions[$cid] = array();
		}

		$this->excluded_actions[$cid] = array_diff($this->excluded_actions[$cid], $action);

		return $this;
	}
1310024
public function getErrorListByName($controller, $action = null)
    {
        $position = $this->getPositionByName($controller, $action);
        if (is_integer($position)) {
            if (! isset($this->errors[$position])) $this->errors[$position] = new ErrorList();
            return $this->errors[$position];
        }
    }
61021
public static function is(string $controller, string $action): bool
    {
        return $controller == Application::route()->getControllerUrl() && $action == Application::route()->getActionUrl();
    }
1259180
public function accessPossible(User $user, $controller, $action) {
        $userRoles = $user->getRoles();
        try {
            $controllerAccess = CacheHelper::getControllerAccess($controller);
            $allowedRoles = isset($controllerAccess['actions'][$action])
                ? array_merge($controllerAccess['module'], $controllerAccess['actions'][$action])
                : $controllerAccess['module'];
            
            $accessAllowed = count(array_intersect($userRoles, $allowedRoles)) > 0;
        } catch (\ReflectionException $e) {
            \common_Logger::i('Unknown controller '.$controller);
            $accessAllowed = false;
        }
        
        return (bool) $accessAllowed;
    }
410621
protected function invokeControllerAction(AbstractController $controller, $action)
    {
        $this->invokePluginsHook(
            'beforeActionInvoked',
            array($this, $this->getRequest(), $controller, $action)
        );
        $response = $controller->$action($this->routeParams);
        if (null === $response) {
            // if the action returns null, we simply render the default view
            $response = array();
        } elseif (!is_string($response)) {
            // if they don't return a string, try to use whatever is returned
            // as variables to the view renderer
            $response = (array)$response;
        }

        // merge the response variables with the existing view context
        if (is_array($response)) {
            $response = array_merge($controller->getViewContext(), $response);
        }

        // whatever we have as a response needs to be encapsulated in an
        // AbstractResponse object
        if (!($response instanceof AbstractResponse)) {
            $response = new Response($response);
        }
        $this->invokePluginsHook(
            'afterActionInvoked',
            array($this, $this->getRequest(), $controller, $action, $response)
        );
        return $response;
    }
1126367
public function get(string $uri, string $controller, string $action)
    {
        $this->addRoute('GET', $uri, $controller, $action);
    }
516593
private static function execController($controller,$action,$args){
        $controller = new $controller();
        $controller->doAction($action,$args);
    }
78734
public function saveAction(string $controller)
    {
        $this->postAction($controller);
        $this->putAction($controller);
        $this->patchAction($controller);

        return $this;
    }
254813
public function action($action = null)
    {
        if ($action === null) {
            return $this->clause('action');
        }

        $this->_parts['action'] = $action;

        return $this;
    }
1094752
public function withAction(string $action): self
    {
        $this->action = AuditActionEnum::ensureValid($action);
        return $this;
    }
435731
public function loadFromCache($controller, $action){

		$this->saveInputParams(array('controller' => $controller, 'action' => $action));

		if(!$this->needCache()){
			return false;
		}

		$path = Yii::getAlias('@webroot') . $this->getFilePath();

		if(!file_exists($path)){
			return false;
		}

		$lastModified = filemtime($path);

		// File exists but it older than lifetime of cache
		if(time() - $lastModified > $this->lifeTime){
			return false;
		}

		$this->directReplace('CSRF_TOKEN', Yii::$app->request->getCsrfToken());

		$output = file_get_contents($path);

		$replaced = $this->makeReplace($output);


		echo $replaced;
		echo '<!--GENERATED WITH YII HTML CACHE-->';
		die;
	}
95120
protected function bindToController($request, $url, $controller)
    {
        $array  = explode('|', $url, 2);
        $action = !empty($array[0]) ? $array[0] : $this->router->config('default_action');
        $param  = [];

        if (!empty($array[1])) {
            $this->parseUrlParams($request, $array[1], $param);
        }

        return new ControllerDispatch($request, $this, $controller . '/' . $action, $param);
    }
961438
public function setAction(Controller $controller, $action = 'execute')
    {
        $this->controller = $controller;
        $this->action = $action;
    }
1066337
public function can($action, $controller)
    {
        return app(Gate::class)
            ->forUser($this)
            ->check('decoy.auth', [$action, $controller]);
    }
1247881
private function executeAction(string $action)
    {
        list($controller, $method) = explode('@', $action);

        $class = '\App\Controllers\\'.ucfirst($controller).'Controller';

        if (!class_exists($class)) {
            throw new ExceptionHandler('Class "'.$class.'" not found.');
        }

        $controllerInstantiate = new $class();

        if (!method_exists($controllerInstantiate, $method)) {
            throw new ExceptionHandler('Method "'.$method.'" not found in '.$class.'.');
        }

        return call_user_func_array([new $controllerInstantiate, $method], []);
    }
499677
protected function callController($controller, $action, $route)
    {
        $controllers = $this->setting->getAsArray('auth.controller');
        $exclude = ($this->setting['auth.mode'] == 'exclude');
        $level = $this->setting->get('auth.level', 0);
        $inner = in_array($controller, $controllers);
        if ($exclude xor $inner) {
            if (!\Staq::Ctrl('Auth')->isLogged()) {
                throw new \Stack\Exception\MustBeLogged();
            }
            $user = \Staq::Ctrl('Auth')->currentUser();
            if ($user->hasAttribute('right')){
                if ($user->getAttribute('right')->getSeed() < $level) {
                    throw new \Stack\Exception\NotAllowed();
                }
            }
        }
        $result = parent::callController($controller, $action, $route);
        return $result;
    }
1213806
static function load($controller, $action = '', $params = array())
	{

		$class_name = ucfirst($controller);
		$method = $action;
		$tc = "Controller\\" . $class_name;
		if (!class_exists($tc)) return self::er("Class $tc does not exist.");
		$this_object = new $tc($params);


		if (!method_exists($this_object, $method)) {
			return self::er("Method $method in $tc does not exist.");
		}


		if (!is_callable(array($this_object, $method))) return self::er("Method $method in $tc is not callable.");
		if (is_callable(array($this_object, "__before"))) {
			call_user_func(array($this_object, "__before"));
		}


		call_user_func(array($this_object, $method));

		if (is_callable(array($this_object, "__after"))) {
			call_user_func(array($this_object, "__after"));
		}
		return $this_object;
	}