From 663df023890fa88e342dfb61017d0e596187dad0 Mon Sep 17 00:00:00 2001 From: christianbeeznst Date: Wed, 28 Aug 2024 12:54:59 -0500 Subject: [PATCH] Internal: Add variable settings to .env.dist and plugin.yaml import - refs #5316 --- .env.dist | 4 ++++ config/plugin.yaml | 8 ++++++++ config/services.yaml | 7 ++++--- public/main/inc/ajax/admin.ajax.php | 5 +---- public/main/inc/lib/template.lib.php | 4 ++-- public/main/install/index.php | 4 ++++ public/main/install/install.lib.php | 4 ++++ .../DataFixtures/SettingsCurrentFixtures.php | 15 --------------- 8 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 config/plugin.yaml diff --git a/.env.dist b/.env.dist index 88c3bbbe289..6500a311b19 100644 --- a/.env.dist +++ b/.env.dist @@ -69,3 +69,7 @@ SOFTWARE_NAME='{{SOFTWARE_NAME}}' SOFTWARE_URL='{{SOFTWARE_URL}}' DENY_DELETE_USERS='{{DENY_DELETE_USERS}}' HOSTING_TOTAL_SIZE_LIMIT='{{HOSTING_TOTAL_SIZE_LIMIT}}' +THEME_FALLBACK='{{THEME_FALLBACK}}' +PACKAGER='{{PACKAGER}}' +DEFAULT_TEMPLATE='{{DEFAULT_TEMPLATE}}' +ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE='{{ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE}}' diff --git a/config/plugin.yaml b/config/plugin.yaml new file mode 100644 index 00000000000..ec1ab6edb3e --- /dev/null +++ b/config/plugin.yaml @@ -0,0 +1,8 @@ +parameters: + plugin_settings: + urls: + 1: + plugin_name: 'bbb' + tool_enable: 'true' + host: 'https://www.example.com' + salt: 'abc123' diff --git a/config/services.yaml b/config/services.yaml index c59c8c1d4ec..ae8d784a147 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -115,7 +115,8 @@ cocur_slugify: lowercase: true imports: - - {resource: ../src/CoreBundle/Resources/config/services.yml} - - {resource: ../src/LtiBundle/Resources/config/services.yml} + - { resource: ../src/CoreBundle/Resources/config/services.yml } + - { resource: ../src/LtiBundle/Resources/config/services.yml } - { resource: ./authentication.yaml } - - {resource: ./hosting_limits.yml} + - { resource: ./hosting_limits.yml } + - { resource: ./plugin.yaml } diff --git a/public/main/inc/ajax/admin.ajax.php b/public/main/inc/ajax/admin.ajax.php index 8399696e216..60116ea4327 100644 --- a/public/main/inc/ajax/admin.ajax.php +++ b/public/main/inc/ajax/admin.ajax.php @@ -178,10 +178,7 @@ function check_system_version() // The number of sessions $number_of_sessions = SessionManager::count_sessions(api_get_current_access_url_id()); - $packager = api_get_setting('platform.packager'); - if (empty($packager)) { - $packager = 'chamilo'; - } + $packager = api_get_env_variable('PACKAGER', 'chamilo'); $uniqueId = ''; $entityManager = Database::getManager(); diff --git a/public/main/inc/lib/template.lib.php b/public/main/inc/lib/template.lib.php index 7c0124a794f..daf445b8705 100644 --- a/public/main/inc/lib/template.lib.php +++ b/public/main/inc/lib/template.lib.php @@ -136,7 +136,7 @@ public function __construct( //$this->set_footer($show_footer); //$this->set_header($show_header); - $defaultStyle = api_get_setting('display.default_template'); + $defaultStyle = api_get_env_variable('DEFAULT_TEMPLATE', 'default'); if (!empty($defaultStyle)) { $this->templateFolder = $defaultStyle; } @@ -386,7 +386,7 @@ public static function findTemplateFilePath($name) return "overrides/$name"; } - $defaultFolder = api_get_configuration_value('default_template'); + $defaultFolder = api_get_env_variable('DEFAULT_TEMPLATE', 'default'); // If a template folder has been manually defined, search for the right // file, and if not found, go for the same file in the default template diff --git a/public/main/install/index.php b/public/main/install/index.php index 7b9dffebbfa..ba162adf48b 100644 --- a/public/main/install/index.php +++ b/public/main/install/index.php @@ -484,6 +484,10 @@ '{{SOFTWARE_URL}}' => $institutionUrlForm, '{{DENY_DELETE_USERS}}' => '0', '{{HOSTING_TOTAL_SIZE_LIMIT}}' => '0', + '{{THEME_FALLBACK}}' => 'chamilo', + '{{PACKAGER}}' => 'chamilo', + '{{DEFAULT_TEMPLATE}}' => 'default', + '{{ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE}}' => '0', ]; error_log('Update env file'); updateEnvFile($distFile, $envFile, $params); diff --git a/public/main/install/install.lib.php b/public/main/install/install.lib.php index ee539b2a249..d91d8be6a19 100644 --- a/public/main/install/install.lib.php +++ b/public/main/install/install.lib.php @@ -1346,6 +1346,10 @@ function updateEnvFile($distFile, $envFile, $params) 'SOFTWARE_URL', 'DENY_DELETE_USERS', 'HOSTING_TOTAL_SIZE_LIMIT', + 'THEME_FALLBACK', + 'PACKAGER', + 'DEFAULT_TEMPLATE', + 'ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE', ]; foreach ($requirements as $requirement) { diff --git a/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php b/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php index 6ecac42bc71..5735e9eae0d 100644 --- a/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php +++ b/src/CoreBundle/DataFixtures/SettingsCurrentFixtures.php @@ -1641,11 +1641,6 @@ public static function getNewConfigurationSettings(): array ], ], 'admin' => [ - [ - 'name' => 'admin_chamilo_announcements_disable', - 'title' => 'Disable editor announcements', - 'comment' => "Choose 'Yes' to stop announcements from the software editor to appear on the administrative homepage (only admins see it). This will also remove security update announcements.", - ], [ 'name' => 'drh_allow_access_to_all_students', 'title' => 'HRM can access all students from reporting pages', @@ -1871,11 +1866,6 @@ public static function getNewConfigurationSettings(): array 'title' => 'Bug report link', 'comment' => 'Provide link to a bug reporting platform if not using the internal ticket manager.', ], - [ - 'name' => 'default_template', - 'title' => 'Layout template', - 'comment' => 'Provide the name of the template folder from main/template/ to change the appearance and structure of this portal.', - ], [ 'name' => 'disable_copy_paste', 'title' => 'Disable copy-pasting', @@ -1962,11 +1952,6 @@ public static function getNewConfigurationSettings(): array ], ], 'platform' => [ - [ - 'name' => 'default_template', - 'title' => 'Layout template', - 'comment' => 'Provide the name of the template folder from main/template/ to change the appearance and structure of this portal.', - ], [ 'name' => 'allow_double_validation_in_registration', 'title' => 'Double validation for registration process',