add plugin Uninstaller features
parent
9ebccfd8ba
commit
914d31e2c9
|
@ -14,89 +14,59 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\improve;
|
namespace Dotclear\Plugin\improve;
|
||||||
|
|
||||||
class Uninstall
|
use dcCore;
|
||||||
{
|
use dcNsProcess;
|
||||||
private static $pid = '';
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||||
protected static $init = false;
|
|
||||||
|
|
||||||
|
class Uninstall extends dcNsProcess
|
||||||
|
{
|
||||||
public static function init(): bool
|
public static function init(): bool
|
||||||
{
|
{
|
||||||
self::$pid = basename(dirname(__DIR__));
|
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||||
self::$init = defined('DC_RC_PATH');
|
|
||||||
|
|
||||||
return self::$init;
|
return static::$init;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function process($uninstaller)
|
public static function process(): bool
|
||||||
{
|
{
|
||||||
if (!self::$init) {
|
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$uninstaller->addUserAction(
|
Uninstaller::instance()
|
||||||
/* type */
|
->addUserAction(
|
||||||
'settings',
|
'settings',
|
||||||
/* action */
|
|
||||||
'delete_all',
|
'delete_all',
|
||||||
/* ns */
|
My::id()
|
||||||
self::$pid,
|
)
|
||||||
/* desc */
|
->addUserAction(
|
||||||
__('delete all settings')
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addUserAction(
|
|
||||||
/* type */
|
|
||||||
'plugins',
|
'plugins',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
self::$pid,
|
)
|
||||||
/* desc */
|
->addUserAction(
|
||||||
__('delete plugin files')
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addUserAction(
|
|
||||||
/* type */
|
|
||||||
'versions',
|
'versions',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
self::$pid,
|
)
|
||||||
/* desc */
|
->addDirectAction(
|
||||||
__('delete the version number')
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
|
||||||
/* type */
|
|
||||||
'settings',
|
'settings',
|
||||||
/* action */
|
|
||||||
'delete_all',
|
'delete_all',
|
||||||
/* ns */
|
My::id()
|
||||||
self::$pid,
|
)
|
||||||
/* desc */
|
->addDirectAction(
|
||||||
sprintf(__('delete all %s settings'), self::$pid)
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
|
||||||
/* type */
|
|
||||||
'plugins',
|
'plugins',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
self::$pid,
|
)
|
||||||
/* desc */
|
->addDirectAction(
|
||||||
sprintf(__('delete %s plugin files'), self::$pid)
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
|
||||||
/* type */
|
|
||||||
'versions',
|
'versions',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
self::$pid,
|
)
|
||||||
/* desc */
|
;
|
||||||
sprintf(__('delete %s version number'), self::$pid)
|
|
||||||
);
|
// no custom action
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue