コード例 #1
0
 /**
  * Disables the given plugin.
  *
  * @param string $pluginName Plugin's name
  * @return void Redirects to previous page
  */
 public function disable($pluginName)
 {
     $plugin = plugin($pluginName);
     $task = (bool) WebShellDispatcher::run("Installer.plugins toggle -p {$plugin->name} -s disable");
     if ($task) {
         $this->Flash->success(__d('system', 'Plugin was successfully disabled!'));
     } else {
         $this->Flash->set(__d('system', 'Plugin could not be disabled'), ['element' => 'System.installer_errors', 'params' => ['errors' => WebShellDispatcher::output()]]);
     }
     $this->title(__d('system', 'Disable Plugin'));
     header('Location:' . $this->referer());
     exit;
 }
コード例 #2
0
 /**
  * Marks as active the provided theme.
  *
  * @param string $themeName Theme's name
  * @return void
  */
 public function activate($themeName)
 {
     $theme = plugin($themeName);
     // throws
     if (!in_array($themeName, [option('front_theme'), option('back_theme')])) {
         $task = (bool) WebShellDispatcher::run("Installer.themes change -t {$theme->name}");
         if ($task) {
             $this->Flash->success(__d('system', 'Theme successfully activated!'));
         } else {
             $this->Flash->set(__d('system', 'Theme could not be activated'), ['element' => 'System.installer_errors', 'params' => ['errors' => WebShellDispatcher::output()]]);
         }
     } else {
         $this->Flash->danger(__d('system', 'This theme is already active.'));
     }
     $this->title(__d('system', 'Activate Theme'));
     $this->redirect($this->referer());
 }