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

Aliases/shortcuts to files in repositories only get synchronized if they are images

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.7.5, 3.8.2, 3.8.3
    • Fix Version/s: None
    • Component/s: Repositories
    • Labels:
    • Testing Instructions:
      Hide
      • Have any of the following repositories configured and ready to use in Moodle: dropbox, filesystem, equella or boxnet.
      • Upload a .zip file in the dropbox, filesystem, etc. repository to be used
      • Create a file resource in Moodle and add a shortcut/alias to the .zip file in the repository
      • Download the file from the Moodle resource. Everything is fine
      • Upload a different .zip file in the repository with the same name (overwrite the previous one)
      • Download the file from the Moodle resource. You still get the old file, which is stored in Moodle's file system and never gets synchronized.
      • Remove the if (file_extension_in_typegroup($reference->path, 'web_image')) condition from lib.php in the repository plugin you are using for this test.
      • Now you have to edit the corresponding record in mdl_files_reference to make sure Moodle will try to synchronize the stored file with the external file in the repository (because it only does it once a day). For this, edit the lastsync field in the corresponding record and enter a timestamp at least 24 hours before current time. Alternatively, you can just wait 24 real hours before doing the next step.
      • Download the file from the Moodle resource once again. Now you do get the updated .zip version from the repository (you may have to wait one or two minutes till Moodle's cron actually runs the synchronization)
      Show
      Have any of the following repositories configured and ready to use in Moodle: dropbox, filesystem, equella or boxnet. Upload a .zip file in the dropbox, filesystem, etc. repository to be used Create a file resource in Moodle and add a shortcut/alias to the .zip file in the repository Download the file from the Moodle resource. Everything is fine Upload a different .zip file in the repository with the same name (overwrite the previous one) Download the file from the Moodle resource. You still get the old file, which is stored in Moodle's file system and never gets synchronized. Remove the if (file_extension_in_typegroup($reference->path, 'web_image')) condition from lib.php in the repository plugin you are using for this test. Now you have to edit the corresponding record in mdl_files_reference to make sure Moodle will try to synchronize the stored file with the external file in the repository (because it only does it once a day). For this, edit the lastsync field in the corresponding record and enter a timestamp at least 24 hours before current time. Alternatively, you can just wait 24 real hours before doing the next step. Download the file from the Moodle resource once again. Now you do get the updated .zip version from the repository (you may have to wait one or two minutes till Moodle's cron actually runs the synchronization)
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE

      Description

      Dropbox, filesystem, equella and boxnet repository plugins have this strange condition in their sync_reference() function within lib.php:

       

             if (file_extension_in_typegroup($reference->path, 'web_image'))

      {               //synchronize moodle file with external file                }

              

      This limits synchronization only to jpg, png and such type of files. I made a quick test with a .zip file and when I removed the previous if() condition, everything started working (meaning that if I update the .zip file in the repository I finally get the updated version in Moodle).

       

      Steps to reproduce:

      1. Have any of the following repositories configured and ready to use in Moodle: dropbox, filesystem, equella or boxnet.
      2. Upload a .zip file in the dropbox, filesystem, etc. repository to be used
      3. Create a file resource in Moodle and add a shortcut/alias to the .zip file in the repository
      4. Download the file from the Moodle resource. Everything is fine
      5. Upload a different .zip file in the repository with the same name (overwrite the previous one)
      6. Download the file from the Moodle resource. You still get the old file, which is stored in Moodle's file system and never gets synchronized.
      7. Remove the if (file_extension_in_typegroup($reference->path, 'web_image')) condition from lib.php in the repository plugin you are using for this test.
      8. Now you have to edit the corresponding record in mdl_files_reference to make sure Moodle will try to synchronize the stored file with the external file in the repository (because it only does it once a day). For this, edit the lastsync field in the corresponding record and enter a timestamp at least 24 hours before current time. Alternatively, you can just wait 24 real hours before doing the next step.
      9. Download the file from the Moodle resource once again. Now you do get the updated .zip version from the repository (you may have to wait one or two minutes till Moodle's cron actually runs the synchronization)

       

      I don't know if this problem also appears in other repository plugins that do not implement the sync_reference() function (for example, with one drive; I know that others, such as google drive, don't even allow creating aliases/shortcuts at all), but I could test it if this issue is considered relevant. I am definitely interested in working on fixing it.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            ravenink Luis de la Torre
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 15 minutes
                15m