mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-32895: Improvements to assignment upgrade tool for large numbers of assignments.
* Form to control the perpage variable for the upgradable assignments table. * Set timeout and increase memory limit for batch upgrades * Output/renderer pages to the upgrade progress is progressively displayed * Cleanup of relative includes in assignmentupgrade tool * More verbose errors reported for failed upgrades
This commit is contained in:
parent
71d7bc34a8
commit
5b12114476
13 changed files with 168 additions and 116 deletions
|
@ -29,6 +29,12 @@ require_once($CFG->dirroot.'/mod/assign/locallib.php');
|
|||
/** Include accesslib.php */
|
||||
require_once($CFG->libdir.'/accesslib.php');
|
||||
|
||||
/**
|
||||
* The maximum amount of time to spend upgrading a single assignment.
|
||||
* This is intentionally generous (5 mins) as the effect of a timeout
|
||||
* for a legitimate upgrade would be quite harsh (roll back code will not run)
|
||||
*/
|
||||
define('ASSIGN_MAX_UPGRADE_TIME_SECS', 300);
|
||||
|
||||
/**
|
||||
* Class to manage upgrades from mod_assignment to mod_assign
|
||||
|
@ -48,9 +54,7 @@ class assign_upgrade_manager {
|
|||
* @return bool true or false
|
||||
*/
|
||||
public function upgrade_assignment($oldassignmentid, & $log) {
|
||||
global $DB, $CFG;
|
||||
// steps to upgrade an assignment
|
||||
|
||||
global $DB, $CFG, $USER;
|
||||
// steps to upgrade an assignment
|
||||
|
||||
|
@ -59,6 +63,9 @@ class assign_upgrade_manager {
|
|||
return false;
|
||||
}
|
||||
|
||||
// should we use a shutdown handler to rollback on timeout?
|
||||
@set_time_limit(ASSIGN_MAX_UPGRADE_TIME_SECS);
|
||||
|
||||
|
||||
// get the module details
|
||||
$oldmodule = $DB->get_record('modules', array('name'=>'assignment'), '*', MUST_EXIST);
|
||||
|
@ -217,7 +224,7 @@ class assign_upgrade_manager {
|
|||
|
||||
} catch (Exception $exception) {
|
||||
$rollback = true;
|
||||
$log .= get_string('conversionexception', 'mod_assign', $exception->getMessage());
|
||||
$log .= get_string('conversionexception', 'mod_assign', $exception->error);
|
||||
}
|
||||
|
||||
if ($rollback) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue