]> git.mjollnir.org Git - moodle.git/commitdiff
bug fix for 5303. hope i didn't break anything >_<
authortoyomoyo <toyomoyo>
Fri, 28 Apr 2006 03:18:56 +0000 (03:18 +0000)
committertoyomoyo <toyomoyo>
Fri, 28 Apr 2006 03:18:56 +0000 (03:18 +0000)
12 files changed:
backup/db/mysql.php
backup/version.php
lib/db/mysql.php
mod/journal/db/mysql.php
mod/journal/version.php
mod/resource/db/mysql.php
mod/resource/version.php
mod/survey/db/mysql.php
mod/survey/version.php
mod/wiki/db/mysql.php
mod/wiki/version.php
version.php

index 1fa25b2b3e1ada9c1888f499bd9717fd9d901986..e49ccb6c2c8272d5ee3015e93c4bdc0e15a18f45 100644 (file)
@@ -149,11 +149,18 @@ function backup_upgrade($oldversion=0) {
 
     // chaing default nulls to not null default 0
     
-    if ($oldversion < 2006042600) {
+    if ($oldversion < 2006042800) {
 
+        execute_sql("UPDATE {$CFG->prefix}backup_files SET old_id='0' WHERE old_id IS NULL");
         table_column('backup_files','old_id','old_id','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}backup_files SET new_id='0' WHERE new_id IS NULL");
         table_column('backup_files','new_id','new_id','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}backup_ids SET new_id='0' WHERE new_id IS NULL");
         table_column('backup_ids','new_id','new_id','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}backup_ids SET info='' WHERE info IS NULL");
         table_column('backup_ids','info','info','mediumtext','','','','not null');
     }
 
index 902fa42f86726433e8de02ec86588707382ad21f..a518476a724841921bd8e71712fb18730392517d 100644 (file)
@@ -5,6 +5,6 @@
 // database (backup_version) to determine whether upgrades should
 // be performed (see db/backup_*.php)
 
-$backup_version = 2006042600;   // The current version is a date (YYYYMMDDXX)
+$backup_version = 2006042800;   // The current version is a date (YYYYMMDDXX)
 
 $backup_release = "1.6beta1";  // User-friendly version number
index d781f926719c8bade3b17150d14e2939cc41bcc8..206ffe88a639bef3a86256b7a1c30d700d02a44d 100644 (file)
@@ -1841,33 +1841,83 @@ function main_upgrade($oldversion=0) {
      * mysql tables, to prevent 5303 and be consistent *
      ***************************************************/
 
-    if ($oldversion < 2006042600) {
+    if ($oldversion < 2006042800) {
 
+        execute_sql("UPDATE {$CFG->prefix}grade_category SET name='' WHERE name IS NULL");
         table_column('grade_category','name','name','varchar','64','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}grade_category SET weight='0' WHERE weight IS NULL");
         execute_sql("ALTER TABLE {$CFG->prefix}grade_category change weight weight decimal(5,2) NOT NULL default 0.00");
+        execute_sql("UPDATE {$CFG->prefix}grade_item SET courseid='0' WHERE courseid IS NULL");
         table_column('grade_item','courseid','courseid','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}grade_item SET category='0' WHERE category IS NULL");
         table_column('grade_item','category','category','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}grade_item SET modid='0' WHERE modid IS NULL");
         table_column('grade_item','modid','modid','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}grade_item SET cminstance='0' WHERE cminstance IS NULL");
         table_column('grade_item','cminstance','cminstance','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}grade_item SET scale_grade='0' WHERE scale_grade IS NULL");
         execute_sql("ALTER TABLE {$CFG->prefix}grade_item change scale_grade scale_grade float(11,10) NOT NULL default 1.0000000000");
+        
+        execute_sql("UPDATE {$CFG->prefix}grade_preferences SET courseid='0' WHERE courseid IS NULL");
         table_column('grade_preferences','courseid','courseid','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET idnumber='' WHERE idnumber IS NULL");
         table_column('user','idnumber','idnumber','varchar','64','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET icq='' WHERE icq IS NULL");
         table_column('user','icq','icq','varchar','15','','','not null');
+        
+        execute_sql("UPDATE {$CFG->prefix}user SET skype='' WHERE skype IS NULL");
         table_column('user','skype','skype','varchar','50','','','not null');
+        
+        execute_sql("UPDATE {$CFG->prefix}user SET yahoo='' WHERE yahoo IS NULL");
         table_column('user','yahoo','yahoo','varchar','50','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET aim='' WHERE aim IS NULL");
         table_column('user','aim','aim','varchar','50','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET msn='' WHERE msn IS NULL");
         table_column('user','msn','msn','varchar','50','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET phone1='' WHERE phone1 IS NULL");
         table_column('user','phone1','phone1','varchar','20','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET phone2='' WHERE phone2 IS NULL");
         table_column('user','phone2','phone2','varchar','20','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET institution='' WHERE institution IS NULL");
         table_column('user','institution','institution','varchar','40','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET department='' WHERE department IS NULL");
         table_column('user','department','department','varchar','30','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET address='' WHERE address IS NULL");
         table_column('user','address','address','varchar','70','','','not null');
+        
+        execute_sql("UPDATE {$CFG->prefix}user SET city='' WHERE city IS NULL");
         table_column('user','city','city','varchar','20','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET country='' WHERE country IS NULL");
         table_column('user','country','country','char','2','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET lang='' WHERE lang IS NULL");
         table_column('user','lang','lang','varchar','10','','en','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET lastIP='' WHERE lastIP IS NULL");
         table_column('user','lastIP','lastIP','varchar','15','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET secret='' WHERE secret IS NULL");
         table_column('user','secret','secret','varchar','15','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET picture='0' WHERE picture IS NULL");
         table_column('user','picture','picture','tinyint','1','','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}user SET url='' WHERE url IS NULL");
         table_column('user','url','url','varchar','255','','','not null');
     }
     
index b5efd622cccd88ed6302df6c88c5829b1c40f7bf..76683c57aca04ec38e1def32d03ecccf76a5fe23 100644 (file)
@@ -69,8 +69,11 @@ function journal_upgrade($oldversion) {
         $wtm->update( 'journal_entries', 'text', 'format', $sql );
     }
 
-    if ($oldversion < 2006042600) {
+    if ($oldversion < 2006042800) {
+        execute_sql("UPDATE {$CFG->prefix}journal SET name='' WHERE name IS NULL");
         table_column('journal','name','name','varchar','255','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}journal SET intro='' WHERE intro IS NULL");
         table_column('journal','intro','intro','text','','','','not null');
     }
     return $result;
index 03f3b719a4c3b178de60e1db1065fb5d25aeddba..0e4d102009be9435e56e5fa6effc2334c22b9a1e 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006042600;
+$module->version  = 2006042800;
 $module->requires = 2005031000;  // Requires this Moodle version
 $module->cron     = 60;
 
index 94b9b9978f5d1b3475fcaa151dea344e46079274..b185254ad8a1a36bb41a8d1764849f9ad41537f1 100644 (file)
@@ -65,7 +65,8 @@ function resource_upgrade($oldversion) {
         $wtm->update( 'resource','alltext','options' );
     }
     
-    if ($oldversion < 2006042600) {
+    if ($oldversion < 2006042800) {
+        execute_sql("UPDATE {$CFG->prefix}resource SET reference='' WHERE reference IS NULL");
         table_column('resource','reference','reference','varchar','255','','','not null');
     }
 
index 4ccf37207512f70a9d17736ecb2a269f816964b7..90f9837bb8076e5e8fbab1812d7a13f755ae1ab4 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006042600;
+$module->version  = 2006042800;
 $module->requires = 2005021600;  // Requires this Moodle version
 $module->cron     = 0;
 
index 9ff8a461d23221543f547c994de4bf4f57fba0e0..48fecd427092c6041bdb7d0632d163d6093cfd24 100644 (file)
@@ -193,13 +193,24 @@ function survey_upgrade($oldversion) {
         modify_database('','ALTER TABLE prefix_survey_answers ADD INDEX question (question);');
     }
     
-    if ($oldversion < 2006042600) {
+    if ($oldversion < 2006042800) {
 
+        execute_sql("UPDATE {$CFG->prefix}survey SET questions='' WHERE questions IS NULL");
         table_column('survey','questions','questions','varchar','255','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}survey SET intro='' WHERE intro IS NULL");
         table_column('survey','intro','intro','text','','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}survey_answers SET time='0' WHERE time IS NULL");
         table_column('survey_answers','time','time','int','10','unsigned','0','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}survey_answers SET answer1='' WHERE answer1 IS NULL");
         table_column('survey_answers','answer1','answer1','text','','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}survey_answers SET answer2='' WHERE answer2 IS NULL");
         table_column('survey_answers','answer2','answer2','text','','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}survey_questions SET intro='' WHERE intro IS NULL");
         table_column('survey_questions','intro','intro','varchar','50','','','not null');
     }
 
index cffdf6076185a6f6fedadeaee04089de950ea6c4..1393a264a0dc76a4dab8cb26f437e75dcc2ec117 100644 (file)
@@ -5,7 +5,7 @@
 //  This fragment is called by /admin/index.php
 ////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006042600;
+$module->version  = 2006042800;
 $module->requires = 2005031000;  // Requires this Moodle version
 $module->cron     = 0;
 
index 8cc6860d91913d7767bf0f18e58c4922d2cdbb66..a75660d6bb387ef93c6f8940871b8585c6198315 100644 (file)
@@ -149,10 +149,15 @@ function wiki_upgrade($oldversion) {
         }
     }
 
-    if ($oldversion < 2006042600) {
+    if ($oldversion < 2006042800) {
 
+        execute_sql("UPDATE {$CFG->prefix}wiki SET summary='' WHERE summary IS NULL");
         table_column('wiki','summary','summary','text','','','','not null');
+
+        execute_sql("UPDATE {$CFG->prefix}wiki SET pagename='' WHERE pagename IS NULL");
         table_column('wiki','pagename','pagename','varchar','255','','','not null');
+        
+        execute_sql("UPDATE {$CFG->prefix}wiki SET initialcontent='' WHERE initialcontent IS NULL");
         table_column('wiki','initialcontent','initialcontent','varchar','255','','','not null');
     }
 
index 6ca24ba6b659a173c200bf75c370f030305b00aa..f81689528365a67e3276562a176974c23ff6ecde 100644 (file)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2006042600;  // The current module version (Date: YYYYMMDDXX)
+$module->version  = 2006042800;  // The current module version (Date: YYYYMMDDXX)
 $module->requires = 2005031000;  // The current module version (Date: YYYYMMDDXX)
 $module->cron     = 0;           // Period for cron to check this module (secs)
 
index 1c4a10ad28ecaa42fee04e1ffdcc5a754997f3f0..c8c59ac940a807abe26be83beedede2603cfbb1f 100644 (file)
@@ -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 = 2006042600;  // YYYYMMDD = date
+   $version = 2006042800;  // YYYYMMDD = date
                            //       XY = increments within a single day
 
    $release = '1.6 Beta 3';    // Human-friendly version name