From e3723cb468c85cd7ddc2dd73b772b65bdcad228a Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 8 Sep 2022 18:49:23 -0700 Subject: [PATCH] Settings - Define 'ext_max_depth' --- CRM/Admin/Form/Setting/Path.php | 1 + CRM/Extension/System.php | 3 +++ Civi/Core/SettingsManager.php | 1 + settings/Extension.setting.php | 20 ++++++++++++++++++++ templates/CRM/Admin/Form/Setting/Path.tpl | 6 ++++++ 5 files changed, 31 insertions(+) diff --git a/CRM/Admin/Form/Setting/Path.php b/CRM/Admin/Form/Setting/Path.php index 19c4de7023..e30462e347 100644 --- a/CRM/Admin/Form/Setting/Path.php +++ b/CRM/Admin/Form/Setting/Path.php @@ -27,6 +27,7 @@ class CRM_Admin_Form_Setting_Path extends CRM_Admin_Form_Setting { 'customTemplateDir' => CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME, 'customPHPPathDir' => CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME, 'extensionsDir' => CRM_Core_BAO_Setting::DIRECTORY_PREFERENCES_NAME, + 'ext_max_depth' => CRM_Core_BAO_Setting::EXT, ]; /** diff --git a/CRM/Extension/System.php b/CRM/Extension/System.php index 4361314395..32d6cb6437 100644 --- a/CRM/Extension/System.php +++ b/CRM/Extension/System.php @@ -17,6 +17,9 @@ * @copyright CiviCRM LLC https://civicrm.org/licensing */ class CRM_Extension_System { + + public const DEFAULT_MAX_DEPTH = 4; + private static $singleton; private $cache = NULL; diff --git a/Civi/Core/SettingsManager.php b/Civi/Core/SettingsManager.php index 1bd096758a..1b1cdd50e9 100644 --- a/Civi/Core/SettingsManager.php +++ b/Civi/Core/SettingsManager.php @@ -351,6 +351,7 @@ class SettingsManager { 'imageUploadURL' => '[civicrm.files]/persist/contribute/', 'extensionsDir' => '[civicrm.files]/ext/', 'extensionsURL' => '[civicrm.files]/ext/', + 'ext_max_depth' => \CRM_Extension_System::DEFAULT_MAX_DEPTH, 'resourceBase' => '[civicrm.root]/', 'userFrameworkResourceURL' => '[civicrm.root]/', ]; diff --git a/settings/Extension.setting.php b/settings/Extension.setting.php index 180eff4564..510b515023 100644 --- a/settings/Extension.setting.php +++ b/settings/Extension.setting.php @@ -36,4 +36,24 @@ return [ 'is_contact' => 0, 'help_text' => '', ], + 'ext_max_depth' => [ + 'bootstrap_comment' => 'This is a boot setting which may be loaded during bootstrap. Defaults are loaded via SettingsBag::getSystemDefaults().', + 'group_name' => 'Extension Preferences', + 'group' => 'ext', + 'name' => 'ext_max_depth', + 'type' => 'Integer', + 'quick_form_type' => 'Element', + 'html_type' => 'text', + 'html_attributes' => [ + 'size' => 4, + 'maxlength' => 8, + ], + 'default' => NULL, + 'add' => '5.55', + 'title' => ts('Extension Depth'), + 'is_domain' => 1, + 'is_contact' => 0, + 'description' => ts('Maximum number of sub-directories to search when looking for extensions'), + 'help_text' => NULL, + ], ]; diff --git a/templates/CRM/Admin/Form/Setting/Path.tpl b/templates/CRM/Admin/Form/Setting/Path.tpl index 98c6597244..b8fe2e067f 100644 --- a/templates/CRM/Admin/Form/Setting/Path.tpl +++ b/templates/CRM/Admin/Form/Setting/Path.tpl @@ -56,6 +56,12 @@ {ts}Path where CiviCRM extensions are stored.{/ts} + + {$form.ext_max_depth.label} + {$form.ext_max_depth.html}
+ {ts}When searching for extensions, limit the number of subdirectories.{/ts} + +
{include file="CRM/common/formButtons.tpl" location="bottom"}
-- 2.25.1