2021-08-18 19:42:30 +00:00
|
|
|
<?php
|
2021-09-02 21:44:01 +00:00
|
|
|
/**
|
|
|
|
* @brief translater, a plugin for Dotclear 2
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @package Dotclear
|
|
|
|
* @subpackage Plugin
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @author Jean-Christian Denis & contributors
|
2021-11-01 21:32:32 +00:00
|
|
|
*
|
2021-09-02 21:44:01 +00:00
|
|
|
* @copyright Jean-Christian Denis
|
|
|
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
|
|
|
*/
|
2023-03-14 23:26:31 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Dotclear\Plugin\translater;
|
|
|
|
|
|
|
|
class Uninstall
|
|
|
|
{
|
2023-03-16 21:58:06 +00:00
|
|
|
protected static bool $init = false;
|
2023-03-14 23:26:31 +00:00
|
|
|
|
|
|
|
public static function init(): bool
|
|
|
|
{
|
|
|
|
self::$init = defined('DC_RC_PATH');
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
return self::$init;
|
|
|
|
}
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
public static function process($uninstaller): ?bool
|
|
|
|
{
|
|
|
|
if (!self::$init) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
$uninstaller->addUserAction(
|
|
|
|
/* type */
|
|
|
|
'settings',
|
|
|
|
/* action */
|
|
|
|
'delete_all',
|
|
|
|
/* ns */
|
|
|
|
My::id(),
|
|
|
|
/* description */
|
|
|
|
__('delete all settings')
|
|
|
|
);
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
$uninstaller->addUserAction(
|
|
|
|
/* type */
|
|
|
|
'plugins',
|
|
|
|
/* action */
|
|
|
|
'delete',
|
|
|
|
/* ns */
|
|
|
|
My::id(),
|
|
|
|
/* description */
|
|
|
|
__('delete plugin files')
|
|
|
|
);
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
$uninstaller->addUserAction(
|
|
|
|
/* type */
|
|
|
|
'versions',
|
|
|
|
/* action */
|
|
|
|
'delete',
|
|
|
|
/* ns */
|
|
|
|
My::id(),
|
|
|
|
/* description */
|
|
|
|
__('delete the version number')
|
|
|
|
);
|
2021-08-18 19:42:30 +00:00
|
|
|
|
2023-03-14 23:26:31 +00:00
|
|
|
$uninstaller->addDirectAction(
|
|
|
|
/* type */
|
|
|
|
'settings',
|
|
|
|
/* action */
|
|
|
|
'delete_all',
|
|
|
|
/* ns */
|
|
|
|
My::id(),
|
|
|
|
/* description */
|
|
|
|
sprintf(__('delete all %s settings'), My::id())
|
|
|
|
);
|
|
|
|
|
|
|
|
$uninstaller->addDirectAction(
|
|
|
|
/* type */
|
|
|
|
'plugins',
|
|
|
|
/* action */
|
|
|
|
'delete',
|
|
|
|
/* ns */
|
|
|
|
My::id(),
|
|
|
|
/* description */
|
|
|
|
sprintf(__('delete %s plugin files'), My::id())
|
|
|
|
);
|
|
|
|
|
|
|
|
$uninstaller->addDirectAction(
|
|
|
|
/* type */
|
|
|
|
'versions',
|
|
|
|
/* action */
|
|
|
|
'delete',
|
|
|
|
/* ns */
|
|
|
|
My::id(),
|
|
|
|
/* description */
|
|
|
|
sprintf(__('delete %s version number'), My::id())
|
|
|
|
);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|