示例#1
0
文件: Manager.php 项目: 962464/piwik
 /**
  * Uninstalls a Plugin (deletes plugin files from the disk)
  * Only deactivated plugins can be uninstalled
  *
  * @param $pluginName
  * @throws \Exception
  * @return bool
  */
 public function uninstallPlugin($pluginName)
 {
     if ($this->isPluginLoaded($pluginName)) {
         throw new \Exception("To uninstall the plugin {$pluginName}, first disable it in Piwik > Settings > Plugins");
     }
     $this->loadAllPluginsAndGetTheirInfo();
     \Piwik\Settings\Manager::cleanupPluginSettings($pluginName);
     $this->executePluginDeactivate($pluginName);
     $this->executePluginUninstall($pluginName);
     $this->removePluginFromPluginsInstalledConfig($pluginName);
     $this->unloadPluginFromMemory($pluginName);
     $this->removePluginFromConfig($pluginName);
     $this->removeInstalledVersionFromOptionTable($pluginName);
     $this->clearCache($pluginName);
     self::deletePluginFromFilesystem($pluginName);
     if ($this->isPluginInFilesystem($pluginName)) {
         return false;
     }
     return true;
 }
示例#2
0
 /**
  * Uninstalls a Plugin (deletes plugin files from the disk)
  * Only deactivated plugins can be uninstalled
  *
  * @param $pluginName
  * @throws \Exception
  * @return bool
  */
 public function uninstallPlugin($pluginName)
 {
     if ($this->isPluginLoaded($pluginName)) {
         throw new \Exception("To uninstall the plugin {$pluginName}, first disable it in Piwik > Settings > Plugins");
     }
     $this->returnLoadedPluginsInfo();
     try {
         $plugin = $this->getLoadedPlugin($pluginName);
         $plugin->uninstall();
     } catch (\Exception $e) {
     }
     Option::delete('version_' . $pluginName);
     $this->removePluginFromPluginsConfig($pluginName);
     $this->removePluginFromPluginsInstalledConfig($pluginName);
     $this->removePluginFromTrackerConfig($pluginName);
     PiwikConfig::getInstance()->forceSave();
     \Piwik\Settings\Manager::cleanupPluginSettings($pluginName);
     $this->clearCache($pluginName);
     self::deletePluginFromFilesystem($pluginName);
     if ($this->isPluginInFilesystem($pluginName)) {
         return false;
     }
     return true;
 }