Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Migrating to 2.0 checklist: Difference between revisions

From MoodleDocs
Line 14: Line 14:
* Add and strip slashes no longer required
* Add and strip slashes no longer required
* Remove use of ENUM and ENUMVALUES in install.xml file
* Remove use of ENUM and ENUMVALUES in install.xml file
*      Remove STATEMENTS section, use db/install.php or db/log.php instead.
*      Remove STATEMENTS section in install.xml file, use db/install.php or db/log.php instead.
* check use of sql_substr()  
* check use of sql_substr()  
* Get_records() etc now always returning arrays, empty array in case of no records found.  
* Get_records() etc now always returning arrays, empty array in case of no records found.  
Line 20: Line 20:
* DB functions offer strictness parameters e.g MUST_EXIST
* DB functions offer strictness parameters e.g MUST_EXIST
* Update version.php numbers (esp required)
* Update version.php numbers (esp required)
*      In version.php add $module->requires = 2010080300;  // Requires this Moodle version


==Page display==
==Page display==

Revision as of 13:13, 4 May 2011

Moodle 2.0


These are things that OU developers have found so far to check/do in code we're migrating from Moodle 1.9 to 2.0. All information on the detail of this checklist can be found elsewhere in Moodle Docs, and particularly from the Migrating_contrib_code_to_2.0

Not all these things are essential for a rush job, but if you did all of them, then that'd be great. We should really mark each one with a priority of some sort!

Please add/edit this list!

Database

  • Leave empty db/update.php file
  • New $DB global objects with functions replace old db functions
  • $DB parameters swapped to ?
  • Add and strip slashes no longer required
  • Remove use of ENUM and ENUMVALUES in install.xml file
  • Remove STATEMENTS section in install.xml file, use db/install.php or db/log.php instead.
  • check use of sql_substr()
  • Get_records() etc now always returning arrays, empty array in case of no records found.
  • Db functions throw errors not return false on error
  • DB functions offer strictness parameters e.g MUST_EXIST
  • Update version.php numbers (esp required)
  • In version.php add $module->requires = 2010080300; // Requires this Moodle version

Page display

  • New $OUTPUT header and footer functions
  • Navigation links need to use $PAGE->navbar
  • Make sure that you instantiate the moodle form before any call to $OUTPUT->header()
  • Create a renderer
  • Change the way image urls are displayed (not $CFG->pixpath any more)
  • CSS changes
    • Change styles.php to styles.css
    • Change page id to new structure e.g. course-format-studyplan to page-course-view-studyplan


Roles and Permissions:

  • array name to $capabilities in access.php
  • Remove references to admin in access.php
  • Rename legacy to archetypes in access.php
  • Add manager archetype in access.php
  • Ensure require_login as well as require_capability checks
  • isguest() is depreicated, use !isloggedin() || isguestuser() instead

Language strings

  • Rename language folder
  • Change $a to {$a} in language files
  • Change popup help files to _help lang strings and shorten
  • Add $string[‘pluginname’] to lang file
  • Add $string[‘pluginadministration’] to lang file

Forms

  • Param_clean parameter type removed
  • type required parameter for optional_and required_param
  • Replace file form elements with new filepicker
  • Replace htmleditor with editor form field type
  • Change setHelpButton to addHelpButton. (You need to change the arguments, but the new ones are simpler.)

General

  • Swap config_ files to edit and settings php files
  • Fix whitespace & coding style
  • rs_fetch_next_record($rs) is deprecated, in favour of the simple foreach($rs as $var). Calls to rs_close() must be replaced by $rs->close();
  • Check functions deprecated list: Deprecated_functions_in_2.0
  • Use print_error() or throw new moodle_exception not error()
  • Replace all url strings e.g. in redirect() calls with moodle_url instances
  • Move install/uninstall functions from lib to db/install.php, lib/uninstall.php
  • Move images into pix folder (especially icon.gif), get path by calling $OUTPUT->pix_url('icon', 'local_whatever');
  • Add 'supports' function in lib (modname_supports()) for modules (and blocks?).
  • New Backup and Restore process - Backup_2.0_for_developers, Restore_2.0_for_developers.
  • Add db/log.php file if you have log calls (see any of the core modules for examples).

See also