Moodle

moving files breaks links

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.4.3
  • Fix Version/s: 2.0
  • Component/s: None
  • Labels:
    None
  • Environment:
    All
  • Affected Branches:
    MOODLE_14_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

When a course file is moved or renamed, could a quick check be made for any course references to the file that would create a broken link or perhpas change or update these references to the new folder/file name or location? Even just a quick list of where broken links might have been created would allow a course teacher to fix them. It seems to happen to generally happen to me when I tweak image or course folder/file names and digging up all the places where I might have referenced the file is rather clumbersome.

Issue Links

Activity

Hide
Martin Dougiamas added a comment -

From Mike Churchward (mike at churchward.ca) Tuesday, 30 November 2004, 02:06 AM:

I'm thinking this is not a wiki specific problem, but one that would occur in any activity that allows links (forums, resources, etc). The problem is that the HTML editor inserts a full link to the file, which includes that course number.

If you use 'internal://' links with the wiki, it should be fine. Which type of link is giving you the problem?

mike

From Roland Gesthuizen (rolandg at netspace.net.au) Tuesday, 30 November 2004, 09:34 PM:

All links as you correctly spot although I wasnt thinking wiki. I was really asking if the file management system can be made smart enough to rename a link used elesewhere in that same course if a file is renamed or moved. Sorry, I wasnt aware of the internal:// tag..

From Mike Churchward (mike at churchward.ca) Wednesday, 1 December 2004, 09:48 PM:

You're right! Sorry. I was looking at wiki bugs and got this one confused with them.

Show
Martin Dougiamas added a comment - From Mike Churchward (mike at churchward.ca) Tuesday, 30 November 2004, 02:06 AM: I'm thinking this is not a wiki specific problem, but one that would occur in any activity that allows links (forums, resources, etc). The problem is that the HTML editor inserts a full link to the file, which includes that course number. If you use 'internal://' links with the wiki, it should be fine. Which type of link is giving you the problem? mike From Roland Gesthuizen (rolandg at netspace.net.au) Tuesday, 30 November 2004, 09:34 PM: All links as you correctly spot although I wasnt thinking wiki. I was really asking if the file management system can be made smart enough to rename a link used elesewhere in that same course if a file is renamed or moved. Sorry, I wasnt aware of the internal:// tag.. From Mike Churchward (mike at churchward.ca) Wednesday, 1 December 2004, 09:48 PM: You're right! Sorry. I was looking at wiki bugs and got this one confused with them.
Hide
David Jackson added a comment -

This bug was eliminated in previous versions but has popped up again for me in 1.7+.
Moving or renaming files breaks links to resources.
Moving or renaming a folder does not.

Show
David Jackson added a comment - This bug was eliminated in previous versions but has popped up again for me in 1.7+. Moving or renaming files breaks links to resources. Moving or renaming a folder does not.
Hide
David Jackson added a comment -

I've been looking at this further in Moodle 1.7+ to try and refine the issue and I've noted that in the context of links to resources...

The following actions are repaired by moodle:

  1. renaming a folder
  2. renaming a file

The following actions are not repaired by moodle:

  1. moving a file to another folder
  2. moving a folder to another folder

I've also managed to recreate the bug in todays build of Moodle 1.8+

Conclusion: Moodle repairs resource links to renamed files and files within renamed folders but does not repair links to resources which have been moved or are stored within a folder that has been moved.

Moodle 1.7+ is running on Debian/Apache/Postgres
Moodle 1.8+ is running on XP/Apache/MySQL

I notice that this bug report, while still unresolved is also very old. Would I do better to create a new bug report specifically related to resource links?
Cheers

Show
David Jackson added a comment - I've been looking at this further in Moodle 1.7+ to try and refine the issue and I've noted that in the context of links to resources... The following actions are repaired by moodle:
  1. renaming a folder
  2. renaming a file
The following actions are not repaired by moodle:
  1. moving a file to another folder
  2. moving a folder to another folder
I've also managed to recreate the bug in todays build of Moodle 1.8+ Conclusion: Moodle repairs resource links to renamed files and files within renamed folders but does not repair links to resources which have been moved or are stored within a folder that has been moved. Moodle 1.7+ is running on Debian/Apache/Postgres Moodle 1.8+ is running on XP/Apache/MySQL I notice that this bug report, while still unresolved is also very old. Would I do better to create a new bug report specifically related to resource links? Cheers
Hide
Chris Fryer added a comment -

