2021-09-08 22:53:13 +00:00
|
|
|
<?php
|
2021-09-08 23:02:10 +00:00
|
|
|
/**
|
2021-09-08 23:05:05 +00:00
|
|
|
* @brief noodles, a plugin for Dotclear 2
|
2022-11-17 20:00:42 +00:00
|
|
|
*
|
2021-09-08 23:02:10 +00:00
|
|
|
* @package Dotclear
|
2021-09-08 23:05:05 +00:00
|
|
|
* @subpackage Plugin
|
2022-11-17 20:00:42 +00:00
|
|
|
*
|
2021-09-08 23:05:05 +00:00
|
|
|
* @author Jean-Christian Denis and contributors
|
2022-11-17 20:00:42 +00:00
|
|
|
*
|
2021-09-08 23:02:10 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2023-05-04 20:51:48 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\noodles;
|
|
|
|
|
|
|
|
use dcCore;
|
|
|
|
use dcNsProcess;
|
|
|
|
use Dotclear\Plugin\Uninstaller\Uninstaller;
|
2021-09-08 22:53:13 +00:00
|
|
|
|
2023-05-04 20:51:48 +00:00
|
|
|
class Uninstall extends dcNsProcess
|
|
|
|
{
|
|
|
|
public static function init(): bool
|
|
|
|
{
|
|
|
|
static::$init = defined('DC_CONTEXT_ADMIN');
|
2021-09-08 22:53:13 +00:00
|
|
|
|
2023-05-04 20:51:48 +00:00
|
|
|
return static::$init;
|
|
|
|
}
|
2021-09-08 22:53:13 +00:00
|
|
|
|
2023-05-04 20:51:48 +00:00
|
|
|
public static function process(): bool
|
|
|
|
{
|
|
|
|
if (!static::$init || !dcCore::app()->plugins->moduleExists('Uninstaller')) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-09-08 22:53:13 +00:00
|
|
|
|
2023-05-04 20:51:48 +00:00
|
|
|
Uninstaller::instance()
|
|
|
|
->addUserAction(
|
|
|
|
'settings',
|
|
|
|
'delete_all',
|
|
|
|
My::id()
|
|
|
|
)
|
|
|
|
->addUserAction(
|
|
|
|
'plugins',
|
|
|
|
'delete',
|
|
|
|
My::id()
|
|
|
|
)
|
|
|
|
->addUserAction(
|
|
|
|
'versions',
|
|
|
|
'delete',
|
|
|
|
My::id()
|
|
|
|
)
|
|
|
|
->addDirectAction(
|
|
|
|
'settings',
|
|
|
|
'delete_all',
|
|
|
|
My::id()
|
|
|
|
)
|
|
|
|
->addDirectAction(
|
|
|
|
'plugins',
|
|
|
|
'delete',
|
|
|
|
My::id()
|
|
|
|
)
|
|
|
|
->addDirectAction(
|
|
|
|
'versions',
|
|
|
|
'delete',
|
|
|
|
My::id()
|
|
|
|
)
|
|
|
|
;
|
|
|
|
|
|
|
|
// no custom action
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|