Parcourir la source

Remove unused config settings #2682

Julio il y a 6 ans
Parent
commit
f36cf60988

+ 0 - 1
.codeclimate.yml

@@ -64,7 +64,6 @@ plugins:
 exclude_patterns:
   - var/cache/
   - var/log/
-  - app/config/
   - config/
   - app/SymfonyRequirements.php
   - app/Migrations/

+ 1 - 1
main/announcements/announcements.php

@@ -539,7 +539,7 @@ switch ($action) {
             $form->addCheckBox('send_to_users_in_session', null, get_lang('SendToUsersInSessions'));
         }
 
-        $config = api_get_configuration_value('announcements_hide_send_to_hrm_users');
+        $config = api_get_configuration_value('announcement.hide_send_to_hrm_users');
 
         if ($config === false) {
             $form->addCheckBox('send_to_hrm_users', null, get_lang('SendAnnouncementCopyToDRH'));

+ 1 - 1
main/document/document.php

@@ -399,7 +399,7 @@ switch ($action) {
                 $orientation = in_array($certificateOrientation, ['landscape', 'portrait'])
                     ? $certificateOrientation
                     : 'landscape';
-                $showHeaderAndFooter = !api_get_configuration_value('hide_header_footer_in_certificate');
+                $showHeaderAndFooter = !api_get_configuration_value('certificate.hide_header_footer') === 'true';
             }
 
             DocumentManager::export_to_pdf($document_id, $course_code, $orientation, $showHeaderAndFooter);

+ 1 - 1
main/exercise/exercise.class.php

@@ -216,7 +216,7 @@ class Exercise
                 $this->lpList = Database::store_result($result, 'ASSOC');
             }
 
-            $this->force_edit_exercise_in_lp = api_get_configuration_value('force_edit_exercise_in_lp');
+            $this->force_edit_exercise_in_lp = api_get_setting('lp.show_invisible_exercise_in_lp_toc') === 'true';
 
             if ($this->exercise_was_added_in_lp) {
                 $this->edit_exercise_in_lp = $this->force_edit_exercise_in_lp == true;

+ 1 - 1
main/inc/lib/api.lib.php

@@ -8436,7 +8436,7 @@ function api_warn_hosting_contact($limitName)
 }
 
 /**
- * Gets value of a variable from app/config/configuration.php
+ * Gets value of a variable from config/configuration.php
  * Variables that are not set in the configuration.php file but set elsewhere:
  * - virtual_css_theme_folder (vchamilo plugin)
  * - access_url (global.inc.php)

+ 1 - 1
main/inc/lib/document.lib.php

@@ -341,7 +341,7 @@ class DocumentManager
             return true;
         } else {
             // no forced download, just let the browser decide what to do according to the mimetype
-            $lpFixedEncoding = api_get_configuration_value('lp_fixed_encoding');
+            $lpFixedEncoding = api_get_setting('lp.fixed_encoding') === 'true';
 
             // Commented to let courses content to be cached in order to improve performance:
             //header('Expires: Wed, 01 Jan 1990 00:00:00 GMT');

+ 3 - 2
main/inc/lib/template.lib.php

@@ -117,7 +117,7 @@ class Template
         //$this->set_header_parameters($sendHeaders);
         //$this->set_footer_parameters();
 
-        $defaultStyle = api_get_configuration_value('default_template');
+        $defaultStyle = api_get_setting('display.default_template');
         if (!empty($defaultStyle)) {
             $this->templateFolder = $defaultStyle;
         }
@@ -1293,6 +1293,7 @@ class Template
 
     /**
      * Set header parameters.
+     * @deprecated
      *
      * @param bool $sendHeaders send headers
      */
@@ -1417,7 +1418,7 @@ class Template
         $this->assign('pending_survey_url', $pendingSurveyLink);
 
         // Certificate Link