We have some specific circumstances in which this is a problem.

We used Dan Stowells WebCT Import script, and this generates a deep(ish) directory structure, e.g. "COURSE_<SOME_CODE>_M/my_files". The editing user can move these files upwards in the hierarchy, but the corresponding resources are not updated. The user is only warned of a problem when they try to delete the (now empty) directories.

I note someone else seems to be having this problem as well http://tracker.moodle.org/browse/MDL-7050#action_23777

Chris

Show
Chris Fryer added a comment - We have some specific circumstances in which this is a problem. We used Dan Stowells WebCT Import script, and this generates a deep(ish) directory structure, e.g. "COURSE_<SOME_CODE>_M/my_files". The editing user can move these files upwards in the hierarchy, but the corresponding resources are not updated. The user is only warned of a problem when they try to delete the (now empty) directories. I note someone else seems to be having this problem as well http://tracker.moodle.org/browse/MDL-7050#action_23777 Chris
Hide
Ann Adamcik added a comment -

The attached patch updates resources when moving files or folders. Would someone please try it out and commit it if it looks reasonable?

Show
Ann Adamcik added a comment - The attached patch updates resources when moving files or folders. Would someone please try it out and commit it if it looks reasonable?
Hide
Chris Fryer added a comment -

Works for me on 1.8.3+

Good work.

Show
Chris Fryer added a comment - Works for me on 1.8.3+ Good work.
Hide
Colin Matheson added a comment -

This issue still appears in Moodle 1.95. A file can be renamed and the resource is updated. Also a containing folder can be renamed and the resource is updated. However if the file is moved to a new folder (either up or down the folder structure) the resource link is broken.
Will the above patch work for 1.95? If it does is there any plan to include the patch into core code for 1.9+?

Show
Colin Matheson added a comment - This issue still appears in Moodle 1.95. A file can be renamed and the resource is updated. Also a containing folder can be renamed and the resource is updated. However if the file is moved to a new folder (either up or down the folder structure) the resource link is broken. Will the above patch work for 1.95? If it does is there any plan to include the patch into core code for 1.9+?
Hide
Lael... added a comment -

I just noticed recently that this problem is still occurring for us on 1.9.5

Show
Lael... added a comment - I just noticed recently that this problem is still occurring for us on 1.9.5
Hide
Jean-Pierre Pawlak added a comment -

It would be nice if this issue was solved.
I just saw a teacher ruin three of here courses: she moved all files into new folders.
Hundred of links weren't adapted....

Show
Jean-Pierre Pawlak added a comment - It would be nice if this issue was solved. I just saw a teacher ruin three of here courses: she moved all files into new folders. Hundred of links weren't adapted....
Hide
Ann Adamcik added a comment -

The attached patch does work with 1.9.5. It's a minor change - I can go ahead and commit it if nobody objects.

Show
Ann Adamcik added a comment - The attached patch does work with 1.9.5. It's a minor change - I can go ahead and commit it if nobody objects.
Hide
Petr Škoda (skodak) added a comment -

Unfortunately for some people this is a feature because you may rename a file and upload a new one instead of the old one. I do not think we can change this for everybody so late in the stable 1.9.x branch. For now people have to be educated to not reshuffle files in course files. Also this patch would solve it only for resource module, but all other links in course would be still broken (module introductions, resource page links, books, etc.)!

Please note this issue is already solved in 2.0dev, each resource has own file area, there should not be any file renaming problems any more.

petr

Show
Petr Škoda (skodak) added a comment - Unfortunately for some people this is a feature because you may rename a file and upload a new one instead of the old one. I do not think we can change this for everybody so late in the stable 1.9.x branch. For now people have to be educated to not reshuffle files in course files. Also this patch would solve it only for resource module, but all other links in course would be still broken (module introductions, resource page links, books, etc.)! Please note this issue is already solved in 2.0dev, each resource has own file area, there should not be any file renaming problems any more. petr

Dates

  • Created:
    Updated:
    Resolved: