File Links broken after upgrade

File Links broken after upgrade

by Stephen Bloomer -
Number of replies: 13

We have completed an upgrade test on our test site from 1.9.10 to 2.0 RC1 (Build: 20101108).  After the upgrade we noticed that about 60% of the files links to course pages were not working.  The icon is changed from showing the file type to a question mark and when you select the link you either get:-

a. a red box that says "Sorry, the requested file could not be found" or

b. "Click  .  link to view the file" (with no link that can be clicked).

The problem appears to be due to the "Description" box which is now a requirement, rather than an option.  Once a description is entered all works fine.

Just wondering if there is a way of making the description box only a required field for new files added?

Thanks.

 

Average of ratings: -
In reply to Stephen Bloomer

Re: File Links broken after upgrade

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

If you go to site admin>plugins>activity modules>file then you can set it so that the description is NOT required - does that help?

In reply to Mary Cooch

Re: File Links broken after upgrade

by Stephen Bloomer -

Almost.  It stops the requierment for entering a description, but does not fix the link.  May make for some busy people after we upgrade the live site. 

In reply to Stephen Bloomer

Re: File Links broken after upgrade

by Travis Wilhelm -

Stephen,

Did you get a solutiont to this problem? I have the same issue with a newly upgraded Moodle 2.0 - file resources appear with a question mark in the icon, and an error of "File not found" when clicking them.

BUT - the files are definitely still there, and it's really easy to get an individual file fixed by clicking the edit button, then saving and it suddenly gets the appropriate icon and works!

Is there a batch way I can do that rather than having to go through every file resource in every course?  I'm fairly SQL savy, but just can't work out what is changing in the mdl_resource and / or mdl_resource_old tables.  What other table am I missing?

In reply to Stephen Bloomer

Re: File Links broken after upgrade

by Chad Outten -

G'day Stephen. Check the web address of the resources that say "Sorry, the requested file could not be found". Anything peculiar? Did you happen to change URLs or be using moodle content from another domain?

eg. newmoodle.com/file.php?id=1 might still be referencing oldmoodle.com/file.php?id=1

if that is the case, you may need to run the replace script located at yourmoodle.com/admin/replace.php. this will replace all the strings through your database. i recommend you grab a backup of everything first.

In reply to Chad Outten

Re: File Links broken after upgrade

by Stephen Bloomer -

Unfortunately the file path looks good.  I actually wiped the site and repeated the upgrade process from 1.9 to the latest release of 2.0 today (due to another issue).  Adding a single letter description resolves it for us.  It does seem to be a problem with “Files” only.  Links to tasks and folders are fine.

In reply to Stephen Bloomer

Re: File Links broken after upgrade

by Chad Outten -

Ok, Stephen. Sounds peculiar. Bear in mind moodle 2.0 is still at release candidate 1 and not ready for a production environment.

In reply to Chad Outten

Re: File Links broken after upgrade

by Stephen Bloomer -

Yes, I am wiping the site and re-upgrading every couple of days to get ready.  We are hoping the final version comes out soon so we can update and have the teachers working on the site over the Christmas period (so 10 Dec would be nice).  We only have a couple of issues left resolve.

In reply to Stephen Bloomer

Re: File Links broken after upgrade

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Stephen

I expect you mean Christmas 2011.wink

Joseph

In reply to Joseph Rézeau

Re: File Links broken after upgrade

by Stephen Bloomer -

Original release date is/was planned for Nov 2010 and the rate that they are fixing bugs I expect they will be ready soon.

http://docs.moodle.org/en/Roadmap#Version_2.0

In reply to Stephen Bloomer

Re: File Links broken after upgrade

by Manish Verma -

Looking at the mention of, "Early November*" I think docs need to be updated (http://docs.moodle.org/en/Moodle_2.0_release_notes) . There are still a few blockers left (http://tracker.moodle.org/secure/IssueNavigator.jspa?mode=hide&requestId=11118) but it does not look like it should take too much time unless there is a plan for RC2.

*If testing goes well.

In reply to Stephen Bloomer

Re: File Links broken after upgrade

by James Mills -

Hi


I'm doing a test upgrade of a site from 1.9.6 to 2.0.1 (STABLE RELEASE) and this 'bug' still persists. The whole site is fine apart from this problem with some (over 50% actually) having a question mark file icon. Editing and saving the file with no changes causes the icon to display correctly.


This seems to be a pretty major problem, has anyone managed to come up with a way of batch-updating uploaded files?

Average of ratings: Useful (1)
In reply to James Mills

Re: File Links broken after upgrade

by Jorge Villalon -

I have the same issue in a recently upgraded Moodle (from 1.9.6 to 2.0.2), so the bug persists. I'm trying to find out what changes does the editing/saving with no changes make in the DB.

In reply to Jorge Villalon

FOUND THE BUG!

by Jorge Villalon -

Hi guys.

I found the bug for the links broken after upgrade. The problem is in the resource lib, in the function resource_get_coursemodule_info in which the module gets all the files for a context and if there are more than one, it pops the first one in the list.

The problem is that when you migrate to 2.0+ all files create two resources: The file itself and the folder where it belongs, and the sortorder for both is exactly the same: 0. So when mysql returns the file first, it works, and when it returns the other way around it doesn't (pretty hard to find).

I fixed it by updating the sortorder to 1 for all rows in mdl_files that had component 'mod_resource' and did not have a filename equal to '.' (folder). I also deleted the course cached info. In sql:

update mdl_files set sortorder=1 where component='mod_resource' and filename <> '.' and sortorder = 0;

update mdl_course set modinfo = NULL;

It will be fixed for 2.0.3, but you can use my workaround for now.

http://tracker.moodle.org/browse/MDL-26616

Average of ratings: Useful (3)