Piwik\Plugins\Marketplace\Controller::createUpdateOrInstallView PHP Method

createUpdateOrInstallView() private method

private createUpdateOrInstallView ( $template, $nonceName )
    private function createUpdateOrInstallView($template, $nonceName)
    {
        Piwik::checkUserHasSuperUserAccess();
        $this->dieIfPluginsAdminIsDisabled();
        $this->displayWarningIfConfigFileNotWritable();
        $pluginName = $this->getPluginNameIfNonceValid($nonceName);
        $view = new View('@Marketplace/' . $template);
        $this->setBasicVariablesView($view);
        $view->errorMessage = '';
        $view->plugin = array('name' => $pluginName);
        try {
            $this->pluginInstaller->installOrUpdatePluginFromMarketplace($pluginName);
        } catch (\Exception $e) {
            $notification = new Notification($e->getMessage());
            $notification->context = Notification::CONTEXT_ERROR;
            $notification->type = Notification::TYPE_PERSISTENT;
            $notification->flags = Notification::FLAG_CLEAR;
            Notification\Manager::notify('CorePluginsAdmin_InstallPlugin', $notification);
            Url::redirectToReferrer();
            return;
        }
        $view->plugin = $this->plugins->getPluginInfo($pluginName);
        return $view;
    }