Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

This file contains the upgrade code to upgrade from mod_assignment to mod_assign

Copyright: 2012 NetSpot {@link http://www.netspot.com.au}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 416 lines (20 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class

assign_upgrade_manager:: (2 methods):
  upgrade_assignment()
  duplicate_course_module()


Class: assign_upgrade_manager  - X-Ref

Class to manage upgrades from mod_assignment to mod_assign

upgrade_assignment($oldassignmentid, & $log)   X-Ref
This function converts all of the base settings for an instance of
the old assignment to the new format. Then it calls each of the plugins
to see if they can help upgrade this assignment.

return: bool true or false
param: int $oldassignmentid (don't rely on the old assignment type even being installed)
param: string $log This string gets appended to during the conversion process

duplicate_course_module(stdClass $cm, $moduleid, $newinstanceid)   X-Ref
Create a duplicate course module record so we can create the upgraded
assign module alongside the old assignment module.

return: mixed stdClass|bool The new course module record or FALSE
param: stdClass $cm The old course module record
param: int $moduleid The id of the new assign module
param: int $newinstanceid The id of the new instance of the assign module