MDL-28580 Administration: Added sanity check to grab wrong usage of upgrade_main_savepoint

This commit is contained in:
Rajesh Taneja
2011-08-19 07:37:48 +00:00
parent 4f3632441a
commit bb44ef990f
+6
View File
@@ -114,6 +114,12 @@ class plugin_defective_exception extends moodle_exception {
function upgrade_main_savepoint($result, $version, $allowabort=true) {
global $CFG;
//sanity check to avoid confusion with upgrade_mod_savepoint usage.
if (!is_bool($allowabort)) {
$errormessage = 'Parameter type mismatch. Are you mixing up upgrade_main_savepoint() and upgrade_mod_savepoint()?';
throw new coding_exception($errormessage);
}
if (!$result) {
throw new upgrade_exception(null, $version);
}