Note: You are currently viewing documentation for Moodle 2.3. Up-to-date documentation for the latest stable version is available here: Resource module file API migration.

Development:Resource module file API migration: Difference between revisions

From MoodleDocs
Line 75: Line 75:
* mod/resourcelink - links to external files
* mod/resourcelink - links to external files


: +1 to shorter names, like "rsrcfile, rsrcdir ..." due to DB restrictions mainly. ~~----
: +1 to shorter names, like "rsrcfile, rsrcdir ..." due to DB restrictions mainly. --[[User:Eloy Lafuente (stronk7)|Eloy Lafuente (stronk7)]] 16:20, 19 May 2009 (UTC)


Activities block would have to be updated to group all resources onto one page instead of listing all resource modules separately.
Activities block would have to be updated to group all resources onto one page instead of listing all resource modules separately.

Revision as of 16:20, 19 May 2009

Template:Moodle 2.0

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? Yes, why not? --Eloy Lafuente (stronk7) 16:18, 19 May 2009 (UTC)
  • 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

  1. Recursively copy directory to resource area, skip backup and moddata contents

Text and web page

  1. Convert to one plug-in using new editor forms element
  2. Copy directly linked files that may not contain other relative links to resource area
  3. PROBLEM: deal somehow with html, flash, and java; maybe just warn and manual migration button

Links to files

  1. Links to external sites do not need any upgrade
  2. If link points to simple file (image, sound, pdf.) copy to resource area
  3. PROBLEM: links to different courses - already problem now, maybe just warn teachers
  4. PROBLEM: links to files that may contain other relative links (html, flash, java)

IMS type

  1. copy files to resource area

hive

  1. PROBLEM: remove from core completely?

3rd party

  1. 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.

  1. Internally store all files as itemid=0
  2. Add new revision db field into resource table
  3. When serving files always construct links with itemid==revision
  4. Ignore itemid for resource files in pluginfile.php

Code refactoring and UI changes proposal

Technically it would be difficult to split current Resource into multiple modules. The idea of module subplugins was only implemented only partially, it should be much easier to split unmaintained plugins into separate modules in contrib. Considering long term maintenance and support costs it might be better to create a minimal resource-like module skeleton in contrib instead of encouraging people to create new unofficial resource plugins.

Subplugin related problems

  1. no standard subplugin APIs
  2. all internal module API frozen - no internal refactoring allowed
  3.  subplugin regression more likely
  4. sloppy db table structures - many universal columns with
  5. no standard way to upgrade subplugins - main version file needs to be bumped up
  6. no standard way to uninstall subplugin - db table leftovers
  7. capability in subplugins not supported
  8. subplugin upgrade paths are chaotic - not linked to main plugin version
  9. subplugins can not have own lang packs
  10. subplugins do not have own logging actions
  11. instead of reducing code duplication advanced plugins may duplicate a lot more core
  12.  it is not easy to move unmaintained subplugins into contrib
  13. unofficial subplugins not reported during upgrade

Option 1: split Resource into multiple modules

  • mod/resourse - formatted text pages
  • mod/resourcefile - one or more uploaded files
  • mod/resourcedir - directory structure
  •  mod/resourcelink - links to external files
+1 to shorter names, like "rsrcfile, rsrcdir ..." due to DB restrictions mainly. --Eloy Lafuente (stronk7) 16:20, 19 May 2009 (UTC)

Activities block would have to be updated to group all resources onto one page instead of listing all resource modules separately.

Option 2: keep Resource submodules

Resource module

  • 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

Separate contrib modules

  • Migration to separate IMS module - contrib
  •  New local files module - contrib
  • (No idea what to do with hive repositories)

See also