ejpri...@users.adullact.net
unread,Jun 18, 2024, 5:36:26 AM (8 days ago) Jun 18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to openmairi...@googlegroups.com
Author: ejpritchard
Date: 2024-06-18 11:36:24 +0200 (Tue, 18 Jun 2024)
New Revision: 17961
Added:
branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/deploy/
Modified:
branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/
branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/HISTORY.txt
branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj/
branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj/module_manager.class.php
branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/tests/
Log:
merge(branch) : 6.6.0-develop to 6.6.-develop-10435ImportAnnexesDocumentSpe
Index: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe
===================================================================
--- branches/6.6.0-develop-10435ImportAnnexesDocumentSpe 2024-06-18 09:32:17 UTC (rev 17960)
+++ branches/6.6.0-develop-10435ImportAnnexesDocumentSpe 2024-06-18 09:36:24 UTC (rev 17961)
Property changes on: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe
___________________________________________________________________
Modified: svn:mergeinfo
## -711,6 +711,7 ##
/branches/6.5.0-develop-error-contrainte-traitement-sig:17384-17432
/branches/6.5.0-develop_fix_avis_produit_onglet_pieces:17288-17414
/branches/6.6.0-10411:17736-17870
+/branches/6.6.0-develop:17946-17960
/branches/6.6.0-develop--improve-task:17580-17609
/branches/6.6.0-develop-10391-SupportPlatAuSousDossier:17581-17697
/branches/6.6.0-develop-10409-GestionTODO:17700-17768
## -719,6 +720,7 ##
/branches/6.6.0-develop-10424-AjoutHooksInstruction:17818-17859
/branches/6.6.0-develop-10427-AjoutGetObjectName:17878-17886
/branches/6.6.0-develop-10428-ModuleAnnexes:17883-17913
+/branches/6.6.0-develop-10431-ScriptInstallationModules:17909-17953
/branches/6.6.0-develop-bug-user-with-space:17809-17837
/branches/6.6.0-develop-documentation-document_type:17801-17845
/branches/6.6.0-develop-integration-type_documents:17635-17756
Modified: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/HISTORY.txt
===================================================================
--- branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/HISTORY.txt 2024-06-18 09:32:17 UTC (rev 17960)
+++ branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/HISTORY.txt 2024-06-18 09:36:24 UTC (rev 17961)
@@ -3,7 +3,8 @@
6.6.0 (unreleased)
------------------
-
+* Évolution - Ajout de la gestion du script d'installation des modules [MC0043833].
+ Ticket #10431.
* Évolution - Message d'avertissement du dépassement de la date limite d'instruction
lors de la notification manuelle des pétitionnaires via le portail citoyen.
Ticket #10362.
Index: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj
===================================================================
--- branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj 2024-06-18 09:32:17 UTC (rev 17960)
+++ branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj 2024-06-18 09:36:24 UTC (rev 17961)
Property changes on: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj
___________________________________________________________________
Modified: svn:mergeinfo
## -670,6 +670,7 ##
/branches/6.5.0-develop-error-contrainte-traitement-sig/obj:17384-17432
/branches/6.5.0-develop_fix_avis_produit_onglet_pieces/obj:17288-17414
/branches/6.6.0-10411/obj:17736-17870
+/branches/6.6.0-develop/obj:17946-17960
/branches/6.6.0-develop--improve-task/obj:17580-17609
/branches/6.6.0-develop-10391-SupportPlatAuSousDossier/obj:17581-17697
/branches/6.6.0-develop-10409-GestionTODO/obj:17700-17768
## -678,6 +679,7 ##
/branches/6.6.0-develop-10424-AjoutHooksInstruction/obj:17818-17859
/branches/6.6.0-develop-10427-AjoutGetObjectName/obj:17878-17886
/branches/6.6.0-develop-10428-ModuleAnnexes/obj:17883-17913
+/branches/6.6.0-develop-10431-ScriptInstallationModules/obj:17909-17953
/branches/6.6.0-develop-bug-user-with-space/obj:17809-17837
/branches/6.6.0-develop-documentation-document_type/obj:17801-17845
/branches/6.6.0-develop-integration-type_documents/obj:17635-17756
Modified: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj/module_manager.class.php
===================================================================
--- branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj/module_manager.class.php 2024-06-18 09:32:17 UTC (rev 17960)
+++ branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/obj/module_manager.class.php 2024-06-18 09:36:24 UTC (rev 17961)
@@ -97,6 +97,86 @@
}
/**
+ * Fonction incluant le fichier du module qu'il soit dans son propre sous dossier ou dans le dossier module
+ *
+ * @param string $module_name : nom du module à inclure
+ * @param string $module_dir : nom du dossier du module à inclure
+ *
+ */
+ protected function require_once_module($module_name, $module_dir) {
+ $module_script = "$module_dir/$module_name.php";
+ $module_folder_script = "$module_dir/$module_name/$module_name.php";
+ if (file_exists($module_script)) {
+ require_once $module_script;
+ } else if (file_exists($module_folder_script)) {
+ require_once $module_folder_script;
+ } else {
+ throw new RuntimeException("File named $module_name.php unfound ! ");
+ }
+ }
+
+ /**
+ * Fonction qui instancie le module nommée
+ *
+ * @param string $module_name : nom du module à instancier
+ * @param lien_module $wf_module_link Instance de lien module
+ * @param mixed $object Un objet métier à associer au module
+ *
+ * @return object : Instance du module
+ */
+ public function get_module_instance($module_name, lien_module $wf_module_link = null, $object = null) {
+ $module_dir = $this->get_modules_dir();
+ $this->require_once_module($module_name, $module_dir);
+ $module_name_camel = str_replace(' ', '', ucfirst(preg_replace('/[^a-zA-Z0-9]/', ' ', $module_name)));
+ $module_namespace = "Module\\$module_name_camel";
+ $module_class_path = $module_namespace.'\\'.$module_name;
+ $module_instance = new $module_class_path($module_dir, $this->framework, $wf_module_link, $object );
+ return $module_instance;
+ }
+
+ /**
+ * Fonction permettant de recuperer un module nommée et de lancer ses fonctions d'installations
+ *
+ * @param string $module_name : nom du module à instancier
+ *
+ * @return boolean : True ou False
+ */
+ public function install_modules($module_names) {
+ foreach ($module_names as $module_name){
+ try {
+ $module_instance = $this->get_module_instance($module_name);
+ $module_instance->install();
+ } catch (RuntimeException $re) {
+ $this->log(__METHOD__, " RuntimeException: $module_name => $re");
+ file_put_contents(STDERR, " RuntimeException: $module_name => $re", FILE_APPEND );
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Fonction permettant de recuperer un module nommée et de lancer ses fonctions d'installations
+ *
+ * @param string $module_name : nom du module à instancier
+ *
+ * @return boolean : True ou False
+ */
+ public function uninstall_modules($module_names) {
+ foreach ($module_names as $module_name){
+ try {
+ $module_instance = $this->get_module_instance($module_name);
+ $module_instance->uninstall();
+ } catch (RuntimeException $re) {
+ $this->log(__METHOD__, " RuntimeException: $module_name => $re");
+ file_put_contents(STDERR, " RuntimeException: $module_name => $re", FILE_APPEND );
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
* Charge la configuration dynamique des modules (si pas déjà fait), spécifiquement:
* - défini '$this->all_available_hooks' à partir de '$hooks'
* - défini '$this->enabled_for' à partir de '$modules_enabled_for'
Index: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/tests
===================================================================
--- branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/tests 2024-06-18 09:32:17 UTC (rev 17960)
+++ branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/tests 2024-06-18 09:36:24 UTC (rev 17961)
Property changes on: branches/6.6.0-develop-10435ImportAnnexesDocumentSpe/tests
___________________________________________________________________
Modified: svn:mergeinfo
## -664,6 +664,7 ##
/branches/6.5.0-develop-error-contrainte-traitement-sig/tests:17384-17432
/branches/6.5.0-develop_fix_avis_produit_onglet_pieces/tests:17288-17414
/branches/6.6.0-10411/tests:17736-17870
+/branches/6.6.0-develop/tests:17946-17960
/branches/6.6.0-develop--improve-task/tests:17580-17609
/branches/6.6.0-develop-10391-SupportPlatAuSousDossier/tests:17581-17697
/branches/6.6.0-develop-10409-GestionTODO/tests:17700-17768
## -671,6 +672,7 ##
/branches/6.6.0-develop-10420-ModuleCalculDeclencheur/tests:17803-17804
/branches/6.6.0-develop-10424-AjoutHooksInstruction/tests:17818-17859
/branches/6.6.0-develop-10428-ModuleAnnexes/tests:17883-17913
+/branches/6.6.0-develop-10431-ScriptInstallationModules/tests:17909-17953
/branches/6.6.0-develop-bug-user-with-space/tests:17809-17837
/branches/6.6.0-develop-documentation-document_type/tests:17801-17845
/branches/6.6.0-develop-integration-type_documents/tests:17635-17756