Development:Resource module file API migration: Difference between revisions
From MoodleDocs
Matt Gibson (talk | contribs) |
|||
Line 50: | Line 50: | ||
# Ignore itemid for resource files in pluginfile.php | # Ignore itemid for resource files in pluginfile.php | ||
= | =Code refactoring and UI changes proposal= | ||
* mod/resource/page - replaces Plain text, wiki and HTML resources | |||
* mod/resource/file - one or more uploaded files one is marked as the main file | |||
* mod/resource/directory - one or more uploaded files | |||
* mod/resource/link - links to external files | |||
=See also= | =See also= |
Revision as of 14:55, 18 May 2009
Current problems
- text and html resource types separate
- embedded images and files in general are stored in course files without appropriate access control
- local files and Internet links mixed
- is IMS plug-in maintained?
- repository plug-in obsoleted
- embedded images are lost during backup & restore which moves the course to a new site. -- Matt Gibson 08:53, 18 May 2009 (UTC)
Types of resources
- Directory of files
- Resource page - using new editor element
- External resource link - some file stored elsewhere
- Single uploaded images and files
- Packages and uploaded html files
- Other 3rd party plugins
Upgrade planning
Each type requires different upgrade code.
Directory type
- Recursively copy directory to resource area, skip backup and moddata contents
Text and web page
- Convert to one plug-in using new editor forms element
- Copy directly linked files that may not contain other relative links to resource area
- PROBLEM: deal somehow with html, flash, and java; maybe just warn and manual migration button
Links to files
- Links to external sites do not need any upgrade
- If link points to simple file (image, sound, pdf.) copy to resource area
- PROBLEM: links to different courses - already problem now, maybe just warn teachers
- PROBLEM: links to files that may contain other relative links (html, flash, java)
IMS type
- copy files to resource area
hive
- PROBLEM: remove from core completely?
3rd party
- needs docs
Solution of caching problems
Teachers often do not understand that files may be cached in browsers, se the same mechanism already implemented in SCORM module.
- Internally store all files as itemid=0
- Add new revision db field into resource table
- When serving files always construct links with itemid==revision
- Ignore itemid for resource files in pluginfile.php
Code refactoring and UI changes proposal
- mod/resource/page - replaces Plain text, wiki and HTML resources
- mod/resource/file - one or more uploaded files one is marked as the main file
- mod/resource/directory - one or more uploaded files
- mod/resource/link - links to external files
See also
- Development:Using the file API
- Development:Repository API
- Development:Portfolio API
- Development:File API
- MDL-14589 - File API Meta issue
- MDL-16089 - Resource module conversion