/**
  * Disables a module.
  *
  * @param $slug
  *
  * @return \Illuminate\Http\Response
  */
 public function disable($slug)
 {
     Audit::log(Auth::user()->id, trans('admin/modules/general.audit-log.category'), trans('admin/modules/general.audit-log.msg-disable', ['slug' => $slug]));
     $module = \Module::where('slug', $slug)->first();
     if ($module) {
         if (\Module::isInitialized($slug)) {
             if (\Module::isEnabled($slug)) {
                 \Module::disable($slug);
                 Flash::success(trans('admin/modules/general.status.disabled', ['name' => $module['name']]));
             } else {
                 Flash::warning(trans('admin/modules/general.status.not-enabled', ['name' => $module['name']]));
             }
         } else {
             Flash::warning(trans('admin/modules/general.status.not-initialized', ['name' => $module['name']]));
         }
     } else {
         Flash::error(trans('admin/modules/general.status.not-found', ['slug' => $slug]));
     }
     Flash::success(trans('admin/modules/general.status.disabled'));
     return redirect('/admin/modules');
 }
Esempio n. 2
0
 /**
  * Enables or Disables selected modules, cheat way to combine the
  * two very similar methods, saves code.
  *
  * @param string $name
  * @param array $args
  * @return mixed
  */
 public function __call($name, $args)
 {
     switch (substr($name, 0, -7)) {
         case 'enmod':
             $op = 'enable';
             break;
         case 'dismod':
             $op = 'disable';
             break;
         default:
             throw new Module_ControllerNoExist();
     }
     $this->setOutputType(self::_OT_CONFIG);
     if (!$this->_acl->check('module_manager_' . $op . '_modules')) {
         throw new Module_NoPermission();
     } else {
         if (!$this->_input->checkToken()) {
             $this->_event->error(Input::csrfMsg());
         } else {
             // Get all modules that need to be enabled/disabled
             try {
                 $modules = $this->_input->post('modules');
                 $count = 0;
                 foreach ($modules as $module) {
                     try {
                         $tmpModule = new Module($module);
                         // Check if user has global permission to do so
                         $aclResource = $module . '_global';
                         if (!$this->_acl->resourceExists($aclResource) || !$this->_acl->check($aclResource)) {
                             throw new Module_NoPermission();
                         }
                         if ($op == 'enable') {
                             $tmpModule->enable();
                             ++$count;
                         } else {
                             if (in_array($tmpModule->name, array($this->getDetail('name'), 'session'))) {
                                 // User is trying to disabled this module, that can't really happen
                                 $this->_event->error(sprintf(t('Sorry, you can not disable the module "%1$s"'), $tmpModule->name));
                             } else {
                                 $tmpModule->disable();
                                 ++$count;
                             }
                         }
                     } catch (Module_NoExist $e) {
                     }
                 }
                 if ($count > 0) {
                     if ($op == 'enable') {
                         $msg = count($modules) > 1 ? t('Enabled selected modules') : sprintf(t('Enabled module "%1$s"'), $tmpModule->name);
                     } else {
                         $msg = count($modules) > 1 ? t('Disabled selected modules') : sprintf(t('Disabled module "%1$s"'), $tmpModule->name);
                     }
                     $this->_event->success($msg);
                 }
             } catch (Input_KeyNoExist $e) {
                 $this->_event->error(t('No modules selected'));
             }
         }
     }
     return zula_redirect($this->_router->makeUrl('module_manager', 'config'));
 }
Esempio n. 3
0
 public function disable()
 {
     parent::disable();
     Configuration::updateValue('VATNUMBER_MANAGEMENT', 0);
 }
 /**
  * @brief Disable the module
  *
  * When disabling the module, we need to edit the settings to also disable the theme swtich.
  * When enabling it, the settings will be rewritten automatically with the performances system.
  *
  */
 public function disable()
 {
     Configuration::updateValue('PS_MOBILE_MODULE_ENABLED', 0);
     $this->editSettings(false);
     return parent::disable();
 }
 public function disable($force_all = false)
 {
     $is_adv_api_disabled = (bool) Configuration::updateValue('PS_ADVANCED_PAYMENT_API', false);
     $is_adv_api_disabled &= (bool) Configuration::updateValue('PS_ATCP_SHIPWRAP', false);
     return parent::disable() && $is_adv_api_disabled;
 }
 public function disable($forceAll = false)
 {
     parent::disable($forceAll);
 }
Esempio n. 7
0
 public function disable($force_all = false)
 {
     parent::disable($force_all);
     $this->logMessage('Module has been disabled', 'INFO');
 }
Esempio n. 8
0
 public function disable($forceAll = false)
 {
     if (version_compare(_PS_VERSION_, '1.5.5.0', '>=')) {
         $this->_clearCache('*');
     }
     return parent::disable($forceAll);
 }