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

\external_settings::$file should use proper defaults for serving files when webserver is used.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.3
    • Fix Version/s: 3.1.6, 3.2.3
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a file with following code -

        define('WS_SERVER', true);
        require_once(__DIR__ . '/config.php');
        require_once("lib/externallib.php");
        require_once($CFG->libdir . "/filelib.php");
        $settings = external_settings::get_instance();
        print_object(external_settings::get_instance()->get_file());
        print_object(
            file_rewrite_pluginfile_urls(
                '@@PLUGINFILE@@/1.jpg',
                external_settings::get_instance()->get_file(),
                2, "t", "X", 3));
        

      2. Load the page and make sure the output is as below -

        webservice/pluginfile.php
        http://localhost/stable_master/webservice/pluginfile.php/2/t/X/3/1.jpg
        

      3. Now remove the first line of WS_SERVER declaration from the code and load it again.
      4. Make sure the output is -

        pluginfile.php
        http://localhost/stable_master/pluginfile.php/2/t/X/3/1.jpg
        

      Show
      Create a file with following code - define('WS_SERVER', true); require_once(__DIR__ . '/config.php'); require_once("lib/externallib.php"); require_once($CFG->libdir . "/filelib.php"); $settings = external_settings::get_instance(); print_object(external_settings::get_instance()->get_file()); print_object( file_rewrite_pluginfile_urls( '@@PLUGINFILE@@/1.jpg', external_settings::get_instance()->get_file(), 2, "t", "X", 3)); Load the page and make sure the output is as below - webservice/pluginfile.php http://localhost/stable_master/webservice/pluginfile.php/2/t/X/3/1.jpg Now remove the first line of WS_SERVER declaration from the code and load it again. Make sure the output is - pluginfile.php http://localhost/stable_master/pluginfile.php/2/t/X/3/1.jpg
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE, MOODLE_32_STABLE
    • Pull Master Branch:
      MDL-58701-master

      Description

      \external_settings::$file should use proper defaults for serving files when webserver is used.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ankit_frenz Ankit Agarwal
              Reporter:
              ankit_frenz Ankit Agarwal
              Peer reviewer:
              Juan Leyva
              Integrator:
              Jake Dallimore
              Tester:
              cameron1729
              Participants:
              Component watchers:
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/May/17