use plugin Uninstaller

This commit is contained in:
Jean-Christian Paul Denis 2023-04-22 14:19:54 +02:00
parent 11e998a513
commit 867845f8fa
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -14,67 +14,59 @@ declare(strict_types=1);
namespace Dotclear\Plugin\licenseBootstrap; namespace Dotclear\Plugin\licenseBootstrap;
class Uninstall use dcCore;
{ use dcNsProcess;
protected static $init = false; use Dotclear\Plugin\Uninstaller\Uninstaller;
class Uninstall extends dcNsProcess
{
public static function init(): bool public static function init(): bool
{ {
self::$init = defined('DC_RC_PATH'); static::$init = defined('DC_CONTEXT_ADMIN');
return self::$init; return static::$init;
} }
public static function process($uninstaller): ?bool 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()
My::id(), )
/* desc */ ->addUserAction(
__('delete all settings')
);
$uninstaller->addUserAction(
/* type */
'plugins', 'plugins',
/* action */
'delete', 'delete',
/* ns */ My::id()
My::id(), )
/* desc */ ->addUserAction(
__('delete plugin files') 'versions',
); 'delete',
My::id()
$uninstaller->addDirectAction( )
/* type */ ->addDirectAction(
'settings', 'settings',
/* action */
'delete_all', 'delete_all',
/* ns */ My::id()
My::id(), )
/* desc */ ->addDirectAction(
sprintf(__('delete all %s settings'), My::id())
);
$uninstaller->addDirectAction(
/* type */
'plugins', 'plugins',
/* action */
'delete', 'delete',
/* ns */ My::id()
My::id(), )
/* desc */ ->addDirectAction(
sprintf(__('delete %s plugin files'), My::id()) 'versions',
); 'delete',
My::id()
)
;
return true; // no custom action
return false;
} }
} }