Load from cache

@param Controller $controller
@param InlineAction $action
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;
	}
206020
public function getResourceName($controller, $action = null)
    {
        if (isset($action)) {
            return sprintf('controller/%s:%s', $controller, strtolower($action));
        }

        return sprintf('controller/%s', $controller);
    }
329462
private static function setCachedActionRow($idAction, $actionType, $actionRow)
    {
        $cacheLabel = self::getCachedActionRowKey($idAction, $actionType);
        self::$cacheParsedAction[$cacheLabel] = $actionRow;
    }
719701
public function all(string $uri, string $controller, string $action)
    {
        $this->addRoute('ALL', $uri, $controller, $action);
    }
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);
    }
892373
public function setMvcUrl($controller = null, $action = null, array $params = [])
    {
        $this->mvcUrl = [
            'controller' => trim($controller),
            'action'     => trim($action),
            'params'     => $params
        ];
        return $this;
    }
1007817
public static function get_previous_cron($controller,$action){
        return self::find()->where(['controller'=>$controller,'action'=>$action, 'success' => 1])->orderBy('id_cron_job DESC')->one();
    }
575001
public function performAction($controller, $action) {
		// Replace namespace with directory separator
		$controllerFile = str_replace("\\", DIRECTORY_SEPARATOR, $controller);

		// Check if controller exists
		if ( false == is_file( $controllerLocation = APP . 'Controllers/' . $controllerFile . '.php' ) )
			throw new ControllerNotFoundException();

		// Include and init the controller
		$controllerClass = "\\Application\\Controllers\\{$controller}";
		$controllerObj = new $controllerClass($this);

		// Check if the action exists
		if ( 'Errors' != $controller && false == method_exists($controllerObj, $action.= "Action" ) )
			throw new ActionNotFoundException();
		// Check if the error display action exists
		elseif ( $controller == $this->defaultRoute['_controller'] && false == method_exists($controllerObj, $action = "display" . $action ) )
			throw new ErrorActionNotFoundException();

		// Run the action
		$data = $controllerObj->{$action}();

		// Data fetching
		if ( false === $controllerObj->__returnActionPerformed ):
			// Format returned data
			if ( false == is_array( $data ) )
				$data = (array) $data;

			// Start reflection for data loading
			$ref = new \ReflectionObject($controllerObj);
			$properties = $ref->getProperties(\ReflectionProperty::IS_PUBLIC);
			$controllerData = array();

			// Get public data
			foreach ( $properties as $property ):
				// Don't add internal variabels
				if ( '__returnActionPerformed' == $property->getName() )
					continue;

				// Add property to controller data
				$controllerData[$property->getName()] = $property->getValue($controllerObj);
			endforeach;

			// Merge data from controller and action
			$data = array_merge($controllerData, $data);
		endif;

		// Return the object
		return $data;
	}
961438
public function setAction(Controller $controller, $action = 'execute')
    {
        $this->controller = $controller;
        $this->action = $action;
    }
115290
public function initialize(Controller $controller) {

		parent::initialize($controller);

		$loginUrl = array(
                'plugin' => 'users',
                'controller' => 'users',
                'action' => 'login', 
                'admin' => false, 
                );
        if ( !empty( $controller->request->params['tenant'] ) ) {
            $loginUrl['action'] = 'tenant_login';
        }
        $this->loginAction = $loginUrl;
        $this->logoutRedirect = $loginUrl;
	}
508856
function(controller, callback) {
            self.prepareControllerActions(controller, function(err, actions) {
                callback(err, controller, actions);
            });
        }
1058073
protected function setAddRoute($controller, $action): Controller
    {
        $callTo = Inflector::classify($controller) . '@' . $action;

        $this->routes['get'] = array_merge($this->routes['get'], [
            "/$controller/$action/" => $callTo,
        ]);

        $this->routes['post'] = [
            "/$controller/$action/" => $callTo,
        ];

        return $this;
    }
