release 1.4

master v1.4
Jean-Christian Paul Denis 2023-10-07 22:35:41 +02:00
parent 13e7d1b595
commit 2ff128eb5f
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
8 changed files with 41 additions and 40 deletions

View File

@ -1,3 +1,9 @@
dcAdvancedCleaner 1.4 - 2023.10.07
===========================================================
* Require Dotclear 2.28
* Require PHP 8.1
* Upgrade to Dotclear 2.28
dcAdvancedCleaner 1.3 - 2023.08.14 dcAdvancedCleaner 1.3 - 2023.08.14
=========================================================== ===========================================================
* Require Dotclear 2.27 * Require Dotclear 2.27

View File

@ -1,27 +1,23 @@
# README # README
[![Release](https://img.shields.io/badge/release-1.3-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/releases) [![Release](https://img.shields.io/badge/release-1.4-a2cbe9.svg)](https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/releases)
[![Date](https://img.shields.io/badge/date-2023.08.14-c44d58.svg)](https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/releases) ![Date](https://img.shields.io/badge/date-2023.10.07-c44d58.svg)
[![Dotclear](https://img.shields.io/badge/dotclear-v2.27-137bbb.svg)](https://fr.dotclear.org/download) [![Dotclear](https://img.shields.io/badge/dotclear-v2.28-137bbb.svg)](https://fr.dotclear.org/download)
[![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/dcAdvancedCleaner) [![Dotaddict](https://img.shields.io/badge/dotaddict-official-9ac123.svg)](https://plugins.dotaddict.org/dc2/details/dcAdvancedCleaner)
[![License](https://img.shields.io/github/license/JcDenis/dcAdvancedCleaner)](https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/blob/master/LICENSE) [![License](https://img.shields.io/badge/license-GPL--2.0-ececec.svg)](https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/src/branch/master/LICENSE)
## WHAT IS DCADVANCEDCLEANER ? ## ABOUT
_dcAdvancedCleaner_ is a plugin for the open-source _dcAdvancedCleaner_ is a plugin for the open-source web publishing software called [Dotclear](https://www.dotclear.org).
web publishing software called Dotclear.
It help clean up Dotclear install, plugins, themes, > It help clean up Dotclear install, plugins, themes, settings, tables, cache, etc...
settings, tables, cache, etc...
## REQUIREMENTS ## REQUIREMENTS
_dcAdvancedCleaner_ requires:
* Permissions superadmin * Permissions superadmin
* Dotclear 2.27 * Dotclear 2.28
* PHP >= 8.1 * PHP >= 8.1
* Plugin Uninstaller (temporary at https://github.com/JcDenis/Uninstaller ) * Plugin Uninstaller
## USAGE ## USAGE

View File

@ -18,12 +18,12 @@ $this->registerModule(
'Advanced cleaner', 'Advanced cleaner',
'Make a huge cleaning of dotclear', 'Make a huge cleaning of dotclear',
'Jean-Christian Denis and Contributors', 'Jean-Christian Denis and Contributors',
'1.3', '1.4',
[ [
'requires' => [ 'requires' => [
['php', '8.1'], ['php', '8.1'],
['core', '2.27'], ['core', '2.28'],
['Uninstaller', '0.8'], ['Uninstaller', '1.0'],
], ],
'permissions' => null, 'permissions' => null,
'type' => 'plugin', 'type' => 'plugin',

View File

@ -2,11 +2,11 @@
<modules xmlns:da="http://dotaddict.org/da/"> <modules xmlns:da="http://dotaddict.org/da/">
<module id="dcAdvancedCleaner"> <module id="dcAdvancedCleaner">
<name>Advanced cleaner</name> <name>Advanced cleaner</name>
<version>1.3</version> <version>1.4</version>
<author>Jean-Christian Denis and Contributors</author> <author>Jean-Christian Denis and Contributors</author>
<desc>Make a huge cleaning of dotclear</desc> <desc>Make a huge cleaning of dotclear</desc>
<file>https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/releases/download/v1.3/plugin-dcAdvancedCleaner.zip</file> <file>https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/releases/download/v1.4/plugin-dcAdvancedCleaner.zip</file>
<da:dcmin>2.27</da:dcmin> <da:dcmin>2.28</da:dcmin>
<da:details>https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/src/branch/master/README.md</da:details> <da:details>https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/src/branch/master/README.md</da:details>
<da:support>https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/issues</da:support> <da:support>https://git.dotclear.watch/JcDenis/dcAdvancedCleaner/issues</da:support>
</module> </module>

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\dcAdvancedCleaner; namespace Dotclear\Plugin\dcAdvancedCleaner;
use dcCore; use Dotclear\App;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Core\Backend\Favorites; use Dotclear\Core\Backend\Favorites;
@ -27,20 +27,19 @@ class Backend extends Process
public static function process(): bool public static function process(): bool
{ {
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) { if (!self::status() || !App::plugins()->moduleExists('Uninstaller')) {
return false; return false;
} }
My::addBackendMenuItem(); My::addBackendMenuItem();
dcCore::app()->addBehaviors([ App::behavior()->addBehaviors([
'adminDashboardFavoritesV2' => function (Favorites $favs): void { 'adminDashboardFavoritesV2' => function (Favorites $favs): void {
$favs->register(My::id(), [ $favs->register(My::id(), [
'title' => My::name(), 'title' => My::name(),
'url' => My::manageURL(), 'url' => My::manageURL(),
'small-icon' => My::icons(), 'small-icon' => My::icons(),
'large-icon' => My::icons(), 'large-icon' => My::icons(),
//'permissions' => dcCore::app()->auth?->isSuperAdmin(),
]); ]);
}, },
]); ]);

View File

@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Dotclear\Plugin\dcAdvancedCleaner; namespace Dotclear\Plugin\dcAdvancedCleaner;
use dcCore; use Dotclear\App;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Core\Backend\{ use Dotclear\Core\Backend\{
Notices, Notices,
@ -44,7 +44,7 @@ class Manage extends Process
public static function process(): bool public static function process(): bool
{ {
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) { if (!self::status() || !App::plugins()->moduleExists('Uninstaller')) {
return false; return false;
} }
@ -79,7 +79,7 @@ class Manage extends Process
$ns .= $vars->related . ':' . $id . ';'; $ns .= $vars->related . ':' . $id . ';';
} }
$vars->cleaners->execute($vars->cleaner->id, $vars->action, $ns); $vars->cleaners->execute($vars->cleaner->id, $vars->action, $ns);
// other actions // other actions
} elseif ($vars->action != 'delete_related') { } elseif ($vars->action != 'delete_related') {
foreach ($vars->entries as $ns) { foreach ($vars->entries as $ns) {
$vars->cleaners->execute($vars->cleaner->id, $vars->action, $ns); $vars->cleaners->execute($vars->cleaner->id, $vars->action, $ns);
@ -89,7 +89,7 @@ class Manage extends Process
Notices::addSuccessNotice(__('Action successfuly excecuted')); Notices::addSuccessNotice(__('Action successfuly excecuted'));
My::redirect(['part' => $vars->cleaner->id]); My::redirect(['part' => $vars->cleaner->id]);
} catch (Exception $e) { } catch (Exception $e) {
dcCore::app()->error->add($e->getMessage()); App::error()->add($e->getMessage());
} }
} }
@ -112,7 +112,7 @@ class Manage extends Process
); );
# --BEHAVIOR-- dcAdvancedCleanerAdminHeader # --BEHAVIOR-- dcAdvancedCleanerAdminHeader
dcCore::app()->callBehavior('dcAdvancedCleanerAdminHeader'); App::behavior()->callBehavior('dcAdvancedCleanerAdminHeader');
$breadcrumb = [ $breadcrumb = [
__('Plugins') => '', __('Plugins') => '',
@ -144,7 +144,7 @@ class Manage extends Process
if (empty($vars->related)) { if (empty($vars->related)) {
echo echo
(new Form('parts_menu'))->method('get')->action(dcCore::app()->admin->getPageURL())->fields([ (new Form('parts_menu'))->method('get')->action(App::backend()->getPageURL())->fields([
(new Para())->class('anchor-nav')->items([ (new Para())->class('anchor-nav')->items([
(new Label(__('Goto:'), Label::OUTSIDE_LABEL_BEFORE))->for('part')->class('classic'), (new Label(__('Goto:'), Label::OUTSIDE_LABEL_BEFORE))->for('part')->class('classic'),
(new Select(['part', 'select_part']))->default($vars->cleaner->id)->items($vars->combo), (new Select(['part', 'select_part']))->default($vars->cleaner->id)->items($vars->combo),
@ -172,7 +172,7 @@ class Manage extends Process
} }
echo echo
'<form method="post" action="' . dcCore::app()->admin->getPageURL() . '" id="form-funcs">' . '<form method="post" action="' . App::backend()->getPageURL() . '" id="form-funcs">' .
'<div class="table-outer">' . '<div class="table-outer">' .
'<table><caption>' . sprintf(__('There are %s entries'), count($rs)) . '</caption><thead><tr>' . '<table><caption>' . sprintf(__('There are %s entries'), count($rs)) . '</caption><thead><tr>' .
'<th colspan="2">' . __('Name') . '</th><th colspan="2">' . __('Objects') . '</th>' . '<th colspan="2">' . __('Name') . '</th><th colspan="2">' . __('Objects') . '</th>' .
@ -221,7 +221,7 @@ class Manage extends Process
} }
echo echo
(new Form('option'))->method('post')->action(dcCore::app()->admin->getPageURL())->fields([ (new Form('option'))->method('post')->action(App::backend()->getPageURL())->fields([
(new Para())->items([ (new Para())->items([
(new Submit('option-action'))->value(My::settings()->getGlobal('dcproperty_hide') ? __('Show Dotclear default properties') : __('Hide Dotclear default properties')), (new Submit('option-action'))->value(My::settings()->getGlobal('dcproperty_hide') ? __('Show Dotclear default properties') : __('Hide Dotclear default properties')),
(new Hidden('dcproperty_hide', My::settings()->getGlobal('dcproperty_hide') ? '0' : '1')), (new Hidden('dcproperty_hide', My::settings()->getGlobal('dcproperty_hide') ? '0' : '1')),
@ -240,7 +240,7 @@ class Manage extends Process
echo (new Text('p', __('There is nothing to display')))->class('error')->render(); echo (new Text('p', __('There is nothing to display')))->class('error')->render();
} else { } else {
echo echo
'<form method="post" action="' . dcCore::app()->admin->getPageURL() . '" id="form-funcs">' . '<form method="post" action="' . App::backend()->getPageURL() . '" id="form-funcs">' .
'<div class="table-outer">' . '<div class="table-outer">' .
'<table><caption>' . sprintf(__('There are %s related entries for the group "%s"'), count($rs), $vars->related) . '</caption><thead><tr>' . '<table><caption>' . sprintf(__('There are %s related entries for the group "%s"'), count($rs), $vars->related) . '</caption><thead><tr>' .
'<th colspan="2">' . __('Name') . '</th><th>' . __('Objects') . '</th>' . '<th colspan="2">' . __('Name') . '</th><th>' . __('Objects') . '</th>' .
@ -263,10 +263,11 @@ class Manage extends Process
'</tbody></table></div>' . '</tbody></table></div>' .
(new Para())->items([ (new Para())->items([
(new Submit('do-action'))->class('delete')->value(__('I understand and I am want to delete this')), (new Submit('do-action'))->class('delete')->value(__('I understand and I am want to delete this')),
(new Hidden(['related'], $vars->related)), ... My::hiddenFields([
(new Hidden(['part'], $vars->cleaner->id)), 'related' => $vars->related,
(new Hidden(['action'], 'delete_related')), 'part' => $vars->cleaner->id,
... My::hiddenFields(), 'action' => 'delete_related',
]),
])->render() . ])->render() .
'<p class="warning">' . '<p class="warning">' .
__('Beware: All actions done here are irreversible and are directly applied') . __('Beware: All actions done here are irreversible and are directly applied') .

View File

@ -14,13 +14,13 @@ declare(strict_types=1);
namespace Dotclear\Plugin\dcAdvancedCleaner; namespace Dotclear\Plugin\dcAdvancedCleaner;
use dcCore; use Dotclear\App;
use Dotclear\Module\MyPlugin; use Dotclear\Module\MyPlugin;
class My extends MyPlugin class My extends MyPlugin
{ {
public static function checkCustomContext(int $context): ?bool public static function checkCustomContext(int $context): ?bool
{ {
return $context === self::PREPEND ? dcCore::app()->auth->isSuperAdmin() : null; return $context === self::PREPEND ? App::auth()->isSuperAdmin() : null;
} }
} }

View File

@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Dotclear\Plugin\dcAdvancedCleaner; namespace Dotclear\Plugin\dcAdvancedCleaner;
use dcCore;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Plugin\Uninstaller\Uninstaller; use Dotclear\Plugin\Uninstaller\Uninstaller;
@ -27,7 +26,7 @@ class Uninstall extends Process
public static function process(): bool public static function process(): bool
{ {
if (!self::status() || !dcCore::app()->plugins->moduleExists('Uninstaller')) { if (!self::status()) {
return false; return false;
} }