/** * 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; }
/** * Returns all (or only enabled) plugins that depends to a module * * @param bool $onlyEnabled * @return Zend_Db_Table_Rowset */ public function getAllPlugins($onlyEnabled = false) { $model = new RM_Plugins(); return $model->fetchByModuleName($this->name, $onlyEnabled); }