1212331
public function run(&$actionData)
    {
        foreach ($actionData->entities as $className => $ids) {
            if (class_exists($className)) {
                $ids = (array) $ids;
                $models = [];
                $mapping = ArrayHelper::getValue($this->entitiesMapping, $className, $className);

                $modelLoadSettings = ArrayHelper::merge(
                    [
                        'useCache' => true,
                        'cacheLifetime' => 86400,
                        'throwException' => false,
                        'useIdentityMap' => true,
                    ],
                    ArrayHelper::getValue($this->entitiesLoadSettings, $className, [])
                );

                foreach ($ids as $id) {
                    /** @var TagDependencyTrait $className */
                    $models[$id] = $className::loadModel(
                        $id,
                        false,
                        $modelLoadSettings['useCache'],
                        $modelLoadSettings['cacheLifetime'],
                        $modelLoadSettings['throwException'],
                        $modelLoadSettings['useIdentityMap']
                    );
                }
                if ($this->convertOneModelToArray === false && count($models) === 1) {
                    $models = reset($models);
                }
                if ($this->nullOnEmptyArray === true && count($models) === 0) {
                    $models = null;
                }
                /** @var string $className */
                // replace with models
                switch ($this->fill) {
                    case static::FILL_ENTITIES_ADD:
                        $actionData->entities[$mapping] = $models;
                        break;
                    case static::FILL_ENTITIES_REPLACE:
                        unset($actionData->entities[$className]);
                        $actionData->entities[$mapping] = $models;
                        break;
                    case static::FILL_RESULT:
                    default:
                        $actionData->result[$mapping] = $models;
                        break;
                }
            }
        }
    }
1036808
public function execute(Action $controller, $feedback = true) {

		try {

			$action = $this->parseActionName();

			elgg_make_sticky_form($action);

			$controller->setup();
			if ($controller->validate() === false) {
				throw new ActionValidationException("Invalid input for action $action");
			}
			$controller->execute();
			$this->result = $controller->getResult();
		} catch (ActionValidationException $ex) {
			$this->result->addError($ex->getMessage());
			elgg_log($ex->getMessage(), 'ERROR');
		} catch (PermissionsException $ex) {
			$this->result->addError(elgg_echo('apps:permissions:error'));
			elgg_log($ex->getMessage(), 'ERROR');
		} catch (InvalidEntityException $ex) {
			$this->result->addError(elgg_echo('apps:entity:error'));
			elgg_log($ex->getMessage(), 'ERROR');
		} catch (Exception $ex) {
			$this->result->addError(elgg_echo('apps:action:error'));
			elgg_log($ex->getMessage(), 'ERROR');
		}

		$errors = $this->result->getErrors();
		$messages = $this->result->getMessages();
		if (empty($errors)) {
			elgg_clear_sticky_form($action);
		} else {
			$this->result->setForwardURL(REFERRER);
		}

		if ($feedback) {
			foreach ($errors as $error) {
				register_error($error);
			}
			foreach ($messages as $message) {
				system_message($message);
			}
		}

		return elgg_trigger_plugin_hook('action:after', $action, null, $this->result);
	}
1351987
protected function setIndexRoute($controller, $action): Controller
    {
        $this->routes['get'] = [
            "/$controller/" => Inflector::classify($controller) . '@' . $action,
            "/$controller/$action/{:id}" => Inflector::classify($controller) . '@' . $action,
            "/$controller/$action/" => Inflector::classify($controller) . '@' . $action,
        ];

        return $this;
    }
7297
private function _routeCron($src, $controller, $action) {
        $this->request->name = '-' . $src . '_' . $controller . '_' . $action;
        $this->request->src = $src;
        $this->request->controller = $controller;
        $this->request->action = $action;
        $this->request->auth = new Auth($this->request->src);
        $this->_route = true;
    }
83834
public function hasResourceParams($controller, $action = null)
    {
        $this->buildAcl();
        $resource = $this->buildResource($controller, $action);
        return parent::hasResource($resource);
    }