function disableJsonAction() { $extensions = RM_Environment::getInstance()->getOutOfDateExtensions(); $pluginManager = new RM_Plugin_Manager($this->_translate); $pluginModel = new RM_Plugins(); foreach ($extensions['plugins'] as $pluginName) { $plugin = $pluginModel->fetchByName($pluginName); try { $pluginManager->disable($plugin); } catch (Exception $e) { //TODO: add message to log that we could not disable this plugin continue; } } $moduleManager = new RM_Module_Manager($this->_translate); $moduleModel = new RM_Modules(); foreach ($extensions['modules'] as $moduleName) { $module = $moduleModel->fetchByName($moduleName); try { $moduleManager->disable($module); } catch (Exception $e) { //TODO: add message to log that we could not disable this module continue; } } return array('data' => array('success' => true)); }
/** * Uninstall module * * @param RM_Module_Row $module * @throws RM_Exception is some error occures */ function uninstall($module) { //1. get module path $moduleFolderPath = self::getModuleFolderpath($module->name); //3. invoke uninstall from module main class $className = self::_getClassname($module->name); $moduleObject = new $className(); $moduleObject->uninstall(); //5. invoke SQL uninstall file self::uninstallDatabase($moduleFolderPath); //6. remove userdata module directories $result = RM_Filesystem::deleteFolder($moduleFolderPath); $result = RM_Filesystem::deleteFolder(self::getModuleUserFolderpath($module->name)); //7. disable all modules that are connected to this module if this is possible $pluginsManager = new RM_Plugin_Manager(RM_Environment::getInstance()->getTranslation()); $pluginsModel = new RM_Plugins(); $plugins = $pluginsModel->fetchByModuleName($module->name, true); foreach ($plugins as $plugin) { try { $pluginsManager->disable($plugin); } catch (Exception $e) { //TODO: add some log message that we could not disable this plugin continue; } } //8. remove module row from database $module->delete(); return true; }
public function disableJsonAction() { $json = new stdClass(); $json->success = 1; $json->msg = array(); $ids = $this->_getParam('ids', array()); $manager = new RM_Plugin_Manager($this->_translate); $model = new RM_Plugins(); foreach ($ids as $id) { $row = $model->find($id)->current(); try { $manager->disable($row); } catch (Exception $e) { $json->success = 0; $json->msg[] = $e->getMessage(); } } return array('data' => $json); }