Backend\Modules\Extensions\Actions\InstallTheme::execute PHP Method

execute() public method

Execute the action.
public execute ( )
    public function execute()
    {
        // get parameters
        $this->currentTheme = $this->getParameter('theme', 'string');
        // does the item exist
        if ($this->currentTheme !== null && BackendExtensionsModel::existsTheme($this->currentTheme)) {
            // call parent, this will probably add some general CSS/JS or other required files
            parent::execute();
            // make sure this theme can be installed
            $this->validateInstall();
            try {
                // do the actual install
                BackendExtensionsModel::installTheme($this->currentTheme);
                // redirect to index with a success message
                $this->redirect(BackendModel::createURLForAction('Themes') . '&report=theme-installed&var=' . $this->currentTheme);
            } catch (Exception $e) {
                // redirect to index with a success message
                $this->redirect(BackendModel::createURLForAction('Themes') . '&report=information-file-is-empty&var=' . $this->currentTheme);
            }
        } else {
            // no item found, redirect to index, because somebody is fucking with our url
            $this->redirect(BackendModel::createURLForAction('Themes') . '&error=non-existing');
        }
    }