* @return boolean */ public function uninstall() { common_Logger::i('Uninstalling ' . $this->extension->getId(), ['UNINSTALL']); // uninstall possible if (is_null($this->extension->getManifest()->getUninstallData())) { throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Uninstall not supported'); } // installed? if (!common_ext_ExtensionsManager::singleton()->isInstalled($this->extension->getId())) { throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Not installed'); } // check dependcies if (helpers_ExtensionHelper::isRequired($this->extension)) { throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Still required'); }; common_Logger::d('uninstall script for ' . $this->extension->getId()); $this->uninstallScripts(); // hook $this->extendedUninstall(); common_Logger::d('unregister extension ' . $this->extension->getId()); $this->unregister(); // we purge the whole cache. $cache = $this->getServiceManager()->get(SimpleCache::SERVICE_ID); $cache->clear(); common_Logger::i('Uninstalled ' . $this->extension->getId()); return true; } /** * Unregisters the Extension from the extensionManager * * @access protected * @author Jerome Bogaerts, * @return void */ protected function unregister() { common_ext_ExtensionsManager::singleton()->unregisterExtension($this->extension); } /** * Executes uninstall scripts * specified in the Manifest * * @access protected * @author Jerome Bogaerts, * @return void */ protected function uninstallScripts() { $data = $this->extension->getManifest()->getUninstallData(); if (!is_null($data) && isset($data['php']) && is_array($data['php'])) { foreach ($data['php'] as $script) { $this->runExtensionScript($script); } } } /** * Hook to extend the uninstall procedure */ public function extendedUninstall() { return; } }