public function uninstall() { // @todo Also delete media files? \DoctrineHelper::dropSchema($this->entityManager, static::getEntities()); \HookUtil::unregisterProviderBundles($this->version->getHookProviderBundles()); \HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); $this->delVars(); return true; }
/** * Delete the IWmessages module * @author Albert Pérez Monfort (aperezm@xtec.cat) * @author Jaume Fernàndez Valiente (jfern343@xtec.cat) * @return bool true if successful, false otherwise */ public function uninstall() { // Delete module table DBUtil::dropTable('IWmessages'); //Delete module vars $this->delVar('IWmessages', 'groupsCanUpdate') ->delVar('uploadFolder') ->delVar('multiMail') ->delVar('limitInBox') ->delVar('limitOutBox') ->delVar('dissableSuggest') ->delVar('smiliesActive'); //Deletion successfull HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); return true; }
/** * Delete the IWforums module * @author Albert Pérez Monfort (aperezm@xtec.cat) * @return bool true if successful, false otherwise */ public function uninstall() { // Delete module table DBUtil::dropTable('IWforums_definition'); DBUtil::dropTable('IWforums_temes'); DBUtil::dropTable('IWforums_msg'); //Delete module vars $this->delVar('urladjunts') ->delVar('avatarsVisible') ->delVar('restyledTheme') ->delVar('smiliesActive'); ; // unregister hook handlers HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); //success return true; }
/** * Delete ephemerides module * @author The Zikula Development Team * @return true if init successful, false otherwise */ public function uninstall() { DBUtil::dropTable('ephem'); // delete module variables ModUtil::delVar('Ephemerides'); // delete entries from category registry /*ModUtil::dbInfoLoad('Categories'); DBUtil::deleteWhere('categories_registry', "modname = 'Ephemerides'"); DBUtil::deleteWhere('categories_mapobj', "modname = 'Ephemerides'");*/ // Remove hooks HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); HookUtil::unregisterProviderBundles($this->version->getHookProviderBundles()); // deletion successful return true; }
/** * Delete module * * @return boolean true/false */ public function uninstall() { // Remove hooks HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); return true; }
/** * Delete the IWforms module * @author Albert Pérez Monfort (aperezm@xtec.cat) * @return bool true if successful, false otherwise */ public function Uninstall() { // Delete module table DBUtil::dropTable('IWforms_definition'); DBUtil::dropTable('IWforms_cat'); DBUtil::dropTable('IWforms'); DBUtil::dropTable('IWforms_note'); DBUtil::dropTable('IWforms_note_definition'); DBUtil::dropTable('IWforms_validator'); DBUtil::dropTable('IWforms_group'); //Delete module vars $this->delVar('characters') ->delVar('resumeview') ->delVar('newsColor') ->delVar('viewedColor') ->delVar('completedColor') ->delVar('validatedColor') ->delVar('fieldsColor') ->delVar('contentColor') ->delVar('attached') ->delVar('publicFolder'); HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); //Deletion successfull return true; }
/** * Desinstal·lació del mòdul Cataleg * * @return bool true si ha anat tot bé, false en qualsevol altre cas. */ public function uninstall() { if (!SecurityUtil::checkPermission('Cataleg::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } // Esborrar taules del mòdul if (!DBUtil::dropTable('cataleg')|| !DBUtil::dropTable('cataleg_eixos')|| !DBUtil::dropTable('cataleg_prioritats')|| !DBUtil::dropTable('cataleg_unitatsImplicades')|| !DBUtil::dropTable('cataleg_subprioritats')|| !DBUtil::dropTable('cataleg_activitats')|| !DBUtil::dropTable('cataleg_activitatsZona')|| !DBUtil::dropTable('cataleg_unitats')|| !DBUtil::dropTable('cataleg_responsables')|| !DBUtil::dropTable('cataleg_contactes')|| !DBUtil::dropTable('cataleg_auxiliar')|| !DBUtil::dropTable('cataleg_centresActivitat')|| !DBUtil::dropTable('cataleg_centres')|| !DBUtil::dropTable('cataleg_gestioActivitatDefaults')|| !DBUtil::dropTable('cataleg_importTaules')|| !DBUtil::dropTable('cataleg_importAssign')|| !DBUtil::dropTable('cataleg_gtafEntities')|| !DBUtil::dropTable('cataleg_gtafGroups') ) return false; //Esborrar variables del mòdul $this->delVars(); // unregister hook handlers HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); return true; }
/** * Uninstall Reviews. * * @return boolean True on success, false otherwise. */ public function uninstall() { // delete stored object workflows $result = Zikula_Workflow_Util::deleteWorkflowsForModule($this->getName()); if ($result === false) { return LogUtil::registerError($this->__f('An error was encountered while removing stored object workflows for the %s extension.', array($this->getName()))); } try { DoctrineHelper::dropSchema($this->entityManager, $this->listEntityClasses()); } catch (\Exception $e) { if (System::isDevelopmentMode()) { return LogUtil::registerError($this->__('Doctrine Exception: ') . $e->getMessage()); } return LogUtil::registerError($this->__f('An error was encountered while dropping tables for the %s extension.', array($this->name))); } // unregister persistent event handlers EventUtil::unregisterPersistentModuleHandlers($this->name); // unregister hook subscriber bundles HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); // remove all module vars $this->delVars(); // remove category registry entries ModUtil::dbInfoLoad('Categories'); DBUtil::deleteWhere('categories_registry', 'modname = \'' . $this->name . '\''); // remove all thumbnails $manager = $this->getServiceManager()->getService('systemplugin.imagine.manager'); $manager->setModule($this->name); $manager->cleanupModuleThumbs(); // remind user about upload folders not being deleted $uploadPath = FileUtil::getDataDirectory() . '/' . $this->name . '/'; LogUtil::registerStatus($this->__f('The upload directories at [%s] can be removed manually.', $uploadPath)); // uninstallation successful return true; }
/** * Delete the IWnoteboard module * @author Albert Pérez Monfort (aperezm@xtec.cat) * @return bool true if successful, false otherwise */ public function Uninstall() { // Delete module table DBUtil::dropTable('IWnoteboard'); DBUtil::dropTable('IWnoteboard_topics'); //Delete module vars $this->delVar('grups') ->delVar('permisos') ->delVar('marcat') ->delVar('verifica') ->delVar('caducitat') ->delVar('repperdefecte') ->delVar('colorrow1') ->delVar('colorrow2') ->delVar('colornewrow1') ->delVar('colornewrow2') ->delVar('attached') ->delVar('notRegisteredSeeRedactors') ->delVar('multiLanguage') ->delVar('topicsSystem') ->delVar('shipHeadersLines') ->delVar('notifyNewEntriesByMail') ->delVar('editPrintAfter') ->delVar('notifyNewCommentsByMail') ->delVar('commentCheckedByDefault') ->delVar('smallAvatar'); HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); //Deletion successfull return true; }
/** * Uninstall MUBoard. * * @return boolean True on success, false otherwise. */ public function uninstall() { // delete stored object workflows $result = Zikula_Workflow_Util::deleteWorkflowsForModule($this->getName()); if ($result === false) { return LogUtil::registerError($this->__f('An error was encountered while removing stored object workflows for the %s module.', array($this->getName()))); } try { DoctrineHelper::dropSchema($this->entityManager, $this->listEntityClasses()); } catch (Exception $e) { if (System::isDevelopmentMode()) { LogUtil::registerError($this->__('Doctrine Exception: ') . $e->getMessage()); } return LogUtil::registerError($this->__f('An error was encountered while dropping the tables for the %s module.', array($this->getName()))); } // unregister persistent event handlers EventUtil::unregisterPersistentModuleHandlers('MUBoard'); // unregister hook subscriber bundles HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); // remove all module vars $this->delVars(); // deletion successful return true; }
/** * Remove a module. * * @param array $args All parameters sent to this function. * numeric $args['id'] The id of the module. * boolean $args['removedependents'] Remove any modules dependent on this module (default: false). * boolean $args['interactive_remove'] Whether to operat in interactive mode or not. * * @return boolean True on success, false on failure. */ public function remove($args) { // Argument check if (!isset($args['id']) || !is_numeric($args['id'])) { return LogUtil::registerArgsError(); } if (!isset($args['removedependents']) || !is_bool($args['removedependents'])) { $removedependents = false; } else { $removedependents = true; } // Security check if (!SecurityUtil::checkPermission('Extensions::', '::', ACCESS_ADMIN)) { return LogUtil::registerPermissionError(); } // Get module information $modinfo = ModUtil::getInfo($args['id']); if (empty($modinfo)) { return LogUtil::registerError($this->__('Error! No such module ID exists.')); } switch ($modinfo['state']) { case ModUtil::STATE_NOTALLOWED: return LogUtil::registerError($this->__f('Error! No permission to upgrade %s.', $modinfo['name'])); break; } $osdir = DataUtil::formatForOS($modinfo['directory']); $modpath = $modinfo['type'] == ModUtil::TYPE_SYSTEM ? 'system' : 'modules'; $oomod = ModUtil::isOO($modinfo['name']); if ($oomod) { ZLoader::addAutoloader($osdir, "{$modpath}/{$osdir}/lib"); } $version = Extensions_Util::getVersionMeta($osdir, $modpath); $bootstrap = "{$modpath}/{$osdir}/bootstrap.php"; if (file_exists($bootstrap)) { include_once $bootstrap; } if ($modinfo['type'] == ModUtil::TYPE_MODULE) { if (is_dir("modules/{$osdir}/locale")) { ZLanguage::bindModuleDomain($modinfo['name']); } } // call any module delete hooks if (System::isLegacyMode() && !$oomod) { ModUtil::callHooks('module', 'remove', $modinfo['name'], array('module' => $modinfo['name'])); } // Get module database info ModUtil::dbInfoLoad($modinfo['name'], $osdir); // Module deletion function. Only execute if the module is initialised. if ($modinfo['state'] != ModUtil::STATE_UNINITIALISED) { if (!$oomod && file_exists($file = "{$modpath}/{$osdir}/pninit.php")) { if (!(include_once $file)) { LogUtil::registerError($this->__f("Error! Could not load a required file: '%s'.", $file)); } } if ($oomod) { $className = ucwords($modinfo['name']) . '_Installer'; $reflectionInstaller = new ReflectionClass($className); if (!$reflectionInstaller->isSubclassOf('Zikula_AbstractInstaller')) { LogUtil::registerError($this->__f("%s must be an instance of Zikula_AbstractInstaller", $className)); } $installer = $reflectionInstaller->newInstanceArgs(array($this->serviceManager)); $interactiveClass = ucwords($modinfo['name']) . '_Controller_Interactiveinstaller'; $interactiveController = null; if (class_exists($interactiveClass)) { $reflectionInteractive = new ReflectionClass($interactiveClass); if (!$reflectionInteractive->isSubclassOf('Zikula_Controller_AbstractInteractiveInstaller')) { LogUtil::registerError($this->__f("%s must be an instance of Zikula_Controller_AbstractInteractiveInstaller", $className)); } $interactiveController = $reflectionInteractive->newInstance($this->serviceManager); } } // perform the actual deletion of the module $func = $oomod ? array($installer, 'uninstall') : $modinfo['name'] . '_delete'; $interactive_func = $oomod ? array($interactiveController, 'uninstall') : $modinfo['name'] . '_init_interactivedelete'; // allow bypass of interactive removal during a new installation only. if (System::isInstalling() && is_callable($interactive_func) && !is_callable($func)) { return; // return void here } if (isset($args['interactive_remove']) && $args['interactive_remove'] == false && is_callable($interactive_func)) { if (is_array($interactive_func)) { // This must be an OO controller since callable is an array. // Because interactive installers extend the Zikula_AbstractController, is_callable will always return true because of the __call() // so we must check if the method actually exists by reflection - drak if ($reflectionInteractive->hasMethod('upgrade')) { SessionUtil::setVar('interactive_remove', true); return call_user_func($interactive_func); } } else { // tnis is enclosed in the else so that if both conditions fail, execution will pass onto the non-interactive execution below. SessionUtil::setVar('interactive_remove', true); return call_user_func($interactive_func); } } // non-interactive if (is_callable($func)) { if (call_user_func($func) != true) { return false; } } } // Remove variables and module // Delete any module variables that the module cleanup function might // have missed DBUtil::deleteObjectByID('module_vars', $modinfo['name'], 'modname'); // clean up any hooks activated for this module if (System::isLegacyMode()) { DBUtil::deleteObjectByID('hooks', $modinfo['name'], 'tmodule'); } if ($oomod) { HookUtil::unregisterProviderBundles($version->getHookProviderBundles()); HookUtil::unregisterSubscriberBundles($version->getHookSubscriberBundles()); EventUtil::unregisterPersistentModuleHandlers($modinfo['name']); } // remove the entry from the modules table if ($this->serviceManager['multisites.enabled'] == 1) { // who can access to the mainSite can delete the modules in any other site $canDelete = $this->serviceManager['multisites.mainsiteurl'] == FormUtil::getPassedValue('sitedns', null, 'GET') && $this->serviceManager['multisites.based_on_domains'] == 0 || $this->serviceManager['multisites.mainsiteurl'] == $_SERVER['HTTP_HOST'] && $this->serviceManager['multisites.based_on_domains'] == 1 ? 1 : 0; //delete the module infomation only if it is not allowed, missign or invalid if ($canDelete == 1 || $modinfo['state'] == ModUtil::STATE_NOTALLOWED || $modinfo['state'] == ModUtil::STATE_MISSING || $modinfo['state'] == ModUtil::STATE_INVALID) { // remove the entry from the modules table DBUtil::deleteObjectByID('modules', $args['id'], 'id'); } else { //set state as uninnitialised ModUtil::apiFunc('modules', 'admin', 'setstate', array('id' => $args['id'], 'state' => ModUtil::STATE_UNINITIALISED)); } } else { DBUtil::deleteObjectByID('modules', $args['id'], 'id'); } $event = new Zikula_Event('installer.module.uninstalled', null, $modinfo); $this->eventManager->notify($event); return true; }
public function uninstall() { // delete all database tables DBUtil::dropTable('content_page'); DBUtil::dropTable('content_content'); DBUtil::dropTable('content_pagecategory'); DBUtil::dropTable('content_searchable'); DBUtil::dropTable('content_translatedcontent'); DBUtil::dropTable('content_translatedpage'); DBUtil::dropTable('content_history'); // delete all module variables $this->delVars(); // delete entries from category registry ModUtil::dbInfoLoad('Categories'); DBUtil::deleteWhere('categories_registry', "modname='Content'"); DBUtil::deleteWhere('categories_mapobj', "modname='Content'"); // unregister event/hook handlers EventUtil::unregisterPersistentModuleHandlers('Content'); HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); // Deletion successful return true; }
/** * delete the EZComments module from an old version * * This function deletes the module to be used. It deletes tables, * registers hooks,... * * @return boolean true on success, false otherwise. */ public function uninstall() { if (!ModUtil::unregisterHook('item', 'display', 'GUI', 'EZComments', 'user', 'view')) { return LogUtil::registerError($this->__('Error deleting hook.')); } if (!ModUtil::unregisterHook('item', 'delete', 'API', 'EZComments', 'admin', 'deletebyitem')) { return LogUtil::registerError($this->__('Error deleting hook.')); } if (!ModUtil::unregisterHook('module', 'remove', 'API', 'EZComments', 'admin', 'deletemodule')) { return LogUtil::registerError($this->__('Error deleting hook.')); } // drop main table if (!DBUtil::dropTable('EZComments')) { return false; } // delete all module vars for the ezcomments module $this->delVars(); HookUtil::unregisterProviderBundles($this->version->getHookProviderBundles()); HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); EventUtil::unregisterPersistentModuleHandler('EZComments', 'installer.module.uninstalled', array('EZComments_EventHandlers', 'moduleDelete')); EventUtil::unregisterPersistentModuleHandler('EZComments', 'installer.subscriberarea.uninstalled', array('EZComments_EventHandlers', 'hookAreaDelete')); // Deletion successful return true; }
/** * delete the errors module * * This function is only ever called once during the lifetime of a particular * module instance * * @return boolean */ public function uninstall() { // drop table if (!DBUtil::dropTable('pages')) { return false; } // Delete any module variables $this->delVars(); // Delete entries from category registry ModUtil::dbInfoLoad('Categories'); DBUtil::deleteWhere('categories_registry', "modname = 'Pages'"); DBUtil::deleteWhere('categories_mapobj', "modname = 'Pages'"); HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); // Deletion successful return true; }
/** * Delete the module * @return true if init successful, false otherwise */ public function uninstall() { DBUtil::dropTable('addressbook_address'); DBUtil::dropTable('addressbook_labels'); DBUtil::dropTable('addressbook_customfields'); DBUtil::dropTable('addressbook_favourites'); // delete module variables ModUtil::delVar('AddressBook'); // Delete entries from category registry if (ModUtil::dbInfoLoad('Categories')) { DBUtil::deleteWhere('categories_registry', "modname='AddressBook'"); } // Remove hooks HookUtil::unregisterSubscriberBundles($this->version->getHookSubscriberBundles()); // deletion successful return true; }