uninstallPlugin() public method

Uninstalls a Plugin (deletes plugin files from the disk) Only deactivated plugins can be uninstalled
public uninstallPlugin ( $pluginName ) : boolean
$pluginName
return boolean
示例#1
0
 public function uninstall($redirectAfter = true)
 {
     $pluginName = $this->initPluginModification(static::UNINSTALL_NONCE);
     $this->dieIfPluginsAdminIsDisabled();
     $uninstalled = $this->pluginManager->uninstallPlugin($pluginName);
     if (!$uninstalled) {
         $path = Filesystem::getPathToPiwikRoot() . '/plugins/' . $pluginName . '/';
         $messagePermissions = Filechecks::getErrorMessageMissingPermissions($path);
         $messageIntro = $this->translator->translate("Warning: \"%s\" could not be uninstalled. Piwik did not have enough permission to delete the files in {$path}. ", $pluginName);
         $exitMessage = $messageIntro . "<br/><br/>" . $messagePermissions;
         $exitMessage .= "<br> Or manually delete this directory (using FTP or SSH access)";
         $ex = new MissingFilePermissionException($exitMessage);
         $ex->setIsHtmlMessage();
         throw $ex;
     }
     $this->redirectAfterModification($redirectAfter);
 }