Updating of files on Moodle-server

Updating of files on Moodle-server

by Fabian Schulz -
Number of replies: 7
Greetings,
I have picked up a problem with the uploading of files. ...

I have uploaded file XXXX and provided it as a resource. Then I update file XXXX on my PC, delete it from the moodle server and upload the new version and link it to the resource.

BUT!

The file that is given as resource is the old one, not the updated one.

Any ideas?
Average of ratings: -
In reply to Fabian Schulz

Re: Updating of files on Moodle-server

by Gustav W Delius -

The old resource is still cached in your browser. The browser will not get a new copy until the lifetime of the old one has expired. The lifetime is set in line 8 of cvs:/moodle/file.php. It is currently

    $lifetime = 86400;

which is the number of seconds in a day. Because of many complaints from lecturers similar to yours I have changed that in our installation by placing the lines

    // only jpeg files get a long lifetime (so that userimages are not requested too often),
    // everything else should be checked after 10 seconds
    if ($mimetype <> 'jpeg') {
        $lifetime = 10;
    }

right after line 40 which reads

    $mimetype = mimeinfo("type", $filename);

I propose this as a general change in Moodle, however of course with the 10 replaced by something like $CFG->lifetime.

Until such a time there is the advice from Martin somewhere in these forums: simply change the name each time you change a file.

In reply to Gustav W Delius

Re: Updating of files on Moodle-server

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
For a LAN situation, Gustav's suggestion is good.  For a situation with remote learners on modems downloading resources over and over gets slow.

To kick your own browser and force it to get a fresh copy just hold down "shift" while pressing the reload/refresh button.
In reply to Martin Dougiamas

Re: Updating of files on Moodle-server

by Siegwart Mayr -

>To kick your own browser and force it to get a fresh copy just hold down "shift" while pressing the reload/refresh button.

If you are using IE, you want to press <ctrl><F5> to force a refresh (the <shift> does not do anything).  This is usually the quick solution to your problem, as Martin pointed it out.

In reply to Martin Dougiamas

Re: Updating of files on Moodle-server

by D G -
I was pondering about this recently... it presumably is possible to figure some way to (optionally?) include parsing of a given file's timestamp when creating a link to it, so that the file can be cached, until the file is updated (file updated --> timestamp updated --> url changes).

DG


Average of ratings: Useful (1)
In reply to Fabian Schulz

Re: Updating of files on Moodle-server

by W Page -

Hi!

Ask your webhost to clean out the "cache" for you on the server and see if that helps.

WP1

In reply to W Page

Re: Updating of files on Moodle-server

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
There is no such thing when it comes to Moodle resources.
In reply to Martin Dougiamas

Re: Updating of files on Moodle-server

by W Page -

Hi Martin!

As you know I am a newbie.  The reason I suggested the solution I did is I use to have a site on a free f2s.net site.  Sometimes even after a F5 refresh the updated file would not show and a webmaster might have to wait several hours to a day for the f2s servers cache to be cleared out.  This did not happen all the time but it did happen enough to be annoying.

For my own edification, what do you mean when you say "There is no such thing when it comes to Moodle resources". 

WP1