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

Improve the language selection and validation in the CLI installer

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.9.2
    • Fix Version/s: 3.0
    • Component/s: Installation, Language
    • Labels:
    • Testing Instructions:
      Hide

      Execute the CLI installer.

      • Make sure that attempting to provide language code like "@" or "/" ends with "en" being used.
      • Make sure that the list of available languages is displayed in the interactive mode when "?" is typed at the language selector step.
      Show
      Execute the CLI installer. Make sure that attempting to provide language code like "@" or "/" ends with "en" being used. Make sure that the list of available languages is displayed in the interactive mode when "?" is typed at the language selector step.
    • Affected Branches:
      MOODLE_29_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-51403-master-clilang

      Description

      This was detected while working on the CLI improvements in MDL-51261.

      To reproduce:

      • When asked for the language pack, type something that does not pass the PARAM_SAFEDIR filter (such as dot, question mark, forward slash etc).
      • Run the installer with something like `sudo -u apache php admin/cli/install.php --lang=.`

      Expected behaviour: The user is re-prompted for a valid value

      Current behaviour: $CFG->lang is set to an empty value silently

      This is caused by the empty $input being used in the check

      if (!file_exists($CFG->dirroot.'/install/lang/'.$input)) {
      

      and the root 'lang' folder always exists.

        Attachments

          Activity

            People

            Assignee:
            mudrd8mz David Mudrák (@mudrd8mz)
            Reporter:
            mudrd8mz David Mudrák (@mudrd8mz)
            Peer reviewer:
            Simey Lameze Simey Lameze
            Integrator:
            Dan Poltawski Dan Poltawski
            Tester:
            Adrian Greeve Adrian Greeve
            Participants:
            Component watchers:
            Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, David Mudrák (@mudrd8mz), Helen Foster, Víctor Déniz Falcón
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              16/Nov/15