From 0568131cb3c083a66f58d5a071b9630bb573e0a0 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Thu, 20 Apr 2023 16:04:05 +0200 Subject: [PATCH] use last activityReport plugin --- locales/fr/main.lang.php | 27 +++++++++++++-------------- locales/fr/main.po | 36 ++++++++++++++++-------------------- src/Manage.php | 2 +- src/Prepend.php | 36 +++++++++++++++++++++--------------- 4 files changed, 51 insertions(+), 50 deletions(-) diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php index aeb5a38..8259570 100644 --- a/locales/fr/main.lang.php +++ b/locales/fr/main.lang.php @@ -11,17 +11,16 @@ use Dotclear\Helper\L10n; -L10n::$locales['Action successfuly excecuted'] = 'Action exécutée avec succès'; -L10n::$locales['There is nothing to display'] = 'Il n\'y a rien à afficher'; -L10n::$locales['There are %s entries'] = 'Il y a %s entrées'; -L10n::$locales['Objects'] = 'Objets'; -L10n::$locales['Values from official distribution'] = 'Valeurs de la distribution officielle'; -L10n::$locales['Action on selected rows:'] = 'Action sur les lignes sélectionnées :'; -L10n::$locales['Beware: All actions done here are irreversible and are directly applied'] = 'Attention : toutes les actions menées ici sont irréversibles et sont directement appliquées'; -L10n::$locales['Show Dotclear default properties'] = 'Afficher les propriétés de Dotclear'; -L10n::$locales['Hide Dotclear default properties'] = 'Cacher les propriétés de Dotclear'; -L10n::$locales['Failed to load cleaner'] = 'Impossible de charger le nettoyeur'; -L10n::$locales['Plugin dcAdvancedCleaner'] = 'Plugin dcAdvancedCleaner'; -L10n::$locales['New action from dcAdvancedCleaner has been made with type="%s", action="%s", ns="%s".'] = 'Une nouvelle action depuis dcAdvancedCleaner a été effectuée avec : type="%s", action="%s", ns="%s"'; -L10n::$locales['Advanced cleaner'] = 'Nettoyeur avancé'; -L10n::$locales['Make a huge cleaning of dotclear'] = 'Faites un énorme nettoyage de dotclear'; +L10n::$locales['Action successfuly excecuted'] = 'Action exécutée avec succès'; +L10n::$locales['There is nothing to display'] = 'Il n\'y a rien à afficher'; +L10n::$locales['There are %s entries'] = 'Il y a %s entrées'; +L10n::$locales['Objects'] = 'Objets'; +L10n::$locales['Values from official distribution'] = 'Valeurs de la distribution officielle'; +L10n::$locales['Action on selected rows:'] = 'Action sur les lignes sélectionnées :'; +L10n::$locales['Beware: All actions done here are irreversible and are directly applied'] = 'Attention : toutes les actions menées ici sont irréversibles et sont directement appliquées'; +L10n::$locales['Show Dotclear default properties'] = 'Afficher les propriétés de Dotclear'; +L10n::$locales['Hide Dotclear default properties'] = 'Cacher les propriétés de Dotclear'; +L10n::$locales['Failed to load cleaner'] = 'Impossible de charger le nettoyeur'; +L10n::$locales['Uninstalling module'] = 'Désinstallation de module'; +L10n::$locales['Advanced cleaner'] = 'Nettoyeur avancé'; +L10n::$locales['Make a huge cleaning of dotclear'] = 'Faites un énorme nettoyage de dotclear'; diff --git a/locales/fr/main.po b/locales/fr/main.po index 4193fdd..faa584e 100644 --- a/locales/fr/main.po +++ b/locales/fr/main.po @@ -1,54 +1,54 @@ # Language: Français -# Module: dcAdvancedCleaner - 0.11 -# Date: 2023-04-16 00:08:42 +# Module: dcAdvancedCleaner - 0.2 +# Date: 2023-04-20 14:01:57 # Author: , contact@jcdenis.fr # Translated with translater 2023.03.19 msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" -"Project-Id-Version: dcAdvancedCleaner 0.11\n" +"Project-Id-Version: dcAdvancedCleaner 0.2\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2023-04-16T00:08:42+00:00\n" +"PO-Revision-Date: 2023-04-20T14:01:57+00:00\n" "Last-Translator: Jean-Christian Denis\n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: src/Manage.php:77 +#: src/Manage.php:82 msgid "Action successfuly excecuted" msgstr "Action exécutée avec succès" -#: src/Manage.php:128 +#: src/Manage.php:120 msgid "There is nothing to display" msgstr "Il n'y a rien à afficher" -#: src/Manage.php:142 +#: src/Manage.php:155 msgid "There are %s entries" msgstr "Il y a %s entrées" -#: src/Manage.php:143 +#: src/Manage.php:156 msgid "Objects" msgstr "Objets" -#: src/Manage.php:163 +#: src/Manage.php:176 msgid "Values from official distribution" msgstr "Valeurs de la distribution officielle" -#: src/Manage.php:172 +#: src/Manage.php:185 msgid "Action on selected rows:" msgstr "Action sur les lignes sélectionnées :" -#: src/Manage.php:180 +#: src/Manage.php:193 msgid "Beware: All actions done here are irreversible and are directly applied" msgstr "Attention : toutes les actions menées ici sont irréversibles et sont directement appliquées" -#: src/Manage.php:188 +#: src/Manage.php:201 msgid "Show Dotclear default properties" msgstr "Afficher les propriétés de Dotclear" -#: src/Manage.php:188 +#: src/Manage.php:201 msgid "Hide Dotclear default properties" msgstr "Cacher les propriétés de Dotclear" @@ -56,13 +56,9 @@ msgstr "Cacher les propriétés de Dotclear" msgid "Failed to load cleaner" msgstr "Impossible de charger le nettoyeur" -#: src/Prepend.php:40 -msgid "Plugin dcAdvancedCleaner" -msgstr "Plugin dcAdvancedCleaner" - -#: src/Prepend.php:47 -msgid "New action from dcAdvancedCleaner has been made with type=\"%s\", action=\"%s\", ns=\"%s\"." -msgstr "Une nouvelle action depuis dcAdvancedCleaner a été effectuée avec : type=\"%s\", action=\"%s\", ns=\"%s\"" +#: src/Prepend.php:48 +msgid "Uninstalling module" +msgstr "Désinstallation de module" msgid "Advanced cleaner" msgstr "Nettoyeur avancé" diff --git a/src/Manage.php b/src/Manage.php index b1e0268..293fcd7 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -67,7 +67,7 @@ class Manage extends dcNsProcess true, true ); - dcPage::addSuccessNotice(__('Configuration successfuly updated')); + dcPage::addSuccessNotice(__('Configuration successfully updated.')); dcCore::app()->adminurl?->redirect( 'admin.plugin.' . My::id(), ['part' => $vars->cleaner->id] diff --git a/src/Prepend.php b/src/Prepend.php index eae5e72..ca548ab 100644 --- a/src/Prepend.php +++ b/src/Prepend.php @@ -16,6 +16,12 @@ namespace Dotclear\Plugin\dcAdvancedCleaner; use dcCore; use dcNsProcess; +use Dotclear\Plugin\activityReport\{ + Action, + ActivityReport, + Group +}; +use Dotclear\Plugin\Uninstaller\Uninstaller; class Prepend extends dcNsProcess { @@ -34,22 +40,22 @@ class Prepend extends dcNsProcess return false; } - if (defined('ACTIVITY_REPORT_V2')) { - dcCore::app()->activityReport->addGroup( - My::id(), - __('Plugin dcAdvancedCleaner') - ); - - dcCore::app()->activityReport->addAction( - My::id(), - 'maintenance', - __('Maintenance'), - __('New action from dcAdvancedCleaner has been made with type="%s", action="%s", ns="%s".'), - 'dcAdvancedCleanerBeforeAction', - function ($type, $action, $ns) { - dcCore::app()->activityReport->addLog(My::id(), 'maintenance', [$type,$action, $ns]); + // log plugin Uninstaller actions + if (defined('ACTIVITY_REPORT') && ACTIVITY_REPORT == 3) { + $group = new Group(My::id(), My::name()); + $group->add(new Action( + 'uninstaller', + __('Uninstalling module'), + '%s', + 'UninstallerBeforeAction', + function (string $id, string $action, string $ns): void { + $success = Uninstaller::instance()->cleaners->get($id)?->get($action)?->success; + if (!is_null($success)) { + ActivityReport::instance()->addLog(My::id(), 'uninstaller', [sprintf($success, $ns)]); + } } - ); + )); + ActivityReport::instance()->groups->add($group); } return true;