move Uninstall features to plugin Uninstaller
This commit is contained in:
parent
3c5557b947
commit
c13f7656d2
1 changed files with 51 additions and 94 deletions
|
@ -14,110 +14,67 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Dotclear\Plugin\enhancePostContent;
|
namespace Dotclear\Plugin\enhancePostContent;
|
||||||
|
|
||||||
class Uninstall
|
use dcCore;
|
||||||
{
|
use dcNsProcess;
|
||||||
protected static bool $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_RC_PATH');
|
||||||
|
|
||||||
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(),
|
)
|
||||||
/* description */
|
->addUserAction(
|
||||||
__('delete all settings')
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addUserAction(
|
|
||||||
/* type */
|
|
||||||
'tables',
|
'tables',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::TABLE_NAME
|
||||||
My::TABLE_NAME,
|
)
|
||||||
/* desc */
|
->addUserAction(
|
||||||
__('delete table')
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addUserAction(
|
|
||||||
/* type */
|
|
||||||
'plugins',
|
'plugins',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
My::id(),
|
)
|
||||||
/* description */
|
->addUserAction(
|
||||||
__('delete plugin files')
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addUserAction(
|
|
||||||
/* type */
|
|
||||||
'versions',
|
'versions',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
My::id(),
|
)
|
||||||
/* description */
|
->addDirectAction(
|
||||||
__('delete the version number')
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
|
||||||
/* type */
|
|
||||||
'settings',
|
'settings',
|
||||||
/* action */
|
|
||||||
'delete_all',
|
'delete_all',
|
||||||
/* ns */
|
My::id()
|
||||||
My::id(),
|
)
|
||||||
/* description */
|
->addDirectAction(
|
||||||
sprintf(__('delete all %s settings'), My::id())
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
|
||||||
/* type */
|
|
||||||
'tables',
|
'tables',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::TABLE_NAME
|
||||||
My::TABLE_NAME,
|
)
|
||||||
/* desc */
|
->addDirectAction(
|
||||||
sprintf(__('delete %s table'), My::id())
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
|
||||||
/* type */
|
|
||||||
'plugins',
|
'plugins',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
My::id(),
|
)
|
||||||
/* description */
|
->addDirectAction(
|
||||||
sprintf(__('delete %s plugin files'), My::id())
|
|
||||||
);
|
|
||||||
|
|
||||||
$uninstaller->addDirectAction(
|
|
||||||
/* type */
|
|
||||||
'versions',
|
'versions',
|
||||||
/* action */
|
|
||||||
'delete',
|
'delete',
|
||||||
/* ns */
|
My::id()
|
||||||
My::id(),
|
)
|
||||||
/* description */
|
;
|
||||||
sprintf(__('delete %s version number'), My::id())
|
|
||||||
);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue