Exemple #1
0
 /**
  * 主题安装
  *
  * @param $f3
  */
 public function InstallTheme($f3)
 {
     // 权限检查
     $this->requirePrivilege('manage_plugin_theme_installtheme');
     // 参数验证
     $validator = new Validator($f3->get('GET'));
     $themeDirName = $validator->required()->validate('themeDirName');
     if (!$this->validate($validator)) {
         goto out;
     }
     $themeInstance = ThemeHelper::loadPluginInstance($themeDirName);
     if (!$themeInstance) {
         $this->addFlashMessage('主题[' . $themeDirName . ']无效');
         goto out;
     }
     // 调用主题操作
     $ret = $themeInstance->pluginInstall(PluginHelper::SYSTEM_ALL);
     if (true !== $ret) {
         $this->addFlashMessage('主题[' . $themeDirName . ']安装失败:' . $ret);
         goto out;
     }
     ThemeHelper::addInstallTheme($themeDirName);
     $this->addFlashMessage('主题安装成功,下一步请“启用”主题让它开始工作');
     out:
     RouteHelper::reRoute($this, RouteHelper::getRefer(), false);
 }