Opened 12 years ago
Closed 12 years ago
#11077 closed defect (cantfix)
When page renamed, files on file system for reparented attachments were not moved
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | general | Version: | 1.0 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
After having renamed a page I noticed that all the image links to the images attached to the page were broken. It appears as though the attachments were moved - they were still listed at the bottom of the page, and the links to view the images went to the correct location. However, the images themselves were not found when following the links (in the attachments list) to view the images.
Here is the log:
2013-02-22 16:22:35,635 Trac[util] DEBUG: WikiRenamePlugin: Running query 'SELECT w1.version,w1.text FROM wiki w1, (SELECT name, MAX (version) AS max_version FROM wiki GROUP BY name) w2 WHERE w1.version = w2.max_version AND w1.name = w2.name AND w1.name = %s' 2013-02-22 16:22:35,655 Trac[util] DEBUG: WikiRenamePlugin: Inserting new page <page text removed for brevity> 2013-02-22 16:22:35,655 Trac[util] DEBUG: WikiRenamePlugin: Moving all old versions of page 2013-02-22 16:22:35,668 Trac[util] DEBUG: WikiRenamePlugin: Moving all attachments in database 2013-02-22 16:22:35,669 Trac[util] DEBUG: WikiRenamePlugin: Found 13 attachments on that page 2013-02-22 16:22:35,669 Trac[util] DEBUG: WikiRenamePlugin: Moving all attachments on file system 2013-02-22 16:22:35,669 Trac[util] DEBUG: WikiRenamePlugin: Moving from u'/home/admin/trac/main/attachments/wiki/Bow/Features/sky' to u'/home/admin/trac/main/attachments/wiki/Documentation/sky' 2013-02-22 16:22:35,669 Trac[util] DEBUG: WikiRenamePlugin: Could not find from path:u'/home/admin/trac/main/attachments/wiki/Bow/Features/sky' 2013-02-22 16:22:35,669 Trac[util] DEBUG: WikiRenamePlugin: Trying to fix links 2013-02-22 16:22:35,669 Trac[util] DEBUG: WikiRenamePlugin: Running query 'SELECT w1.version,w1.name,w1.text FROM wiki w1, (SELECT name, MAX(version) AS max_version FROM wiki GROUP BY name) w2 WHERE w1.version = w2.max_version AND w1.name = w2.name AND w1.text like %s' 2013-02-22 16:22:35,732 Trac[util] DEBUG: WikiRenamePlugin: Found a page with a backlink in it: Bow/Backlog (v18) 2013-02-22 16:22:36,407 Trac[env] INFO: -------------------------------- environment startup [Trac 1.0] --------------------------------
At some point (I'm not sure when, I don't admin the system) trac was upgraded to 1.0. This is just a guess, but it seems during the upgrade those image files were moved to the new hash-based file system paths, but some reference to those paths was not updated. In the log you can see the old-style file system paths, but I managed to find all the images on the file system under the hash-based paths. After the move (when I started inspecting what went wrong) I found the images were not present under /home/admin/trac/main/attachments, but under /home/admin/trac/main/files/attachments/wiki/<hash paths>.
PluginIssue (th:WikiRenamePlugin). Also, the feature is built-in in Trac 0.12+.