Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-71778

moodle cli cfg.php hard-set filter, filter too much

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.9.7, 3.10.6, 3.11.2
    • Fix Version/s: 3.10.7, 3.11.3
    • Component/s: Other
    • Labels:
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_311_STABLE
    • Pull from Repository:
    • Pull 3.10 Branch:
      MDL-71778-310
    • Pull 3.11 Branch:
      MDL-71778-311
    • Pull Master Branch:
      MDL-71778-master
    • Testing Instructions:
      Hide
      Core config setting
      1. Run the following command on your CLI:

        php admin/cli/cfg.php --name=dbhost --set=localhost
        

      2. Make sure the validation message "The configuration variable is hard-set in the config.php, unable to change." is displayed.
      3. Run the following command on your CLI:

        php admin/cli/cfg.php --name=debug --set=0
        

      4. Make sure you don't get an error message.
      Plugin config setting
      1. Run the following command on your CLI:

        php admin/cli/cfg.php --component='logstore_database' --name=dbhost --set=localhost
        

      2. Make sure you don't get an error message.
      3. Add the following line to your config.php:

        $CFG->forced_plugin_settings['logstore_database']['dbhost']='localhost';
        

      4. Run the same command of step 1.
      5. Make sure the validation message "The configuration variable is hard-set in the config.php, unable to change." is displayed.
      Show
      Core config setting Run the following command on your CLI: php admin/cli/cfg.php --name=dbhost --set=localhost Make sure the validation message "The configuration variable is hard-set in the config.php, unable to change." is displayed. Run the following command on your CLI: php admin/cli/cfg.php --name=debug --set=0 Make sure you don't get an error message. Plugin config setting Run the following command on your CLI: php admin/cli/cfg.php --component='logstore_database' --name=dbhost --set=localhost Make sure you don't get an error message. Add the following line to your config.php : $CFG->forced_plugin_settings['logstore_database']['dbhost']='localhost'; Run the same command of step 1. Make sure the validation message "The configuration variable is hard-set in the config.php, unable to change." is displayed.

      Description

      In the moodle cli cfg.php the filter to detect ,hard set only compare name of the cfg parameter to $CFG->config_php_settings content.

      But when component is passed as command line argument it is not correct.

      the component and name can be stored in $CFG->forced_plugin_settings content

      Before patch

      Launch moodle command client cfg
       

      php /moodlepath/amdin/cli/cfg.php --component='logstore_database' --name=dbhost --set=localhost

      This will trigger the cli error message : 
      "The configuration variable is hard-set in the config.php, unable to change."
      Whereas the parameter is not set in config.php
       

      After Patch

      After patching cfg.php, the previous command line will pass and localhost will be set for logstore database setting

      The if you add the following entry into config.php : 
       

      $CFG->forced_plugin_settings['logstore_database']['dbhost']='localhost';

      And relaunch moodle cli cfg

      php /moodlepath/amdin/cli/cfg.php --component='logstore_database' --name=dbhost --set=localhost

      the cli error message will be triggered but this is normal since the plugin setting is set through $CFG->forced_plugin_settings variable

        Attachments

          Activity

            People

            Assignee:
            cperves Céline Perves
            Reporter:
            cperves Céline Perves
            Peer reviewer:
            Simey Lameze Simey Lameze
            Integrator:
            Jun Pataleta Jun Pataleta
            Tester:
            Angelia Dela Cruz Angelia Dela Cruz
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/Sep/21

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m