From 052e2a1a425c7b04d569399c5276a161d493a40f Mon Sep 17 00:00:00 2001 From: "denis.flaven@combodo.com" Date: Thu, 3 Oct 2024 12:14:32 +0200 Subject: [PATCH 1/6] :bookmark: Prepare 3.1.2 version --- approot.inc.php | 2 +- datamodels/2.x/authent-cas/module.authent-cas.php | 2 +- datamodels/2.x/authent-external/module.authent-external.php | 2 +- datamodels/2.x/authent-ldap/module.authent-ldap.php | 2 +- datamodels/2.x/authent-local/module.authent-local.php | 2 +- .../module.combodo-backoffice-darkmoon-theme.php | 2 +- datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php | 2 +- datamodels/2.x/itop-attachments/module.itop-attachments.php | 2 +- datamodels/2.x/itop-backup/module.itop-backup.php | 2 +- .../module.itop-bridge-cmdb-services.php | 2 +- .../itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php | 2 +- .../module.itop-bridge-datacenter-mgmt-services.php | 2 +- .../module.itop-bridge-endusers-devices-services.php | 2 +- .../module.itop-bridge-storage-mgmt-services.php | 2 +- .../module.itop-bridge-virtualization-mgmt-services.php | 2 +- .../module.itop-bridge-virtualization-storage.php | 2 +- .../2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php | 2 +- datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php | 2 +- datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php | 2 +- datamodels/2.x/itop-config/module.itop-config.php | 2 +- datamodels/2.x/itop-core-update/module.itop-core-update.php | 2 +- .../2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php | 2 +- .../2.x/itop-endusers-devices/module.itop-endusers-devices.php | 2 +- datamodels/2.x/itop-faq-light/module.itop-faq-light.php | 2 +- .../itop-files-information/module.itop-files-information.php | 2 +- datamodels/2.x/itop-full-itil/module.itop-full-itil.php | 2 +- datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php | 2 +- .../itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php | 2 +- .../2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php | 2 +- datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php | 2 +- datamodels/2.x/itop-portal-base/module.itop-portal-base.php | 2 +- datamodels/2.x/itop-portal/module.itop-portal.php | 2 +- datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php | 2 +- datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php | 2 +- .../itop-request-mgmt-itil/module.itop-request-mgmt-itil.php | 2 +- datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php | 2 +- .../module.itop-service-mgmt-provider.php | 2 +- datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php | 2 +- .../2.x/itop-sla-computation/module.itop-sla-computation.php | 2 +- datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php | 2 +- datamodels/2.x/itop-structure/module.itop-structure.php | 2 +- datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php | 2 +- datamodels/2.x/itop-tickets/module.itop-tickets.php | 2 +- .../module.itop-virtualization-mgmt.php | 2 +- datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php | 2 +- datamodels/2.x/version.xml | 2 +- 46 files changed, 46 insertions(+), 46 deletions(-) diff --git a/approot.inc.php b/approot.inc.php index 66dc4bb6e..274b56357 100644 --- a/approot.inc.php +++ b/approot.inc.php @@ -23,7 +23,7 @@ define('ITOP_DESIGN_LATEST_VERSION', '3.1'); * @used-by utils::GetItopVersionWikiSyntax() * @used-by iTopModulesPhpVersionIntegrationTest */ -define('ITOP_CORE_VERSION', '3.1.1'); +define('ITOP_CORE_VERSION', '3.1.2'); /** * @var string diff --git a/datamodels/2.x/authent-cas/module.authent-cas.php b/datamodels/2.x/authent-cas/module.authent-cas.php index b87b1ae57..5c73c0f6a 100644 --- a/datamodels/2.x/authent-cas/module.authent-cas.php +++ b/datamodels/2.x/authent-cas/module.authent-cas.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'authent-cas/3.1.1', + 'authent-cas/3.1.2', array( // Identification // diff --git a/datamodels/2.x/authent-external/module.authent-external.php b/datamodels/2.x/authent-external/module.authent-external.php index 3f8c8dd21..d55387e41 100755 --- a/datamodels/2.x/authent-external/module.authent-external.php +++ b/datamodels/2.x/authent-external/module.authent-external.php @@ -27,7 +27,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'authent-external/3.1.1', + 'authent-external/3.1.2', array( // Identification // diff --git a/datamodels/2.x/authent-ldap/module.authent-ldap.php b/datamodels/2.x/authent-ldap/module.authent-ldap.php index f9d45d2b2..ef9208e39 100755 --- a/datamodels/2.x/authent-ldap/module.authent-ldap.php +++ b/datamodels/2.x/authent-ldap/module.authent-ldap.php @@ -9,7 +9,7 @@ if (function_exists('ldap_connect')) SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'authent-ldap/3.1.1', + 'authent-ldap/3.1.2', array( // Identification // diff --git a/datamodels/2.x/authent-local/module.authent-local.php b/datamodels/2.x/authent-local/module.authent-local.php index f9e272b45..4bd063d3b 100755 --- a/datamodels/2.x/authent-local/module.authent-local.php +++ b/datamodels/2.x/authent-local/module.authent-local.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'authent-local/3.1.1', + 'authent-local/3.1.2', array( // Identification // diff --git a/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php b/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php index 2ce1b7bbe..4be29c7ca 100644 --- a/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php +++ b/datamodels/2.x/combodo-backoffice-darkmoon-theme/module.combodo-backoffice-darkmoon-theme.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'combodo-backoffice-darkmoon-theme/3.1.1', + 'combodo-backoffice-darkmoon-theme/3.1.2', array( // Identification // diff --git a/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php b/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php index 136ed3954..0c5b97a7c 100644 --- a/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php +++ b/datamodels/2.x/combodo-db-tools/module.combodo-db-tools.php @@ -24,7 +24,7 @@ /** @noinspection PhpUnhandledExceptionInspection */ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'combodo-db-tools/3.1.1', + 'combodo-db-tools/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-attachments/module.itop-attachments.php b/datamodels/2.x/itop-attachments/module.itop-attachments.php index 6a349f42c..0da71f94b 100644 --- a/datamodels/2.x/itop-attachments/module.itop-attachments.php +++ b/datamodels/2.x/itop-attachments/module.itop-attachments.php @@ -19,7 +19,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-attachments/3.1.1', + 'itop-attachments/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-backup/module.itop-backup.php b/datamodels/2.x/itop-backup/module.itop-backup.php index a46b43554..e5dc16cc4 100644 --- a/datamodels/2.x/itop-backup/module.itop-backup.php +++ b/datamodels/2.x/itop-backup/module.itop-backup.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-backup/3.1.1', + 'itop-backup/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php b/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php index ef38e35ad..d3a4b05bc 100644 --- a/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php +++ b/datamodels/2.x/itop-bridge-cmdb-services/module.itop-bridge-cmdb-services.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-bridge-cmdb-services/3.1.1', + 'itop-bridge-cmdb-services/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php b/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php index c8ecaf32b..c094beea1 100644 --- a/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php +++ b/datamodels/2.x/itop-bridge-cmdb-ticket/module.itop-bridge-cmdb-ticket.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-bridge-cmdb-ticket/3.1.1', + 'itop-bridge-cmdb-ticket/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php b/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php index c7643a12a..6cc0020a2 100644 --- a/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php +++ b/datamodels/2.x/itop-bridge-datacenter-mgmt-services/module.itop-bridge-datacenter-mgmt-services.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-bridge-datacenter-mgmt-services/3.1.1', + 'itop-bridge-datacenter-mgmt-services/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php b/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php index 0806b78b4..38f7ecdb9 100644 --- a/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php +++ b/datamodels/2.x/itop-bridge-endusers-devices-services/module.itop-bridge-endusers-devices-services.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-bridge-endusers-devices-services/3.1.1', + 'itop-bridge-endusers-devices-services/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php b/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php index dbe9e282e..85c8843e1 100644 --- a/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php +++ b/datamodels/2.x/itop-bridge-storage-mgmt-services/module.itop-bridge-storage-mgmt-services.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-bridge-storage-mgmt-services/3.1.1', + 'itop-bridge-storage-mgmt-services/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php b/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php index f0cb2430a..40bb23dd5 100644 --- a/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php +++ b/datamodels/2.x/itop-bridge-virtualization-mgmt-services/module.itop-bridge-virtualization-mgmt-services.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-bridge-virtualization-mgmt-services/3.1.1', + 'itop-bridge-virtualization-mgmt-services/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php b/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php index 9acc72b06..3f2888dea 100644 --- a/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php +++ b/datamodels/2.x/itop-bridge-virtualization-storage/module.itop-bridge-virtualization-storage.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-bridge-virtualization-storage/3.1.1', + 'itop-bridge-virtualization-storage/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php b/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php index 63d03c65b..72b03f885 100755 --- a/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php +++ b/datamodels/2.x/itop-change-mgmt-itil/module.itop-change-mgmt-itil.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-change-mgmt-itil/3.1.1', + 'itop-change-mgmt-itil/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php b/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php index dcf9d7006..3993b90a1 100755 --- a/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php +++ b/datamodels/2.x/itop-change-mgmt/module.itop-change-mgmt.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-change-mgmt/3.1.1', + 'itop-change-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php b/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php index ffe4d7fe4..e2da1a77a 100755 --- a/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php +++ b/datamodels/2.x/itop-config-mgmt/module.itop-config-mgmt.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-config-mgmt/3.1.1', + 'itop-config-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-config/module.itop-config.php b/datamodels/2.x/itop-config/module.itop-config.php index f3e14cab8..490ca523c 100644 --- a/datamodels/2.x/itop-config/module.itop-config.php +++ b/datamodels/2.x/itop-config/module.itop-config.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-config/3.1.1', + 'itop-config/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-core-update/module.itop-core-update.php b/datamodels/2.x/itop-core-update/module.itop-core-update.php index 796931b85..191b76f88 100644 --- a/datamodels/2.x/itop-core-update/module.itop-core-update.php +++ b/datamodels/2.x/itop-core-update/module.itop-core-update.php @@ -24,7 +24,7 @@ /** @noinspection PhpUnhandledExceptionInspection */ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-core-update/3.1.1', + 'itop-core-update/3.1.2', [ // Identification // diff --git a/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php b/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php index 9b25c0ea7..fcdfbb2eb 100755 --- a/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php +++ b/datamodels/2.x/itop-datacenter-mgmt/module.itop-datacenter-mgmt.php @@ -18,7 +18,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-datacenter-mgmt/3.1.1', + 'itop-datacenter-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php b/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php index 0d38469cc..cfc050a58 100644 --- a/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php +++ b/datamodels/2.x/itop-endusers-devices/module.itop-endusers-devices.php @@ -25,7 +25,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-endusers-devices/3.1.1', + 'itop-endusers-devices/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-faq-light/module.itop-faq-light.php b/datamodels/2.x/itop-faq-light/module.itop-faq-light.php index a74a8d775..f7eb61d78 100755 --- a/datamodels/2.x/itop-faq-light/module.itop-faq-light.php +++ b/datamodels/2.x/itop-faq-light/module.itop-faq-light.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-faq-light/3.1.1', + 'itop-faq-light/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-files-information/module.itop-files-information.php b/datamodels/2.x/itop-files-information/module.itop-files-information.php index dc6095ea4..6de7def2f 100644 --- a/datamodels/2.x/itop-files-information/module.itop-files-information.php +++ b/datamodels/2.x/itop-files-information/module.itop-files-information.php @@ -24,7 +24,7 @@ /** @noinspection PhpUnhandledExceptionInspection */ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-files-information/3.1.1', + 'itop-files-information/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-full-itil/module.itop-full-itil.php b/datamodels/2.x/itop-full-itil/module.itop-full-itil.php index 0e30c7961..b474c37b4 100644 --- a/datamodels/2.x/itop-full-itil/module.itop-full-itil.php +++ b/datamodels/2.x/itop-full-itil/module.itop-full-itil.php @@ -6,7 +6,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-full-itil/3.1.1', + 'itop-full-itil/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php b/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php index 58359ee57..f9310e3c6 100644 --- a/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php +++ b/datamodels/2.x/itop-hub-connector/module.itop-hub-connector.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-hub-connector/3.1.1', + 'itop-hub-connector/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php b/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php index 9bbd8bb28..44ceb658a 100755 --- a/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php +++ b/datamodels/2.x/itop-incident-mgmt-itil/module.itop-incident-mgmt-itil.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-incident-mgmt-itil/3.1.1', + 'itop-incident-mgmt-itil/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php b/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php index 2aac9d15b..56aa7100b 100755 --- a/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php +++ b/datamodels/2.x/itop-knownerror-mgmt/module.itop-knownerror-mgmt.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-knownerror-mgmt/3.1.1', + 'itop-knownerror-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php index 575ac23cf..274abf043 100644 --- a/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-oauth-client/3.1.1', + 'itop-oauth-client/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-portal-base/module.itop-portal-base.php b/datamodels/2.x/itop-portal-base/module.itop-portal-base.php index b83d48139..b525c4066 100644 --- a/datamodels/2.x/itop-portal-base/module.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/module.itop-portal-base.php @@ -20,7 +20,7 @@ /** @noinspection PhpUnhandledExceptionInspection */ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-portal-base/3.1.1', array( + 'itop-portal-base/3.1.2', array( // Identification 'label' => 'Portal Development Library', 'category' => 'Portal', diff --git a/datamodels/2.x/itop-portal/module.itop-portal.php b/datamodels/2.x/itop-portal/module.itop-portal.php index a47f38fcf..c25490f73 100644 --- a/datamodels/2.x/itop-portal/module.itop-portal.php +++ b/datamodels/2.x/itop-portal/module.itop-portal.php @@ -20,7 +20,7 @@ /** @noinspection PhpUnhandledExceptionInspection */ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-portal/3.1.1', array( + 'itop-portal/3.1.2', array( // Identification 'label' => 'Enhanced Customer Portal', 'category' => 'Portal', diff --git a/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php b/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php index 5a553643c..794c4283b 100755 --- a/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php +++ b/datamodels/2.x/itop-problem-mgmt/module.itop-problem-mgmt.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-problem-mgmt/3.1.1', + 'itop-problem-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php b/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php index 8e1112c13..9d459dc39 100755 --- a/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php +++ b/datamodels/2.x/itop-profiles-itil/module.itop-profiles-itil.php @@ -19,7 +19,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-profiles-itil/3.1.1', + 'itop-profiles-itil/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php b/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php index 98721dba8..3924be16b 100755 --- a/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php +++ b/datamodels/2.x/itop-request-mgmt-itil/module.itop-request-mgmt-itil.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-request-mgmt-itil/3.1.1', + 'itop-request-mgmt-itil/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php b/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php index f8edc4536..a410b2812 100755 --- a/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php +++ b/datamodels/2.x/itop-request-mgmt/module.itop-request-mgmt.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-request-mgmt/3.1.1', + 'itop-request-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php b/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php index 79e9e3760..97856d4b6 100755 --- a/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php +++ b/datamodels/2.x/itop-service-mgmt-provider/module.itop-service-mgmt-provider.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-service-mgmt-provider/3.1.1', + 'itop-service-mgmt-provider/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php b/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php index 8a02d8beb..5637f039a 100755 --- a/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php +++ b/datamodels/2.x/itop-service-mgmt/module.itop-service-mgmt.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-service-mgmt/3.1.1', + 'itop-service-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php b/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php index 4e07c34ce..9ce63f965 100755 --- a/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php +++ b/datamodels/2.x/itop-sla-computation/module.itop-sla-computation.php @@ -18,7 +18,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-sla-computation/3.1.1', + 'itop-sla-computation/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php b/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php index bc7cd018a..903c98309 100644 --- a/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php +++ b/datamodels/2.x/itop-storage-mgmt/module.itop-storage-mgmt.php @@ -25,7 +25,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-storage-mgmt/3.1.1', + 'itop-storage-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-structure/module.itop-structure.php b/datamodels/2.x/itop-structure/module.itop-structure.php index 29b9756db..dcdf695f7 100644 --- a/datamodels/2.x/itop-structure/module.itop-structure.php +++ b/datamodels/2.x/itop-structure/module.itop-structure.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-structure/3.1.1', + 'itop-structure/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php b/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php index b4e20cebb..0474d3557 100644 --- a/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php +++ b/datamodels/2.x/itop-themes-compat/module.itop-themes-compat.php @@ -5,7 +5,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-themes-compat/3.1.1', + 'itop-themes-compat/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-tickets/module.itop-tickets.php b/datamodels/2.x/itop-tickets/module.itop-tickets.php index f8ec9847f..fb5c17353 100755 --- a/datamodels/2.x/itop-tickets/module.itop-tickets.php +++ b/datamodels/2.x/itop-tickets/module.itop-tickets.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, - 'itop-tickets/3.1.1', + 'itop-tickets/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php b/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php index 34dfc0dca..b877c6d14 100644 --- a/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php +++ b/datamodels/2.x/itop-virtualization-mgmt/module.itop-virtualization-mgmt.php @@ -16,7 +16,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-virtualization-mgmt/3.1.1', + 'itop-virtualization-mgmt/3.1.2', array( // Identification // diff --git a/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php index 288a89d9f..678af609e 100755 --- a/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/module.itop-welcome-itil.php @@ -3,7 +3,7 @@ SetupWebPage::AddModule( __FILE__, // Path to the current file, all other file names are relative to the directory containing this file - 'itop-welcome-itil/3.1.1', + 'itop-welcome-itil/3.1.2', array( // Identification // diff --git a/datamodels/2.x/version.xml b/datamodels/2.x/version.xml index c59edee46..12373f7be 100755 --- a/datamodels/2.x/version.xml +++ b/datamodels/2.x/version.xml @@ -1,4 +1,4 @@ - 3.1.1 + 3.1.2 From 3a4d9e64f8a4517683ce634db6a4f6571f37a1ea Mon Sep 17 00:00:00 2001 From: v-dumas Date: Thu, 10 Oct 2024 16:59:20 +0200 Subject: [PATCH 2/6] =?UTF-8?q?N=C2=B07886=20-=20Remove=20deprecated=20dat?= =?UTF-8?q?amodel=20methods=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datamodel.itop-incident-mgmt-itil.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml index 95d19d325..8eb8b994b 100755 --- a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml +++ b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml @@ -663,7 +663,10 @@ assigned - SetAssignedDate + SetCurrentDate + + assignment_date + From 75520bfaf9e28b5c2a541985e0ea140e878ba093 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Thu, 10 Oct 2024 17:59:50 +0200 Subject: [PATCH 3/6] =?UTF-8?q?N=C2=B07847=20-=20Extensions=20via=20interf?= =?UTF-8?q?ace=20not=20recognized=20N=C2=B07803=20-=20MTP=20from=20itophub?= =?UTF-8?q?/designer=20failing=20in=20itop=203.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/config.class.inc.php | 8 + .../Service/Cache/DataModelDependantCache.php | 23 ++- .../InterfaceDiscovery/InterfaceDiscovery.php | 168 +++++++++++++----- .../src/BaseTestCase/ItopTestCase.php | 30 +++- .../Cache/DataModelDependantCacheTest.php | 7 +- .../InterfaceDiscoveryTest.php | 75 ++++++-- 6 files changed, 243 insertions(+), 68 deletions(-) diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 6fb2d6ea8..ad1e210a0 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -1747,6 +1747,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ], + 'developer_mode.interface_cache.enabled' => [ + 'type' => 'bool', + 'description' => 'If true then InterfaceDiscovery uses dynamic cache (in developer_mode)', + 'default' => false, + 'value' => false, + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ], 'theme.enable_precompilation' => [ 'type' => 'bool', 'description' => 'If false, theme compilation will not use any precompiled file setup optimization.)', diff --git a/sources/Service/Cache/DataModelDependantCache.php b/sources/Service/Cache/DataModelDependantCache.php index 5a31de485..174903cef 100644 --- a/sources/Service/Cache/DataModelDependantCache.php +++ b/sources/Service/Cache/DataModelDependantCache.php @@ -23,16 +23,16 @@ class DataModelDependantCache { if (!isset(self::$oInstance)) { - self::$oInstance = new DataModelDependantCache(utils::GetCachePath()); + self::$oInstance = new DataModelDependantCache(); } return self::$oInstance; } private ?string $sStorageRootDir; // Nullable for test purposes - private function __construct($sStorageRootDir) + private function __construct() { - $this->sStorageRootDir = $sStorageRootDir; + $this->sStorageRootDir = null; } /** @@ -146,10 +146,25 @@ class DataModelDependantCache return $this->GetStorageRootDir()."/$sPool/"; } - /** Overridable for testing purposes */ + + /** + * for test purpose + * + * @return string + */ protected function GetStorageRootDir(): string { // Could be forced by tests return $this->sStorageRootDir ?? utils::GetCachePath(); } + + /** + * for test purpose + * + * @param string $sStorageRootDir + */ + public function SetStorageRootDir(?string $sStorageRootDir): void + { + $this->sStorageRootDir = $sStorageRootDir; + } } \ No newline at end of file diff --git a/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php b/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php index d786a69b9..22d13c031 100644 --- a/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php +++ b/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php @@ -6,24 +6,31 @@ use Combodo\iTop\Service\Cache\DataModelDependantCache; use Exception; use IssueLog; use LogChannels; +use MetaModel; use ReflectionClass; use utils; class InterfaceDiscovery { private static InterfaceDiscovery $oInstance; + private DataModelDependantCache $oCacheService; private ?array $aForcedClassMap = null; // For testing purposes + const CACHE_NONE = 'CACHE_NONE'; + const CACHE_DYNAMIC = 'CACHE_DYNAMIC'; + const CACHE_STATIC = 'CACHE_STATIC'; + private function __construct() { + $this->oCacheService = DataModelDependantCache::GetInstance(); } public static function GetInstance(): InterfaceDiscovery { - if (!isset(self::$oInstance)) - { + if (!isset(self::$oInstance)) { self::$oInstance = new InterfaceDiscovery(); } + return self::$oInstance; } @@ -36,6 +43,7 @@ class InterfaceDiscovery * @param array|null $aAdditionalExcludedPaths Optional list of paths to exclude from the search (partial names allowed, case sensitive, use / as separator) * * @return array of fully qualified class names + * @throws \ReflectionException when $sInterface is not an interface */ public function FindItopClasses(string $sInterface, ?array $aAdditionalExcludedPaths = null): array { @@ -44,14 +52,24 @@ class InterfaceDiscovery } $aExcludedPaths = array_merge(['/lib/', '/node_modules/', '/test/', '/tests/'], $aAdditionalExcludedPaths); + return $this->FindClasses($sInterface, $aExcludedPaths); } + /** + * @param string $sInterface + * @param array $aExcludedPaths + * + * @return array + * @throws \ReflectionException + */ private function FindClasses(string $sInterface, array $aExcludedPaths = []): array { - $sCacheUniqueKey = $this->MakeCacheKey($sInterface, $aExcludedPaths); - if ($this->IsCacheValid($sCacheUniqueKey)) { - return $this->ReadClassesFromCache($sCacheUniqueKey); + if ($this->GetCacheMode() !== self::CACHE_NONE) { + $sCacheUniqueKey = $this->MakeCacheKey($sInterface, $aExcludedPaths); + if ($this->IsCacheValid($sCacheUniqueKey)) { + return $this->ReadClassesFromCache($sCacheUniqueKey); + } } $sExcludedPathsRegExp = $this->GetExcludedPathsRegExp($aExcludedPaths); @@ -66,40 +84,65 @@ class InterfaceDiscovery } } - $this->SaveClassesToCache($sCacheUniqueKey, $aMatchingClasses, ['Interface' => $sInterface, 'Excluded paths' => implode(',', $aExcludedPaths)]); + if ($this->GetCacheMode() !== self::CACHE_NONE) { + $this->SaveClassesToCache($sCacheUniqueKey, $aMatchingClasses, ['Interface' => $sInterface, 'Excluded paths' => implode(',', $aExcludedPaths)]); + } return $aMatchingClasses; } + private function GetAutoloadClassMaps(): array { - $oCacheService = DataModelDependantCache::GetInstance(); - - $aAutoloadClassMaps = $oCacheService->Fetch('InterfaceDiscovery', 'autoload_classmaps'); - if ($aAutoloadClassMaps !== null) { - return $aAutoloadClassMaps; + if ($this->GetCacheMode() === self::CACHE_DYNAMIC) { + $aAutoloadClassMaps = $this->oCacheService->Fetch('InterfaceDiscovery', 'autoload_classmaps'); + if ($aAutoloadClassMaps !== null) { + return $aAutoloadClassMaps; + } } // guess all the autoload class maps from the extensions $aAutoloadClassMaps = glob(APPROOT.'env-'.utils::GetCurrentEnvironment().'/*/vendor/composer/autoload_classmap.php'); $aAutoloadClassMaps[] = APPROOT.'lib/composer/autoload_classmap.php'; - $oCacheService->Store('InterfaceDiscovery', 'autoload_classmaps', $aAutoloadClassMaps); + if ($this->GetCacheMode() === self::CACHE_DYNAMIC) { + $this->oCacheService->Store('InterfaceDiscovery', 'autoload_classmaps', $aAutoloadClassMaps); + } + return $aAutoloadClassMaps; } + /** + * @param string $sPHPClass + * @param string $sInterface + * + * @return bool + * + * @throws \ReflectionException + */ private function IsInterfaceImplementation(string $sPHPClass, string $sInterface): bool { try { $oRefClass = new ReflectionClass($sPHPClass); - } catch (Exception $e) { + } + catch (Exception $e) { return false; } - if (!$oRefClass->implementsInterface($sInterface)) return false; - if ($oRefClass->isInterface()) return false; - if ($oRefClass->isAbstract()) return false; - if ($oRefClass->isTrait()) return false; - if ($oRefClass->getName() !== $sPHPClass) return false; // Skip aliases + if (!$oRefClass->implementsInterface($sInterface)) { + return false; + } + if ($oRefClass->isInterface()) { + return false; + } + if ($oRefClass->isAbstract()) { + return false; + } + if ($oRefClass->isTrait()) { + return false; + } + if ($oRefClass->getName() !== $sPHPClass) { + return false; + } // Skip aliases return true; } @@ -110,8 +153,7 @@ class InterfaceDiscovery $aAutoloaderErrors = []; if ($this->aForcedClassMap !== null) { $aClassMap = $this->aForcedClassMap; - } - else { + } else { foreach ($this->GetAutoloadClassMaps() as $sAutoloadFile) { if (false === utils::RealPath($sAutoloadFile, APPROOT)) { // can happen when we still have the autoloader symlink in env-*, but it points to a file that no longer exists @@ -140,12 +182,18 @@ class InterfaceDiscovery private function IsValidPHPFile(string $sOptionalPHPFile, ?string $sExcludedPathsRegExp): bool { - if ($sOptionalPHPFile === '') return true; + if ($sOptionalPHPFile === '') { + return true; + } $sOptionalPHPFile = utils::LocalPath($sOptionalPHPFile); - if ($sOptionalPHPFile === false) return false; + if ($sOptionalPHPFile === false) { + return false; + } - if (is_null($sExcludedPathsRegExp)) return true; + if (is_null($sExcludedPathsRegExp)) { + return true; + } if (preg_match($sExcludedPathsRegExp, '/'.$sOptionalPHPFile) === 1) { return false; @@ -156,42 +204,51 @@ class InterfaceDiscovery private function IsCacheValid(string $sKey): bool { - if ($this->aForcedClassMap !== null) return false; + if ($this->aForcedClassMap !== null) { + return false; + } - $oCacheService = DataModelDependantCache::GetInstance(); + if (!$this->oCacheService->HasEntry('InterfaceDiscovery', $sKey)) { + return false; + } - if (!$oCacheService->HasEntry('InterfaceDiscovery', $sKey)) return false; - - if (!utils::IsDevelopmentEnvironment()) return true; + if ($this->GetCacheMode() === self::CACHE_STATIC) { + return true; + } // On development environment, we check the cache validity by comparing the cache file with the autoload_classmap files - $iCacheTime = $oCacheService->GetEntryModificationTime('InterfaceDiscovery', $sKey); - foreach($this->GetAutoloadClassMaps() as $sSourceFile) { + $iCacheTime = $this->oCacheService->GetEntryModificationTime('InterfaceDiscovery', $sKey); + foreach ($this->GetAutoloadClassMaps() as $sSourceFile) { $iSourceTime = filemtime($sSourceFile); - if ($iSourceTime > $iCacheTime) return false; + if ($iSourceTime > $iCacheTime) { + return false; + } } + return true; } public function ReadClassesFromCache(string $sKey): array { - $oCacheService = DataModelDependantCache::GetInstance(); - return $oCacheService->Fetch('InterfaceDiscovery', $sKey); + return $this->oCacheService->Fetch('InterfaceDiscovery', $sKey); } protected function SaveClassesToCache(string $sKey, array $aMatchingClasses, array $aMoreInfo): void { - if ($this->aForcedClassMap !== null) return; + if ($this->aForcedClassMap !== null) { + return; + } - $oCacheService = DataModelDependantCache::GetInstance(); - $oCacheService->Store('InterfaceDiscovery', $sKey, $aMatchingClasses, $aMoreInfo); + $this->oCacheService->Store('InterfaceDiscovery', $sKey, $aMatchingClasses, $aMoreInfo); } - private function GetExcludedPathsRegExp(array $aExcludedPaths) : ?string + private function GetExcludedPathsRegExp(array $aExcludedPaths): ?string { - if (count($aExcludedPaths) == 0) return null; + if (count($aExcludedPaths) == 0) { + return null; + } - $aExcludedPathRegExps = array_map(function($sPath) { + $aExcludedPathRegExps = array_map(function ($sPath) { return preg_quote($sPath, '#'); }, $aExcludedPaths); @@ -200,7 +257,36 @@ class InterfaceDiscovery protected function MakeCacheKey(string $sInterface, array $aExcludedPaths): string { - if (count($aExcludedPaths) == 0) return $sInterface; - return md5($sInterface.':'.implode(',', $aExcludedPaths)); + if (count($aExcludedPaths) == 0) { + $sKey = $sInterface; + } else { + $sKey = $sInterface.':'.implode(',', $aExcludedPaths); + } + + $iPos = strrpos($sInterface, '\\'); + $sInterfaceDisplayName = $iPos === false ? $sInterface : substr($sInterface, $iPos + 1); + + return md5($sKey)."-$sInterfaceDisplayName"; + } + + /** + * @param \Combodo\iTop\Service\Cache\DataModelDependantCache $this->oCacheService + */ + public function SetCacheService(DataModelDependantCache $oCacheService): void + { + $this->oCacheService = $oCacheService; + } + + protected function GetCacheMode(): string + { + if (!utils::IsDevelopmentEnvironment()) { + return self::CACHE_STATIC; + } + + if (MetaModel::GetConfig()->Get('developer_mode.interface_cache.enabled')) { + return self::CACHE_DYNAMIC; + } + + return self::CACHE_NONE; } } \ No newline at end of file diff --git a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php index eb3f0e9bb..30366a4b5 100644 --- a/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php +++ b/tests/php-unit-tests/src/BaseTestCase/ItopTestCase.php @@ -507,20 +507,38 @@ abstract class ItopTestCase extends TestCase * * @since 3.2.0 */ - protected function AssertArraysHaveSameItems(array $aExpectedClasses, array $aClasses, string $sMessage = ''): void + protected function AssertArraysHaveSameItems(array $aExpected, array $aActual, string $sMessage = ''): void { - sort($aClasses); - sort($aExpectedClasses); + sort($aActual); + sort($aExpected); - $sExpected = implode("\n", $aExpectedClasses); - $sActual = implode("\n", $aClasses); + $sExpected = implode("\n", $aExpected); + $sActual = implode("\n", $aActual); if ($sExpected === $sActual) { $this->assertTrue(true); return; } $sMessage .= "\nExpected:\n$sExpected\nActual:\n$sActual"; - var_export($aClasses); + var_export($aActual); $this->fail($sMessage); } + + /** + * The order of the files is not important + * + * @since 3.2.1 + */ + public function AssertDirectoryListingEquals(array $aExpected, string $sDir, string $sMessage = ''): void + { + $aFiles = []; + + foreach (scandir($sDir) as $sFile) { + if ($sFile !== '.' && $sFile !== '..') { + $aFiles[] = basename($sFile); + } + } + + $this->AssertArraysHaveSameItems($aExpected, $aFiles, $sMessage); + } } diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php index 4561816a0..f2db4c38a 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/Cache/DataModelDependantCacheTest.php @@ -4,7 +4,6 @@ namespace Combodo\iTop\Test\UnitTest\Service\Cache; use Combodo\iTop\Service\Cache\DataModelDependantCache; use Combodo\iTop\Test\UnitTest\ItopTestCase; -use Exception; class DataModelDependantCacheTest extends ItopTestCase { @@ -19,12 +18,12 @@ class DataModelDependantCacheTest extends ItopTestCase $this->sCacheRootDir = self::CreateTmpdir(); $this->oCacheService = DataModelDependantCache::GetInstance(); - $this->SetNonPublicProperty($this->oCacheService, 'sStorageRootDir', $this->sCacheRootDir); + $this->oCacheService->SetStorageRootDir($this->sCacheRootDir); } protected function tearDown(): void { - $this->SetNonPublicProperty($this->oCacheService, 'sStorageRootDir', null); + $this->oCacheService->SetStorageRootDir(null); self::RecurseRmdir($this->sCacheRootDir); parent::tearDown(); @@ -50,7 +49,7 @@ class DataModelDependantCacheTest extends ItopTestCase public function testShouldStoreInADirectoryRebuiltOnCompilation(): void { // Given the storage is reset to the default - $this->SetNonPublicProperty($this->oCacheService, 'sStorageRootDir', null); + $this->oCacheService->SetStorageRootDir(null); // Then $sFilePath = $this->InvokeNonPublicMethod(DataModelDependantCache::class, 'MakeCacheFileName', $this->oCacheService, ['pool-A', 'key']); diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php index 912da490b..e3c8289a4 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php @@ -3,22 +3,38 @@ namespace Combodo\iTop\Test\UnitTest\Service\InterfaceDiscovery; use Combodo\iTop\Application\UI\Base\iUIBlockFactory; +use Combodo\iTop\Service\Cache\DataModelDependantCache; use Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery; use Combodo\iTop\Test\UnitTest\ItopDataTestCase; +use MetaModel; class InterfaceDiscoveryTest extends ItopDataTestCase { + private InterfaceDiscovery $oInterfaceDiscovery; + private string $sCacheRootDir; + private DataModelDependantCache $oCacheService; + + protected function setUp(): void + { + parent::setUp(); + $this->oInterfaceDiscovery = InterfaceDiscovery::GetInstance(); + $this->sCacheRootDir = self::CreateTmpdir(); + $this->oCacheService = DataModelDependantCache::GetInstance(); + $this->oCacheService->SetStorageRootDir($this->sCacheRootDir); + $this->oInterfaceDiscovery->SetCacheService($this->oCacheService); + } + protected function tearDown(): void { $this->SetNonPublicProperty(InterfaceDiscovery::GetInstance(), 'aForcedClassMap', null); + $this->oCacheService->SetStorageRootDir(null); + self::RecurseRmdir($this->sCacheRootDir); parent::tearDown(); } public function testShouldSelectTheRequestedItopClasses() { - $oInterfaceDiscoveryService = InterfaceDiscovery::GetInstance(); - - $this->GivenClassMap($oInterfaceDiscoveryService, [ + $this->GivenClassMap([ 'Combodo\iTop\Application\UI\Base\Component\Alert\Alert' => APPROOT . '/sources/Application/UI/Base/Component/Alert/Alert.php', 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/ButtonGroup/ButtonGroupUIBlockFactory.php', @@ -29,29 +45,26 @@ class InterfaceDiscoveryTest extends ItopDataTestCase 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory', 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory', ], - $oInterfaceDiscoveryService->FindItopClasses(iUIBlockFactory::class) + $this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class) ); } public function testShouldExcludeSpecifiedDirectories() { - $oInterfaceDiscoveryService = InterfaceDiscovery::GetInstance(); - $this->GivenClassMap($oInterfaceDiscoveryService, [ + $this->GivenClassMap([ 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/ButtonGroup/ButtonGroupUIBlockFactory.php', ]); $this->AssertArraysHaveSameItems( [], - $oInterfaceDiscoveryService->FindItopClasses(iUIBlockFactory::class, ['Component/ButtonGroup', '/Alert/']) + $this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class, ['Component/ButtonGroup', '/Alert/']) ); } public function testShouldExcludeAliases() { - $oInterfaceDiscoveryService = InterfaceDiscovery::GetInstance(); - - $this->GivenClassMap($oInterfaceDiscoveryService, [ + $this->GivenClassMap([ 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', 'AlbertIsBlockingTheFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', ]); @@ -62,12 +75,48 @@ class InterfaceDiscoveryTest extends ItopDataTestCase [ 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory', ], - $oInterfaceDiscoveryService->FindItopClasses(iUIBlockFactory::class) + $this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class) ); } - private function GivenClassMap(InterfaceDiscovery $oInterfaceDiscoveryService, array $aClassMap): void + public function testShouldNotProduceCacheForDevelopers() { - $this->SetNonPublicProperty($oInterfaceDiscoveryService, 'aForcedClassMap', $aClassMap); + DataModelDependantCache::GetInstance()->Clear('InterfaceDiscovery'); + + MetaModel::GetConfig()->Set('developer_mode.enabled', true); + MetaModel::GetConfig()->Set('developer_mode.interface_cache.enabled', false); + + $this->assertGreaterThan(0, count($this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class))); + $this->assertFileDoesNotExist($this->sCacheRootDir.'/InterfaceDiscovery'); + } + + public function testShouldProduceDynamicCacheForDevelopersWillingTo() + { + DataModelDependantCache::GetInstance()->Clear('InterfaceDiscovery'); + + MetaModel::GetConfig()->Set('developer_mode.enabled', true); + MetaModel::GetConfig()->Set('developer_mode.interface_cache.enabled', true); + + $this->assertGreaterThan(0, count($this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class))); + $this->AssertDirectoryListingEquals([ + 'autoload_classmaps.php', + '310db363d8e32bfcf57cbb3800912ea2_iUIBlockFactory.php' + ], + $this->sCacheRootDir.'/InterfaceDiscovery'); + } + + public function testShouldProduceStaticCacheForProduction() + { + DataModelDependantCache::GetInstance()->Clear('InterfaceDiscovery'); + + MetaModel::GetConfig()->Set('developer_mode.enabled', false); + + $this->assertGreaterThan(0, count($this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class))); + $this->AssertDirectoryListingEquals(['310db363d8e32bfcf57cbb3800912ea2_iUIBlockFactory.php'], $this->sCacheRootDir.'/InterfaceDiscovery'); + } + + private function GivenClassMap(array $aClassMap): void + { + $this->SetNonPublicProperty($this->oInterfaceDiscovery, 'aForcedClassMap', $aClassMap); } } From 6c8388ea5e4f5256c2af02cd5c45d49e40c0ef8f Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Fri, 11 Oct 2024 10:02:03 +0200 Subject: [PATCH 4/6] =?UTF-8?q?N=C2=B07847=20-=20Extensions=20via=20interf?= =?UTF-8?q?ace=20not=20recognized=20N=C2=B07803=20-=20MTP=20from=20itophub?= =?UTF-8?q?/designer=20failing=20in=20itop=203.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/metamodel.class.php | 2 ++ .../Service/Cache/DataModelDependantCache.php | 2 +- .../InterfaceDiscovery/InterfaceDiscovery.php | 25 ++++++++++++------- .../InterfaceDiscoveryTest.php | 13 ---------- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/core/metamodel.class.php b/core/metamodel.class.php index 5f1d0c833..8f9808cc2 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -7477,6 +7477,8 @@ abstract class MetaModel * @param string|null $sFilterInstanceOf [optional] if given, only instance of this string will be returned * * @return array classes=>instance implementing the given interface + * + * @see \Combodo\iTop\Service\InterfaceDiscovery\InterfaceDiscovery::FindItopClasses() to add extensibility to modules */ public static function EnumPlugins($sInterface, $sFilterInstanceOf = null) { diff --git a/sources/Service/Cache/DataModelDependantCache.php b/sources/Service/Cache/DataModelDependantCache.php index 174903cef..7fc98ef05 100644 --- a/sources/Service/Cache/DataModelDependantCache.php +++ b/sources/Service/Cache/DataModelDependantCache.php @@ -161,7 +161,7 @@ class DataModelDependantCache /** * for test purpose * - * @param string $sStorageRootDir + * @param string|null $sStorageRootDir if null the current cache path is used */ public function SetStorageRootDir(?string $sStorageRootDir): void { diff --git a/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php b/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php index 22d13c031..77a5688cd 100644 --- a/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php +++ b/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php @@ -10,6 +10,13 @@ use MetaModel; use ReflectionClass; use utils; +/** + * Enumerate classes implementing given interfaces + * + * @api + * + * @since 3.2.0 + */ class InterfaceDiscovery { private static InterfaceDiscovery $oInstance; @@ -17,8 +24,8 @@ class InterfaceDiscovery private ?array $aForcedClassMap = null; // For testing purposes const CACHE_NONE = 'CACHE_NONE'; - const CACHE_DYNAMIC = 'CACHE_DYNAMIC'; - const CACHE_STATIC = 'CACHE_STATIC'; + const CACHE_DYNAMIC = 'CACHE_DYNAMIC'; // rebuild cache when files changes + const CACHE_STATIC = 'CACHE_STATIC'; // Built once at setup private function __construct() { @@ -38,20 +45,20 @@ class InterfaceDiscovery * Find the ITOP classes implementing a given interface. The returned classes have the following properties: * - They can be instantiated * - They are not aliases + * - Their path relative to iTop does not contain /lib/, /node_modules/, /test/ or /tests/ * * @param string $sInterface Fully qualified interface name - * @param array|null $aAdditionalExcludedPaths Optional list of paths to exclude from the search (partial names allowed, case sensitive, use / as separator) * * @return array of fully qualified class names * @throws \ReflectionException when $sInterface is not an interface + * + * @api + * + * @since 3.2.0 */ - public function FindItopClasses(string $sInterface, ?array $aAdditionalExcludedPaths = null): array + public function FindItopClasses(string $sInterface): array { - if (is_null($aAdditionalExcludedPaths)) { - return $this->FindClasses($sInterface, ['/lib/', '/node_modules/', '/test/', '/tests/']); - } - - $aExcludedPaths = array_merge(['/lib/', '/node_modules/', '/test/', '/tests/'], $aAdditionalExcludedPaths); + $aExcludedPaths = ['/lib/', '/node_modules/', '/test/', '/tests/']; return $this->FindClasses($sInterface, $aExcludedPaths); } diff --git a/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php b/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php index e3c8289a4..6695dc4b3 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Service/InterfaceDiscovery/InterfaceDiscoveryTest.php @@ -49,19 +49,6 @@ class InterfaceDiscoveryTest extends ItopDataTestCase ); } - public function testShouldExcludeSpecifiedDirectories() - { - - $this->GivenClassMap([ - 'Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/Alert/AlertUIBlockFactory.php', - 'Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory' => APPROOT . '/sources/Application/UI/Base/Component/ButtonGroup/ButtonGroupUIBlockFactory.php', - ]); - - $this->AssertArraysHaveSameItems( - [], - $this->oInterfaceDiscovery->FindItopClasses(iUIBlockFactory::class, ['Component/ButtonGroup', '/Alert/']) - ); - } public function testShouldExcludeAliases() { $this->GivenClassMap([ From 4a78f8fb436122ade9009496664e62a190acd578 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Fri, 11 Oct 2024 11:01:02 +0200 Subject: [PATCH 5/6] =?UTF-8?q?N=C2=B07847=20-=20Extensions=20via=20interf?= =?UTF-8?q?ace=20not=20recognized=20N=C2=B07803=20-=20MTP=20from=20itophub?= =?UTF-8?q?/designer=20failing=20in=20itop=203.2.0=20Fix=20setup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/Service/InterfaceDiscovery/InterfaceDiscovery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php b/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php index 77a5688cd..0568af58d 100644 --- a/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php +++ b/sources/Service/InterfaceDiscovery/InterfaceDiscovery.php @@ -290,7 +290,7 @@ class InterfaceDiscovery return self::CACHE_STATIC; } - if (MetaModel::GetConfig()->Get('developer_mode.interface_cache.enabled')) { + if (!is_null(MetaModel::GetConfig()) && MetaModel::GetConfig()->Get('developer_mode.interface_cache.enabled')) { return self::CACHE_DYNAMIC; } From 88756a443a8f52e1f0678a1acac2e4b7ab3e1cc8 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Mon, 14 Oct 2024 09:25:05 +0200 Subject: [PATCH 6/6] Fix event listeners display when the listener is a static method --- pages/schema.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pages/schema.php b/pages/schema.php index a12fe92ee..968a2907d 100644 --- a/pages/schema.php +++ b/pages/schema.php @@ -343,6 +343,8 @@ function DisplayEvents(WebPage $oPage, $sClass) } } $sListener = $sListenerClass.'->'.$aListener['callback'][1].'(\Combodo\iTop\Service\Events\EventData $oEventData)'; + } else if (is_array($aListener['callback'])) { + $sListener = $aListener['callback'][0].'::'.$aListener['callback'][1]; } else { $sListener = $aListener['callback'].'(\Combodo\iTop\Service\Events\EventData $oEventData)'; }