diff --git a/_uninstall.php b/_uninstall.php index e825aa1..99a9c0c 100644 --- a/_uninstall.php +++ b/_uninstall.php @@ -13,6 +13,12 @@ declare(strict_types=1); $uninstall = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Uninstall']); + +// cope with disabled plugin +if (!class_exists($uninstall)) { + require implode(DIRECTORY_SEPARATOR, [__DIR__, 'inc', 'Uninstall.php']); +} + if ($uninstall::init()) { $uninstall::process($this); } diff --git a/inc/Uninstall.php b/inc/Uninstall.php index 49abd65..9ad4cca 100644 --- a/inc/Uninstall.php +++ b/inc/Uninstall.php @@ -16,10 +16,12 @@ namespace Dotclear\Plugin\improve; class Uninstall { - private static $init = false; + private static $pid = ''; + protected static $init = false; public static function init(): bool { + self::$pid = basename(dirname(__DIR__)); self::$init = defined('DC_RC_PATH'); return self::$init; @@ -37,7 +39,7 @@ class Uninstall /* action */ 'delete_all', /* ns */ - Core::id(), + self::$pid, /* desc */ __('delete all settings') ); @@ -48,7 +50,7 @@ class Uninstall /* action */ 'delete', /* ns */ - Core::id(), + self::$pid, /* desc */ __('delete plugin files') ); @@ -59,7 +61,7 @@ class Uninstall /* action */ 'delete', /* ns */ - Core::id(), + self::$pid, /* desc */ __('delete the version number') ); @@ -70,9 +72,9 @@ class Uninstall /* action */ 'delete_all', /* ns */ - Core::id(), + self::$pid, /* desc */ - sprintf(__('delete all %s settings'), Core::id()) + sprintf(__('delete all %s settings'), self::$pid) ); $uninstaller->addDirectAction( @@ -81,9 +83,9 @@ class Uninstall /* action */ 'delete', /* ns */ - Core::id(), + self::$pid, /* desc */ - sprintf(__('delete %s plugin files'), Core::id()) + sprintf(__('delete %s plugin files'), self::$pid) ); $uninstaller->addDirectAction( @@ -92,9 +94,9 @@ class Uninstall /* action */ 'delete', /* ns */ - Core::id(), + self::$pid, /* desc */ - sprintf(__('delete %s version number'), Core::id()) + sprintf(__('delete %s version number'), self::$pid) ); } }