From a925e77b910f61fdd9c00164856d2a2d527bc173 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.chilliet@fusiondirectory.org>
Date: Tue, 15 Oct 2019 09:41:28 +0200
Subject: [PATCH] :tractor: feat(hooks) Rename hooks to triggers in the
 interface

issue #6037
---
 include/class_msgPool.inc                     |  2 +-
 include/simpleplugin/class_simplePlugin.inc   |  2 +-
 .../admin/departments/class_department.inc    |  1 -
 plugins/config/class_hooksConfig.inc          | 24 +++++++++----------
 plugins/config/class_mainPluginsConfig.inc    |  2 +-
 5 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/include/class_msgPool.inc b/include/class_msgPool.inc
index 090350829..7c621b3a6 100644
--- a/include/class_msgPool.inc
+++ b/include/class_msgPool.inc
@@ -293,7 +293,7 @@ class msgPool
    */
   public static function cmdnotfound ($type, $plugin)
   {
-    return sprintf(_("Command specified as %s hook for plugin '%s' does not exist!"), $type, $plugin);
+    return sprintf(_('Command specified as %s trigger for plugin "%s" does not exist!'), $type, $plugin);
   }
 
   /*!
diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc
index 3adb17807..fae13eebd 100644
--- a/include/simpleplugin/class_simplePlugin.inc
+++ b/include/simpleplugin/class_simplePlugin.inc
@@ -1535,7 +1535,7 @@ class simplePlugin implements SimpleTab
         $str = implode("\n", $arr);
         @DEBUG(DEBUG_SHELL, __LINE__, __FUNCTION__, __FILE__, $command, "Result: ".$str);
         if (!empty($str) && $config->get_cfg_value("displayHookOutput", "FALSE") == "TRUE") {
-          msg_dialog::display('['.get_class($this).' '.strtolower($cmd)."hook] $command", $str, INFO_DIALOG);
+          msg_dialog::display('['.get_class($this).' '.strtolower($cmd).'trigger] '.$command, $str, INFO_DIALOG);
         }
       }
     }
diff --git a/plugins/admin/departments/class_department.inc b/plugins/admin/departments/class_department.inc
index e20aaf853..1fe769aa5 100644
--- a/plugins/admin/departments/class_department.inc
+++ b/plugins/admin/departments/class_department.inc
@@ -162,7 +162,6 @@ class department extends simplePlugin
   /* Check values */
   function check (): array
   {
-    /* Call common method to give check the hook */
     $message = parent::check();
 
     $namingAttr = static::$namingAttr;
diff --git a/plugins/config/class_hooksConfig.inc b/plugins/config/class_hooksConfig.inc
index f26934968..38e2c60d9 100644
--- a/plugins/config/class_hooksConfig.inc
+++ b/plugins/config/class_hooksConfig.inc
@@ -24,8 +24,8 @@ class hooksConfig extends simplePlugin
   static function plInfo (): array
   {
     return [
-      'plShortName'     => _('Hooks'),
-      'plTitle'         => _('Hooks configuration'),
+      'plShortName'     => _('Triggers'),
+      'plTitle'         => _('Triggers configuration'),
       'plPriority'      => 1,
       'plObjectType'    => ['configuration'],
 
@@ -44,41 +44,41 @@ class hooksConfig extends simplePlugin
     sort($plugins);
 
     return [
-      'hooks' => [
-        'name'  => _('Hooks'),
+      'triggers' => [
+        'name'  => _('Triggers'),
         'class' => ['fullwidth'],
         'attrs' => [
           new BooleanAttribute(
-            _('Display hook output'),
-            _('When enabled successful hook execution output is displayed to the user using a dialog.'),
+            _('Display trigger output'),
+            _('When enabled successful trigger execution output is displayed to the user using a dialog.'),
             'fdDisplayHookOutput'
           ),
           new OrderedArrayAttribute(
             new CompositeAttribute(
-              _('Hooks that are called when specific actions happens'),
+              _('Triggers that are called when specific actions happens'),
               'fdTabHook',
               [
                 new SelectAttribute(
-                  _('Tab'), _('The tab that this hook concerns'),
-                  'hookTab', TRUE,
+                  _('Tab'), _('The tab that this trigger concerns'),
+                  'triggerTab', TRUE,
                   $plugins
                 ),
                 new SelectAttribute(
                   _('Mode'), _('When to call this command'),
-                  'hookMode', TRUE,
+                  'triggerMode', TRUE,
                   ['postcreate', 'postremove', 'postmodify',
                         'precreate', 'preremove', 'premodify', 'check',
                         'prelock', 'postlock', 'preunlock', 'postunlock']
                 ),
                 new TextAreaAttribute(
                   _('Command'), _('The command that will be called'),
-                  'hookCmd', TRUE
+                  'triggerCmd', TRUE
                 )
               ],
               '/^([^\\|]+)\\|([^\\|]+)\\|(.*)$/',
               '%s|%s|%s',
               '', // acl
-              _('Hooks')
+              _('Triggers')
             ),
             FALSE, // non-ordered
             [],
diff --git a/plugins/config/class_mainPluginsConfig.inc b/plugins/config/class_mainPluginsConfig.inc
index 351ab7cce..f55a85ec9 100644
--- a/plugins/config/class_mainPluginsConfig.inc
+++ b/plugins/config/class_mainPluginsConfig.inc
@@ -51,7 +51,7 @@ class mainPluginsConfig extends simplePlugin
         'name'  => _('SASL'),
         'attrs' => [
           new BooleanAttribute(
-            _('Force to ask for password'), _('Useful if you add a hook using password value when SASL user passwords are edited'),
+            _('Force to ask for password'), _('Useful if you add a trigger using password value when SASL user passwords are edited'),
             'fdForceSaslPasswordAsk', TRUE,
             FALSE
           ),
-- 
GitLab