-        $allow = api_get_configuration_value('hide_my_certificate_link');
+        $allow = api_get_configuration_value('certificate.hide_my_certificate_link');
         if ($allow === false) {
             $certificateUrl = api_get_path(WEB_CODE_PATH).'gradebook/my_certificates.php';
             $certificateLink = Display::url(

+ 1 - 1
main/inc/lib/userportal.lib.php

@@ -246,7 +246,7 @@ class IndexManager
         $items = [];
 
         if (!api_is_anonymous() &&
-            api_get_configuration_value('hide_my_certificate_link') === false
+            api_get_setting('certificate.hide_my_certificate_link') === 'false'
         ) {
             $items[] = [
                 'icon' => Display::return_icon('graduation.png', get_lang('MyCertificates')),

+ 6 - 77
main/install/configuration.dist.php

@@ -26,24 +26,12 @@
 /**
  * Database connection settings.
  */
-// Database host
-$_configuration['db_host'] = '{DATABASE_HOST}';
-// Database port
-$_configuration['db_port'] = '{DATABASE_PORT}';
-// Database name
-$_configuration['main_database'] = '{DATABASE_MAIN}';
-// Database username
-$_configuration['db_user'] = '{DATABASE_USER}';
-// Database password
-$_configuration['db_password'] = '{DATABASE_PASSWORD}';
 // Enable access to database management for platform admins.
 $_configuration['db_manager_enabled'] = false;
 
 /**
  * Directory settings.
  */
-// URL to the root of your Chamilo installation, e.g.: http://www.mychamilo.com/
-$_configuration['root_web'] = '{ROOT_WEB}';
 
 // Path to the webroot of system, example: /var/www/
 $_configuration['root_sys'] = '{ROOT_SYS}';
@@ -52,29 +40,6 @@ $_configuration['root_sys'] = '{ROOT_SYS}';
 // example: chamilo (this means chamilo is installed in /var/www/chamilo/
 $_configuration['url_append'] = '{URL_APPEND_PATH}';
 
-/**
- * Login modules settings.
- */
-// CAS IMPLEMENTATION
-// -> Go to your portal Chamilo > Administration > CAS to activate CAS
-// You can leave these lines uncommented even if you don't use CAS authentification
-//$extAuthSource["cas"]["login"] = $_configuration['root_sys']."main/auth/cas/login.php";
-//$extAuthSource["cas"]["newUser"] = $_configuration['root_sys']."main/auth/cas/newUser.php";
-
-// NEW LDAP IMPLEMENTATION BASED ON external_login info
-// -> Uncomment the two lines bellow to activate LDAP AND edit main/auth/external_login/ldap.conf.php for configuration
-// $extAuthSource["extldap"]["login"] = $_configuration['root_sys']."main/auth/external_login/login.ldap.php";
-// $extAuthSource["extldap"]["newUser"] = $_configuration['root_sys']."main/auth/external_login/newUser.ldap.php";
-//
-// FACEBOOK IMPLEMENTATION BASED ON external_login info
-// -> Uncomment the line bellow to activate Facebook Auth AND edit app/config/auth.conf.php for configuration
-// $_configuration['facebook_auth'] = 1;
-//
-// OTHER EXTERNAL LOGIN INFORMATION
-// To fetch external login information, uncomment those 2 lines and modify  files auth/external_login/newUser.php and auth/external_login/updateUser.php files
-// $extAuthSource["external_login"]["newUser"] = $_configuration['root_sys']."main/auth/external_login/newUser.php";
-// $extAuthSource["external_login"]["updateUser"] = $_configuration['root_sys']."main/auth/external_login/updateUser.php";
-
 /**
  * Hosting settings - Allows you to set limits to the Chamilo portal when
  * hosting it for a third party. These settings can be overwritten by an
@@ -150,8 +115,6 @@ $_configuration['cdn'] = [
 $_configuration['security_key'] = '{SECURITY_KEY}';
 // Hash function method
 $_configuration['password_encryption'] = '{ENCRYPT_PASSWORD}';
-// You may have to restart your web server if you change this
-$_configuration['session_stored_in_db'] = false;
 // Session lifetime
 $_configuration['session_lifetime'] = SESSION_LIFETIME;
 // Activation for multi-url access
@@ -173,35 +136,10 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
  */
 // Uncomment the following to prevent all admins to use the "login as" feature
 //$_configuration['login_as_forbidden_globally'] = true;
-// If session_stored_in_db is false, an alternative session storage mechanism
-// can be used, which allows for a volatile storage in Memcache, and a more
-// permanent "backup" storage in the database, every once in a while (see
-// frequency). This is generally used in HA clusters configurations
-// This requires memcache or memcached and the php5-memcache module to be setup
-//$_configuration['session_stored_in_db_as_backup'] = true;
-// Define the different memcache servers available
-//$_configuration['memcache_server'] = array(
-//    0 => array(
-//        'host' => 'chamilo8',
-//        'port' => '11211',
-//    ),
-//    1 => array(
-//        'host' => 'chamilo9',
-//        'port' => '11211',
-//    ),
-//);
-// Define the frequency to which the data must be stored in the database
-//$_configuration['session_stored_after_n_times'] = 10;
+
 // If the database is down this css style will be used to show the errors.
 //$_configuration['theme_fallback'] = 'chamilo'; // (chamilo theme)
-// The default template that will be use in the system.
-//$_configuration['default_template'] = 'default'; // (main/template/default)
-// Hide fields in the main/user/user.php page
 //$_configuration['hide_user_field_from_list'] = ['fields' => ['username']];
-// Aspell Settings
-//$_configuration['aspell_bin'] = '/usr/bin/hunspell';
-//$_configuration['aspell_opts'] = '-a -d en_GB -H -i utf-8';
-//$_configuration['aspell_temp_dir'] = './';
 // Custom name_order_conventions
 //$_configuration['name_order_conventions'] = array(
 // 'french' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name')
@@ -239,34 +177,25 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
         'birthday'
     ]
 ];*/
-// Boost option to ignore encoding check for learning paths
-//$_configuration['lp_fixed_encoding'] = 'false';
+
 // Fix urls changing http with https in scorm packages.
 //$_configuration['lp_replace_http_to_https'] = false;
 // Fix embedded videos inside lps, adding an optional popup
 //$_configuration['lp_fix_embed_content'] = false;
 // Manage deleted files marked with "DELETED" (by course and only by allowed by admin)
 //$_configuration['document_manage_deleted_files'] = false;
-// Hide tabs in the main/session/index.php page
-//$_configuration['session_hide_tab_list'] = array();
-// Show invisible exercise in LP list
-//$_configuration['show_invisible_exercise_in_lp_list'] = false;
+
 // Chamilo is installed/downloaded. Packagers can change this
 // to reflect their packaging method. The default value is 'chamilo'. This will
 // be reflected on the https://version.chamilo.org/stats page in the future.
 //$_configuration['packager'] = 'chamilo';
-// If true exercises added in LP can be modified.
-//$_configuration['force_edit_exercise_in_lp'] = false;
+
 // List of driver to plugin in ckeditor
 //$_configuration['editor_driver_list'] = ['PersonalDriver', 'CourseDriver'];
-// Hide send to hrm users options in announcements
-//$_configuration['announcements_hide_send_to_hrm_users'] = true;
-// Hide certificate link in index/userportal pages
-//$_configuration['hide_my_certificate_link'] = false;
+
 // Hide header and footer in certificate pdf
 //$_configuration['hide_header_footer_in_certificate'] = false;
-// Security: block direct access from logged in users to contents in OPEN (but not public) courses. Set to true to block
-//$_configuration['block_registered_users_access_to_open_course_contents'] = false;
+
 // Allows syncing the database with the current entity schema
 //$_configuration['sync_db_with_schema'] = false;
 // When exporting a LP, all files and folders in the same path of an html will be exported too.

+ 0 - 1
main/install/index.php

@@ -558,7 +558,6 @@ if (@$_POST['step2']) {
         }
 
         // For version 1.9
-        $urlForm = $_configuration['root_web'];
         $encryptPassForm = get_config_param('password_encryption');
         // Managing the $encryptPassForm
         if ($encryptPassForm == '1') {

+ 1 - 1
main/lp/learnpath.class.php

@@ -10116,7 +10116,7 @@ class learnpath
         $tbl_doc = Database::get_course_table(TABLE_DOCUMENT);
         $tbl_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
         $condition_session = api_get_session_condition($session_id, true, true);
-        $setting = api_get_configuration_value('show_invisible_exercise_in_lp_list');
+        $setting = api_get_setting('lp.show_invisible_exercise_in_lp_toc') === 'true';
 
         $activeCondition = ' active <> -1 ';
         if ($setting) {

+ 2 - 1
main/session/index.php

@@ -652,9 +652,10 @@ $tabs = [
     $reportingTab,
 ];
 
-$tabToHide = api_get_configuration_value('session_hide_tab_list');
+$tabToHide = api_get_setting('session.hide_tab_list');
 
 if (!empty($tabToHide)) {
+    $tabToHide = explode(',', $tabToHide);
     foreach ($tabToHide as $columnId) {
         unset($headers[$columnId]);
         unset($tabs[$columnId]);

+ 1 - 2
src/CoreBundle/Menu/LeftMenuBuilder.php

@@ -343,8 +343,7 @@ class LeftMenuBuilder implements ContainerAwareInterface
         $checker = $this->container->get('security.authorization_checker');
         $translator = $this->container->get('translator');
         $settingsManager = $this->container->get('chamilo.settings.manager');
-        //$allow = $settingsManager->getSetting('hide_my_certificate_link');
-        $allow = api_get_configuration_value('hide_my_certificate_link');
+        $allow = $settingsManager->getSetting('certificate.hide_my_certificate_link');
 
         $menu = $factory->createItem('root');
         if ($checker->isGranted('IS_AUTHENTICATED_FULLY')) {

+ 10 - 0
src/CoreBundle/Resources/config/services.yml

@@ -266,6 +266,11 @@ services:
         tags:
             - {name: sylius.settings_schema, alias: chamilo_core.settings.cas, namespace: cas}
 
+    chamilo_core.settings.certificate:
+        class: Chamilo\CoreBundle\Settings\CertificateSettingsSchema
+        tags:
+        - {name: sylius.settings_schema, alias: chamilo_core.settings.certificate, namespace: certificate}
+
     chamilo_core.settings.chat:
         class: Chamilo\CoreBundle\Settings\ChatSettingsSchema
         tags:
@@ -334,6 +339,11 @@ services:
         tags:
             - {name: sylius.settings_schema, alias: chamilo_core.settings.language, namespace: language}
 
+    chamilo_core.settings.learning_path:
+        class: Chamilo\CoreBundle\Settings\LearningPathSettingsSchema
+        tags:
+        - {name: sylius.settings_schema, alias: chamilo_core.settings.language, namespace: lp}
+
     chamilo_core.settings.mail:
         class: Chamilo\CoreBundle\Settings\MailSettingsSchema
         tags:

+ 2 - 0
src/CoreBundle/Settings/AnnouncementSettingsSchema.php

@@ -23,6 +23,7 @@ class AnnouncementSettingsSchema extends AbstractSettingsSchema
             ->setDefaults(
                 [
                     'hide_global_announcements_when_not_connected' => 'false',
+                    'hide_send_to_hrm_users' => 'true'
                 ]
             );
 
@@ -39,6 +40,7 @@ class AnnouncementSettingsSchema extends AbstractSettingsSchema
     {
         $builder
             ->add('hide_global_announcements_when_not_connected', YesNoType::class)
+            ->add('hide_send_to_hrm_users', YesNoType::class)
         ;
     }
 }

+ 46 - 0
src/CoreBundle/Settings/CertificateSettingsSchema.php

@@ -0,0 +1,46 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Chamilo\CoreBundle\Settings;
+
+use Chamilo\CoreBundle\Form\Type\YesNoType;
+use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
+use Symfony\Component\Form\FormBuilderInterface;
+
+/**
+ * Class CertificateSettingsSchema.
+ *
+ * @package Chamilo\CoreBundle\Settings
+ */
+class CertificateSettingsSchema extends AbstractSettingsSchema
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function buildSettings(SettingsBuilderInterface $builder)
+    {
+        $builder
+            ->setDefaults(
+                [
+                    'hide_my_certificate_link' => 'false',
+                    'hide_header_footer' => 'false'
+                ]
+            );
+
+        $allowedTypes = [
+            'hide_my_certificate_link' => ['string'],
+        ];
+        $this->setMultipleAllowedTypes($allowedTypes, $builder);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function buildForm(FormBuilderInterface $builder)
+    {
+        $builder
+            ->add('hide_my_certificate_link', YesNoType::class)
+            ->add('hide_header_footer', YesNoType::class)
+        ;
+    }
+}

+ 2 - 0
src/CoreBundle/Settings/CourseSettingsSchema.php

@@ -109,6 +109,7 @@ class CourseSettingsSchema extends AbstractSettingsSchema
                     'enable_record_audio' => 'false',
                     'lp_show_reduced_report' => 'false',
                     'course_creation_splash_screen' => 'true',
+                    'block_registered_users_access_to_open_course_contents' => 'false', // @todo
                 ]
             )
             ->setTransformer(
@@ -249,6 +250,7 @@ class CourseSettingsSchema extends AbstractSettingsSchema
             ->add('enable_record_audio', YesNoType::class)
             ->add('lp_show_reduced_report', YesNoType::class)
             ->add('course_creation_splash_screen', YesNoType::class)
+            ->add('block_registered_users_access_to_open_course_contents', YesNoType::class)
         ;
     }
 }

+ 2 - 1
src/CoreBundle/Settings/DisplaySettingsSchema.php

@@ -52,6 +52,7 @@ class DisplaySettingsSchema extends AbstractSettingsSchema
                     'hide_logout_button' => 'false',
                     'show_link_ticket_notification' => 'false',
                     'icons_mode_svg' => 'false',
+                    'default_template' => 'default'
                 ]
             );
 
@@ -116,7 +117,7 @@ class DisplaySettingsSchema extends AbstractSettingsSchema
             ->add('hide_logout_button', YesNoType::class)
             ->add('show_link_ticket_notification', YesNoType::class)
             ->add('icons_mode_svg', YesNoType::class)
-
+            ->add('default_template')
         ;
     }
 }

