]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-17405 moving Data mod upgrade notification to proper place (upgrade.php) - better...
authorskodak <skodak>
Thu, 27 Nov 2008 22:14:34 +0000 (22:14 +0000)
committerskodak <skodak>
Thu, 27 Nov 2008 22:14:34 +0000 (22:14 +0000)
admin/environment.xml
mod/data/db/upgrade.php
mod/data/lib.php
mod/data/version.php

index 9c1c2bac423b0799a5a892c480326e578041956b..315dadea677319eefb733d15e2fccee02b3b6b2a 100644 (file)
           <ON_CHECK message="globalswarning" />
         </FEEDBACK>
       </CUSTOM_CHECK>
-       <CUSTOM_CHECK file="mod/data/lib.php" function="data_check_required_entries_fields" level="optional">
-      </CUSTOM_CHECK>
     </CUSTOM_CHECKS>
   </MOODLE>
 </COMPATIBILITY_MATRIX>
index 5ffbde45faa09b7ee040e8319de4757a58f8ceb4..af5d8efd3a6a495da979f6d19cfe02230885223b 100644 (file)
@@ -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.")<br/>";
+                }
+                //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;
 }
 
index 822ab01ae315c0925c2848181c45845521b20eca..d7664bf9f4775efc112780a24023304c6559f30c 100755 (executable)
@@ -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 <type> $CFG
- * @param <type> $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.")<br/>";
-                    //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 {
 
index dd2a45e14f8aed09321de874a8d1c79ffbdec862..7c61de22e8aa1e545b56965d9b91e0e8972f3b42 100644 (file)
@@ -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;