Backend\Modules\Extensions\Actions\InstallModule::execute PHP Метод

execute() публичный Метод

Execute the action.
public execute ( )
    public function execute()
    {
        // get parameters
        $this->currentModule = $this->getParameter('module', 'string');
        // does the item exist
        if ($this->currentModule !== null && BackendExtensionsModel::existsModule($this->currentModule)) {
            // call parent, this will probably add some general CSS/JS or other required files
            parent::execute();
            // make sure this module can be installed
            $this->validateInstall();
            // do the actual install
            BackendExtensionsModel::installModule($this->currentModule);
            // remove our container cache after this request
            $filesystem = new Filesystem();
            $filesystem->remove($this->getContainer()->getParameter('kernel.cache_dir'));
            // redirect to index with a success message
            $this->redirect(BackendModel::createURLForAction('Modules') . '&report=module-installed&var=' . $this->currentModule . '&highlight=row-module_' . $this->currentModule);
        } else {
            // no item found, redirect to index, because somebody is fucking with our url
            $this->redirect(BackendModel::createURLForAction('Modules') . '&error=non-existing');
        }
    }