+ 1 - 0
src/CoreBundle/Settings/ExerciseSettingsSchema.php

@@ -31,6 +31,7 @@ class ExerciseSettingsSchema extends AbstractSettingsSchema
                     'exercise_max_ckeditors_in_page' => '0',
                     'configure_exercise_visibility_in_course' => 'false',
                     'exercise_invisible_in_session' => 'false',
+                    'allow_edit_exercise_in_lp' => 'false',
                 ]
             )
         ;

+ 46 - 0
src/CoreBundle/Settings/LearningPathSettingsSchema.php

@@ -0,0 +1,46 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Chamilo\CoreBundle\Settings;
+
+use Chamilo\CoreBundle\Form\Type\YesNoType;
+use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
+use Symfony\Component\Form\FormBuilderInterface;
+
+/**
+ * Class LearningPathSettingsSchema.
+ *
+ * @package Chamilo\CoreBundle\Settings
+ */
+class LearningPathSettingsSchema extends AbstractSettingsSchema
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function buildSettings(SettingsBuilderInterface $builder)
+    {
+        $builder
+            ->setDefaults(
+                [
+                    'fixed_encoding' => 'false',
+                    'show_invisible_exercise_in_lp_toc' => 'false'
+                ]
+            );
+
+        $allowedTypes = [
+            'fixed_encoding' => ['string'],
+        ];
+        $this->setMultipleAllowedTypes($allowedTypes, $builder);
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function buildForm(FormBuilderInterface $builder)
+    {
+        $builder
+            ->add('fixed_encoding', YesNoType::class)
+            ->add('show_invisible_exercise_in_lp_toc', YesNoType::class)
+        ;
+    }
+}

+ 3 - 0
src/CoreBundle/Settings/SessionSettingsSchema.php

@@ -46,6 +46,7 @@ class SessionSettingsSchema extends AbstractSettingsSchema
                     'session_days_before_coach_access' => '',
                     'show_session_description' => 'false',
                     'remove_session_url' => 'false',
+                    'hide_tab_list' => ''
                 ]
             )
         ;
@@ -98,6 +99,8 @@ class SessionSettingsSchema extends AbstractSettingsSchema
             ->add('session_days_before_coach_access')
             ->add('show_session_description', YesNoType::class)
             ->add('remove_session_url', YesNoType::class)
+            ->add('hide_tab_list')
+
         ;
     }
 }