disableApplication() public method

Disable an application.
public disableApplication ( string $applicationName )
$applicationName string The name of the application to disable.
コード例 #1
0
 /**
  * Application management screen.
  *
  * @since 2.0.0
  * @access public
  * @param string $Filter 'enabled', 'disabled', or 'all' (default)
  * @param string $ApplicationName Unique ID of app to be modified.
  * @param string $TransientKey Security token.
  */
 public function applications($Filter = '', $ApplicationName = '', $TransientKey = '')
 {
     $this->permission('Garden.Settings.Manage');
     // Page setup
     $this->addJsFile('addons.js');
     $this->addJsFile('applications.js');
     $this->title(t('Applications'));
     $this->addSideMenu('dashboard/settings/applications');
     // Validate & set parameters
     $Session = Gdn::session();
     if ($ApplicationName && !$Session->validateTransientKey($TransientKey)) {
         $ApplicationName = '';
     }
     if (!in_array($Filter, array('enabled', 'disabled'))) {
         $Filter = 'all';
     }
     $this->Filter = $Filter;
     $ApplicationManager = new Gdn_ApplicationManager();
     $this->AvailableApplications = $ApplicationManager->availableVisibleApplications();
     $this->EnabledApplications = $ApplicationManager->enabledVisibleApplications();
     if ($ApplicationName != '') {
         $this->EventArguments['ApplicationName'] = $ApplicationName;
         if (array_key_exists($ApplicationName, $this->EnabledApplications) === true) {
             try {
                 $ApplicationManager->disableApplication($ApplicationName);
                 Gdn_LibraryMap::clearCache();
                 $this->fireEvent('AfterDisableApplication');
             } catch (Exception $e) {
                 $this->Form->addError(strip_tags($e->getMessage()));
             }
         } else {
             try {
                 $ApplicationManager->checkRequirements($ApplicationName);
             } catch (Exception $e) {
                 $this->Form->addError(strip_tags($e->getMessage()));
             }
             if ($this->Form->errorCount() == 0) {
                 $Validation = new Gdn_Validation();
                 $ApplicationManager->registerPermissions($ApplicationName, $Validation);
                 $ApplicationManager->enableApplication($ApplicationName, $Validation);
                 Gdn_LibraryMap::clearCache();
                 $this->Form->setValidationResults($Validation->results());
                 $this->EventArguments['Validation'] = $Validation;
                 $this->fireEvent('AfterEnableApplication');
             }
         }
         if ($this->Form->errorCount() == 0) {
             redirect('settings/applications/' . $this->Filter);
         }
     }
     $this->render();
 }