cope with disabled plugin, should fix #10
This commit is contained in:
parent
acde66de52
commit
555c9e2b06
2 changed files with 18 additions and 10 deletions
|
@ -13,6 +13,12 @@
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
$uninstall = implode('\\', ['Dotclear', 'Plugin', basename(__DIR__), 'Uninstall']);
|
$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()) {
|
if ($uninstall::init()) {
|
||||||
$uninstall::process($this);
|
$uninstall::process($this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,10 +16,12 @@ namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
class Uninstall
|
class Uninstall
|
||||||
{
|
{
|
||||||
private static $init = false;
|
private static $pid = '';
|
||||||
|
protected static $init = false;
|
||||||
|
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
|
self::$pid = basename(dirname(__DIR__));
|
||||||
self::$init = defined('DC_RC_PATH');
|
self::$init = defined('DC_RC_PATH');
|
||||||
|
|
||||||
return self::$init;
|
return self::$init;
|
||||||
|
@ -37,7 +39,7 @@ class Uninstall
|
||||||
/* action */
|
/* action */
|
||||||
'delete_all',
|
'delete_all',
|
||||||
/* ns */
|
/* ns */
|
||||||
Core::id(),
|
self::$pid,
|
||||||
/* desc */
|
/* desc */
|
||||||
__('delete all settings')
|
__('delete all settings')
|
||||||
);
|
);
|
||||||
|
@ -48,7 +50,7 @@ class Uninstall
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
Core::id(),
|
self::$pid,
|
||||||
/* desc */
|
/* desc */
|
||||||
__('delete plugin files')
|
__('delete plugin files')
|
||||||
);
|
);
|
||||||
|
@ -59,7 +61,7 @@ class Uninstall
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
Core::id(),
|
self::$pid,
|
||||||
/* desc */
|
/* desc */
|
||||||
__('delete the version number')
|
__('delete the version number')
|
||||||
);
|
);
|
||||||
|
@ -70,9 +72,9 @@ class Uninstall
|
||||||
/* action */
|
/* action */
|
||||||
'delete_all',
|
'delete_all',
|
||||||
/* ns */
|
/* ns */
|
||||||
Core::id(),
|
self::$pid,
|
||||||
/* desc */
|
/* desc */
|
||||||
sprintf(__('delete all %s settings'), Core::id())
|
sprintf(__('delete all %s settings'), self::$pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
$uninstaller->addDirectAction(
|
||||||
|
@ -81,9 +83,9 @@ class Uninstall
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
Core::id(),
|
self::$pid,
|
||||||
/* desc */
|
/* desc */
|
||||||
sprintf(__('delete %s plugin files'), Core::id())
|
sprintf(__('delete %s plugin files'), self::$pid)
|
||||||
);
|
);
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
$uninstaller->addDirectAction(
|
||||||
|
@ -92,9 +94,9 @@ class Uninstall
|
||||||
/* action */
|
/* action */
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
/* ns */
|
||||||
Core::id(),
|
self::$pid,
|
||||||
/* desc */
|
/* desc */
|
||||||
sprintf(__('delete %s version number'), Core::id())
|
sprintf(__('delete %s version number'), self::$pid)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue