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

Allow support for xsendfile in alternative_file_system_class independently of local files

XMLWordPrintable

    • MOODLE_38_STABLE
    • MOODLE_38_STABLE
    • Hide

      Note, between tests you may need to reset browser cached images to get real information instead of previously cached stuff.

      1) Do a regression test without xsendfile configured.

      1. In a site with some course, activities...
      2. Ensure that the config.php setting $CFG->xsendfile is not set.
      A) Local files
      1. Navigate to main page/Dashboard
        1. Confirm that all icons and theme elements are displaying properly
        2. Confirm that there is no errors in Dev tool Network tab
      B) Private files
      1. Navigate to your private files
      2. Upload an image using drag/drop
        1. Confirm that a preview was generated for the image
      3. Download the image back from Moodle
        1. Confirm that it is present and correct
      4. Download the image as a zip
        1. Confirm that it is present and correct
      5. Save changes
        1. Confirm that the image is still present in your private files
      C) Course files
      1. Navigate to a course
      2. Edit the course or create a new one
        1. Upload an image to the Course summary
        2. Save changes
        3. Confirm that the image appears in the Courses Dashboard
      3. Turn editing on
      4. Create a file resource and drag/drop an images
        1. Confirm that you can view it within the course
      5. Edit image settings 
        1. Confirm that you can download the file

      2) Edit config.php, set $CFG->xsendfile to incorrect value and re-run regression test. Confirm that this will break serving both local files and File API files.

      $CFG->xsendfile = 'incorrect value';

      A) Local files
      1. Confirm that icons and theme elements not downloading and not displaying
      2. Confirm that Dev tool Network tab has entries with 'failed' status 
      B) Private files
      1. Confirm that page is not rendering properly and files are not displaying
      C) Course files
      1. Confirm that page is not rendering properly
      2. Confirm that image is not displaying

      3) Leave $CFG->xsendfile with incorrect value and hack the default file store to return false. Serving local files should still be broken, while File API files should work properly.

      1. Replace `supports_xsendfile` method in lib/filestorage/file_storage.php by

        public function supports_xsendfile(){
            return false;
        }
        

      A) Local files
      1. Confirm that icons and theme elements not downloading and not displaying
      2. Confirm that Dev tool Network tab has entries with 'failed' status 
      B) Private files
      1. Confirm that page is not rendering properly and files are not displaying
      C) Course files
      1. Confirm that page is not rendering properly
      2. Confirm that images are displaying in Course summary and File resourse

      4) Remove the hack introduced in the previous section 3) and configure** $CFG->xsendfile and run the "Regression tests" in section 1). Confirm that both local files and File API files are serving properly.

      1. This point has been already tested, see below. No action required by the tester.

      ** To enable xsendfile edit config.php and configure web server following the link: https://docs.moodle.org/37/en/Performance_recommendations#X-Sendfile

      Show
      Note, between tests you may need to reset browser cached images to get real information instead of previously cached stuff. 1) Do a regression test without xsendfile configured. In a site with some course, activities... Ensure that the config.php setting $CFG->xsendfile is not set. A) Local files Navigate to main page/Dashboard Confirm that all icons and theme elements are displaying properly Confirm that there is no errors in Dev tool   Network tab B) Private files Navigate to your private files Upload an image using drag/drop Confirm that a preview was generated for the image Download the image back from Moodle Confirm that it is present and correct Download the image as a zip Confirm that it is present and correct Save changes Confirm that the image is still present in your private files C) Course files Navigate to a course Edit the course or create a new one Upload an image to the Course summary Save changes Confirm that the image appears in the Courses Dashboard Turn editing on Create a file resource and drag/drop an images Confirm that you can view it within the course Edit image settings  Confirm that you can download the file 2) Edit config.php, set $CFG->xsendfile to incorrect value and re-run regression test. Confirm that this will break serving both local files and File API files. $CFG->xsendfile = 'incorrect value' ; A) Local files Confirm that icons and theme elements not downloading and not displaying Confirm that Dev tool Network tab has entries with 'failed' status  B) Private files Confirm that page is not rendering properly and files are not displaying C) Course files Confirm that page is not rendering properly Confirm that image is not displaying 3) Leave $CFG->xsendfile with incorrect value and hack the default file store to return false. Serving local files should still be broken, while File API files should work properly. Replace `supports_xsendfile` method in lib/filestorage/file_storage.php by public function supports_xsendfile(){    return false; } A) Local files Confirm that icons and theme elements not downloading and not displaying Confirm that Dev tool Network tab has entries with 'failed' status  B) Private files Confirm that page is not rendering properly and files are not displaying C) Course files Confirm that page is not rendering properly Confirm that images are displaying in Course summary and File resourse 4) Remove the hack introduced in the previous section 3) and configure** $CFG->xsendfile and run the "Regression tests" in section 1). Confirm that both local files and File API files are serving properly. This point has been already tested, see below. No action required by the tester. ** To enable xsendfile edit config.php and configure web server following the link: https://docs.moodle.org/37/en/Performance_recommendations#X-Sendfile

      If you implement xsendfile in an alternative_file_system_class then this only works if you have set up xsendfile for local files. There are legitimate use cases where the files served by the alternative_file_system_class could be served through that file stores xsendfile method, and the other non file api files such as the theme / js files might be either not served through xsendfile, or served via a different xsendfile method.

      So proposing:

      1) The $CFG->xsendfile remains but by default ONLY applies directly to local non File API files:

      $CFG->xsendfile = 'foobar'

      2) The file_system_class implements a new method which is whether it supports xsendfile (ie is configured and working, not just code support)

      3) All the code paths that serve files honor either only $CFG->xsendfile for local files, or defer to the store method for File API files

      4) The default file store implements this as returns true if $CFG->xsendfile is set

       

       

        1. test1.png
          test1.png
          230 kB
        2. test2.png
          test2.png
          158 kB
        3. test3.png
          test3.png
          173 kB
        4. tested_point4.png
          tested_point4.png
          360 kB

            mikhailgolenkov Misha Golenkov
            brendanheywood Brendan Heywood
            Brendan Heywood Brendan Heywood
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Janelle Barcega Janelle Barcega
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 27 minutes
                3h 27m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.