? MDL-17931-v2.patch
? MDL-17931.patch
? mdl-17629-1.9.patch
? silent.patch
? unmergedfiles.txt
? question/type/flashdd
Index: version.php
===================================================================
RCS file: /cvsroot/moodle/moodle/version.php,v
retrieving revision 1.563.2.773
diff -u -r1.563.2.773 version.php
--- version.php	14 Jan 2010 00:38:03 -0000	1.563.2.773
+++ version.php	14 Jan 2010 04:57:39 -0000
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2007101571.01;  // YYYYMMDD      = date of the 1.9 branch (don't change)
+    $version = 2007101571.02;  // YYYYMMDD      = date of the 1.9 branch (don't change)
                             //         X     = release number 1.9.[0,1,2,3,4,5...]
                             //          Y.YY = micro-increments between releases
 
Index: lib/db/upgrade.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/db/upgrade.php,v
retrieving revision 1.154.2.70
diff -u -r1.154.2.70 upgrade.php
--- lib/db/upgrade.php	11 Jan 2010 02:29:08 -0000	1.154.2.70
+++ lib/db/upgrade.php	14 Jan 2010 04:57:41 -0000
@@ -3314,6 +3314,11 @@
         upgrade_main_savepoint($result, 2007101571.01);
     }
 
+    if ($result && $oldversion < 2007101571.02) {
+        upgrade_fix_incorrect_mnethostids();
+        upgrade_main_savepoint($result, 2007101571.02);
+    }
+
     return $result;
 }
 
Index: lib/db/upgradelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/db/upgradelib.php,v
retrieving revision 1.9.2.9
diff -u -r1.9.2.9 upgradelib.php
--- lib/db/upgradelib.php	9 May 2009 01:45:27 -0000	1.9.2.9
+++ lib/db/upgradelib.php	14 Jan 2010 04:57:41 -0000
@@ -607,6 +607,17 @@
     $current_mnet_localhost_host = get_record('mnet_host', 'wwwroot', addslashes($CFG->wwwroot)); /// By wwwroot
     $current_mnet_all_hosts_host = get_record_select('mnet_host', sql_isempty('mnet_host', 'wwwroot', false, false)); /// By empty wwwroot
 
+    if (!$moodleapplicationid = get_field('mnet_application', 'id', 'name', 'moodle')) {
+        $m = (object)array(
+            'name'              => 'moodle',
+            'display_name'      => 'Moodle',
+            'xmlrpc_server_url' => '/mnet/xmlrpc/server.php',
+            'sso_land_url'      => '/auth/mnet/land.php',
+            'sso_jump_url'      => '/auth/mnet/land.php',
+        );
+        $moodleapplicationid = insert_record('mnet_application', $m);
+    }
+
 /// Create localhost_host if necessary (pretty improbable but better to be 100% in the safe side)
 /// Code stolen from mnet_environment->init
     if (!$current_mnet_localhost_host) {
@@ -619,6 +630,7 @@
         $current_mnet_localhost_host->last_log_id        = 0;
         $current_mnet_localhost_host->deleted            = 0;
         $current_mnet_localhost_host->name               = '';
+        $current_mnet_localhost_host->applicationid      = $moodleapplicationid;
     /// Get the ip of the server
         if (empty($_SERVER['SERVER_ADDR'])) {
         /// SERVER_ADDR is only returned by Apache-like webservers
@@ -648,6 +660,7 @@
         $current_mnet_all_hosts_host->last_log_id        = 0;
         $current_mnet_all_hosts_host->deleted            = 0;
         $current_mnet_all_hosts_host->name               = 'All Hosts';
+        $current_mnet_all_hosts_host->applicationid      = $moodleapplicationid;
         $current_mnet_all_hosts_host->id                 = insert_record('mnet_host', $current_mnet_all_hosts_host, true);
     }
 
@@ -689,6 +702,12 @@
         set_field('user', 'mnethostid', $current_mnet_localhost_host->id, 'id', $rec->id);
     }
     rs_close($rs);
+
+    // fix up any host records that have incorrect ids
+    error_log("setting app id to $moodleapplicationid where id = $current_mnet_localhost_host->id or id = $current_mnet_all_hosts_host->id");
+    set_field_select('mnet_host', 'applicationid', $moodleapplicationid, "id = $current_mnet_localhost_host->id or id = $current_mnet_all_hosts_host->id");
+
+
 }
 
 ?>
