Migrating to 2.0 checklist: Difference between revisions
From MoodleDocs
Jenny Gray (talk | contribs) (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...) |
David Mudrak (talk | contribs) m (Reverted edits by Mudrd8mz (talk) to last revision by Jean FRUITET) Tag: Rollback |
||
(13 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{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 [[]] | 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! | 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 7: | ||
Please add/edit this list! | Please add/edit this list! | ||
==Database== | |||
* Leave empty db/update.php file | * Leave empty db/update.php file | ||
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 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 19: | 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== | |||
* New $OUTPUT header and footer functions | * New $OUTPUT header and footer functions | ||
Line 32: | Line 34: | ||
==Roles and Permissions:== | |||
* array name to $capabilities in access.php | * array name to $capabilities in access.php | ||
Line 41: | Line 43: | ||
* isguest() is depreicated, use !isloggedin() || isguestuser() instead | * isguest() is depreicated, use !isloggedin() || isguestuser() instead | ||
==Language strings== | |||
* Rename language folder | * Rename language folder | ||
Line 49: | Line 51: | ||
* Add $string[‘pluginadministration’] to lang file | * Add $string[‘pluginadministration’] to lang file | ||
==Forms== | |||
* Param_clean parameter type removed | * Param_clean parameter type removed | ||
Line 57: | Line 59: | ||
* 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.) | ||
==General== | |||
* Swap config_ files to edit and settings php files | * Swap config_ files to edit and settings php files | ||
* Fix whitespace & coding style | * 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(); | * 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: | * Check functions deprecated list: [[Deprecated_functions_in_2.0]] | ||
* Use print_error() or throw new moodle_exception not error() | * Use print_error() or throw new moodle_exception not error() | ||
* Replace all url strings e.g. in redirect() calls with moodle_url instances | * 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 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'); | * 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?). | * 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 == | |||
* [[Migrating contrib code to 2.0]] | |||
* [[User:Frank Ralf/Experience of converting a module to Moodle 2]] by Sam Marshall |
Latest revision as of 13:11, 9 August 2021
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).