From 01f9bc7948aab7ba59cd67a89c82c655d499172a Mon Sep 17 00:00:00 2001 From: Rajesh Taneja Date: Wed, 3 Aug 2011 13:09:08 +0800 Subject: [PATCH] MDL-28580 Administration: Added sanity check to grab wrong usage of upgrade_main_savepoint --- lib/upgradelib.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/upgradelib.php b/lib/upgradelib.php index f6e6c74d78c..6a93f6e57ec 100644 --- a/lib/upgradelib.php +++ b/lib/upgradelib.php @@ -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); }