Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Migrating to 2.0 checklist.

Development:Migrating to 2.0 checklist: Difference between revisions

From MoodleDocs
(New page: h1. Plugin migration checklist 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 che...)
 
No edit summary
Line 1: Line 1:
h1. Plugin migration checklist
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 [[Development:Migrating_contrib_code_to_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 [[]]


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!
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!
Line 7: Line 5:
Please add/edit this list!
Please add/edit this list!


h2. Database
==Database==


* Leave empty db/update.php file
* Leave empty db/update.php file
Line 20: Line 18:
* Update version.php numbers (esp required)
* Update version.php numbers (esp required)


h2. Page display
==Page display==


* New $OUTPUT header and footer functions
* New $OUTPUT header and footer functions
Line 32: Line 30:




h2. Roles and Permissions:
==Roles and Permissions:==


* array name to $capabilities in access.php
* array name to $capabilities in access.php
Line 41: Line 39:
*      isguest() is depreicated, use !isloggedin() || isguestuser() instead
*      isguest() is depreicated, use !isloggedin() || isguestuser() instead


h2. Language strings
==Language strings==


* Rename language folder
* Rename language folder
Line 49: Line 47:
* Add $string[‘pluginadministration’] to lang file
* Add $string[‘pluginadministration’] to lang file


h2. Forms
==Forms==


* Param_clean parameter type removed
* Param_clean parameter type removed
Line 57: Line 55:
*      Change setHelpButton to addHelpButton. (You need to change the arguments, but the new ones are simpler.)
*      Change setHelpButton to addHelpButton. (You need to change the arguments, but the new ones are simpler.)


h2. General
==General==


* Swap config_ files to edit and settings php files
* Swap config_ files to edit and settings php files

Revision as of 15:02, 27 January 2011

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 Development: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
  • 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)

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: https://docs.moodle.org/en/Development: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');
  • Update the code template at the top of each file (see Code template guidelines for details
  • Add 'supports' function in lib (modname_supports()) for modules (and blocks?).