add plugin Uninstaller features
This commit is contained in:
parent
b54e2df846
commit
782b60a505
1 changed files with 42 additions and 72 deletions
|
@ -14,89 +14,59 @@ declare(strict_types=1);
|
|||
|
||||
namespace Dotclear\Plugin\pacKman;
|
||||
|
||||
class Uninstall
|
||||
{
|
||||
protected static $init = false;
|
||||
use dcCore;
|
||||
use dcNsProcess;
|
||||
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
||||
|
||||
class Uninstall extends dcNsProcess
|
||||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
static::$init = defined('DC_RC_PATH');
|
||||
static::$init = defined('DC_CONTEXT_ADMIN');
|
||||
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process($uninstaller): ?bool
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!static::$init) {
|
||||
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$uninstaller->addUserAction(
|
||||
/* type */
|
||||
Uninstaller::instance()
|
||||
->addUserAction(
|
||||
'settings',
|
||||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
My::id(),
|
||||
/* desc */
|
||||
__('delete all settings')
|
||||
);
|
||||
|
||||
$uninstaller->addUserAction(
|
||||
/* type */
|
||||
My::id()
|
||||
)
|
||||
->addUserAction(
|
||||
'plugins',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
My::id(),
|
||||
/* desc */
|
||||
__('delete plugin files')
|
||||
);
|
||||
|
||||
$uninstaller->addUserAction(
|
||||
/* type */
|
||||
My::id()
|
||||
)
|
||||
->addUserAction(
|
||||
'versions',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
My::id(),
|
||||
/* desc */
|
||||
__('delete the version number')
|
||||
);
|
||||
|
||||
$uninstaller->addDirectAction(
|
||||
/* type */
|
||||
My::id()
|
||||
)
|
||||
->addDirectAction(
|
||||
'settings',
|
||||
/* action */
|
||||
'delete_all',
|
||||
/* ns */
|
||||
My::id(),
|
||||
/* desc */
|
||||
sprintf(__('delete all %s settings'), My::id())
|
||||
);
|
||||
|
||||
$uninstaller->addDirectAction(
|
||||
/* type */
|
||||
My::id()
|
||||
)
|
||||
->addDirectAction(
|
||||
'plugins',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
My::id(),
|
||||
/* desc */
|
||||
sprintf(__('delete %s plugin files'), My::id())
|
||||
);
|
||||
|
||||
$uninstaller->addDirectAction(
|
||||
/* type */
|
||||
My::id()
|
||||
)
|
||||
->addDirectAction(
|
||||
'versions',
|
||||
/* action */
|
||||
'delete',
|
||||
/* ns */
|
||||
My::id(),
|
||||
/* desc */
|
||||
sprintf(__('delete %s version number'), My::id())
|
||||
);
|
||||
My::id()
|
||||
)
|
||||
;
|
||||
|
||||
return true;
|
||||
// no custom action
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue