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

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 3.3
    • 3.1.6, 3.2.3
    • Libraries
    • MOODLE_33_STABLE
    • MOODLE_31_STABLE, MOODLE_32_STABLE
    • MDL-58701-master
    • 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

    Description

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

      Attachments

        Issue Links

          Activity

            People

              ankit_frenz Ankit Agarwal
              ankit_frenz Ankit Agarwal
              Juan Leyva Juan Leyva
              Jake Dallimore Jake Dallimore
              cameron1729 cameron1729
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                8/May/17