From: skodak Date: Thu, 27 Nov 2008 22:14:34 +0000 (+0000) Subject: MDL-17405 moving Data mod upgrade notification to proper place (upgrade.php) - better... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3c67721aa1d530d26fad722fc7a84a20a836f131;p=moodle.git MDL-17405 moving Data mod upgrade notification to proper place (upgrade.php) - better notification will be implemented in MDL-17427 --- diff --git a/admin/environment.xml b/admin/environment.xml index 9c1c2bac42..315dadea67 100644 --- a/admin/environment.xml +++ b/admin/environment.xml @@ -277,8 +277,6 @@ - - diff --git a/mod/data/db/upgrade.php b/mod/data/db/upgrade.php index 5ffbde45fa..af5d8efd3a 100644 --- a/mod/data/db/upgrade.php +++ b/mod/data/db/upgrade.php @@ -149,6 +149,27 @@ function xmldb_data_upgrade($oldversion) { upgrade_mod_savepoint($result, 2008091400, 'data'); } + if ($result && $oldversion < 2008112700) { + if (!get_config('data', 'requiredentriesfixflag')) { + unset_config('requiredentriesfixflag', 'data'); // remove old flag + $databases = $DB->get_records_sql("SELECT d.*, c.fullname + FROM {data} d, {course} c + WHERE d.course = c.id + AND (d.requiredentries > 0 OR d.requiredentriestoview > 0) + ORDER BY c.fullname, d.name"); + if (!empty($databases)) { + $a = new object(); + $a->text = ''; + foreach($databases as $database) { + $a->text .= $database->fullname." - " .$database->name. " (course id: ".$database->course." - database id: ".$database->id.")
"; + } + //TODO: MDL-17427 send this info to "upgrade log" which will be implemented in 2.0 + notify(get_string('requiredentrieschanged', 'admin', $a)); + } + } + upgrade_mod_savepoint($result, 2008112700, 'data'); + } + return $result; } diff --git a/mod/data/lib.php b/mod/data/lib.php index 822ab01ae3..d7664bf9f4 100755 --- a/mod/data/lib.php +++ b/mod/data/lib.php @@ -2540,42 +2540,6 @@ function data_pluginfile($course, $cminfo, $context, $filearea, $args) { return false; } -/** - * NOTE: this function is called into environment.xml - * Check if both of database required entries fields have been set for a version anterior to 2008112101 - * This check has been required by the bug MDL-16999 - * @global $CFG - * @param $result - * @return object status - */ -function data_check_required_entries_fields($result) { - global $CFG, $DB; - if (!empty($CFG->version) //we are not installing a new Moodle site - && $CFG->version < 2008112101 //the version is anterior to the one when the fix has been applied - && !get_config("data","requiredentriesfixflag")) { //do not show message when upgrading an anterior version when the patch has already been applied - set_config("requiredentriesfixflag",true,"data"); - $databases = $DB->get_records_sql("SELECT d.*, c.fullname - FROM {data} d, - {course} c - WHERE d.course = c.id - ORDER BY c.fullname, d.name"); - if (!empty($databases)) { - $a = new object(); - foreach($databases as $database) { - if ($database->requiredentries != 0 || $database->requiredentriestoview != 0) { - $a->text .= "".$database->fullname." - " .$database->name. " (course id: ".$database->course." - database id: ".$database->id.")
"; - //set the feedback string here and not in xml file since we need something - //more complex than just a string picked from admin.php lang file - $result->setFeedbackStr(array('requiredentrieschanged', 'admin', $a)); - $result->setStatus(false);//fail test - } - } - return $result; - } - } - return null; -} - require_once($CFG->libdir . '/portfoliolib.php'); class data_portfolio_caller extends portfolio_module_caller_base { diff --git a/mod/data/version.php b/mod/data/version.php index dd2a45e14f..7c61de22e8 100644 --- a/mod/data/version.php +++ b/mod/data/version.php @@ -5,7 +5,7 @@ // This fragment is called by /admin/index.php //////////////////////////////////////////////////////////////////////////////// -$module->version = 2008091400; +$module->version = 2008112700; $module->requires = 2008080701; // Requires this Moodle version $module->cron = 60;