" ; } switch ($sas_version) // start of switch { case "2.400": //level is ok , quit here mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); $step1 = 0 ; $step2 = 0 ; $step3 = 0 ; break; case "2.401": //level is ok , quit here mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); $step1 = 0 ; $step2 = 0 ; $step3 = 0 ; break; case "2.402": //level is ok , quit here mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); $step1 = 0 ; $step2 = 0 ; $step3 = 0 ; break; case "2.403": //level is ok , quit here print "Your Site@School version is already up to the right level!."; $step1 = 0 ; $step2 = 0 ; $step3 = 0 ; break; case "2.400f": //level is ok , quit here mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); $step1 = 0 ; $step2 = 0 ; $step3 = 0 ; break; case "2.400e": //level is ok , quit here mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); $step1 = 0 ; $step2 = 0 ; $step3 = 0 ; break; case "2.400d": //level is ok , just alter the patch version mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); $step1 = 0 ; $step2 = 0 ; $step3 = 0 ; break; case "2.400c": //only do step3 //set new patch version mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); $step1 = 0 ; $step2 = 0 ; $step3 = 1 ; break; case "2.400b": //only do download module (step2) $step1 = 0 ; $step2 = 1 ; $step3 = 1 ; //set new patch version mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); break; case "2.400a": //only do download module (step2) $step1 = 0 ; $step2 = 1 ; $step3 = 1 ; //set new patch version mysql_query("UPDATE $table_configuration SET config_value = '03' WHERE config_key = 'sas_patch_version'"); break; default: //sas version 2.3 I assume. $step1 = 1 ; $step2 = 1 ; $step3 = 1 ; mysql_query("INSERT INTO $table_configuration VALUES ('sas_version', '2.4', 'Sas main version')"); mysql_query("INSERT INTO $table_configuration VALUES ('sas_patch_version', '03', 'Sas patch version')"); break; } if($step1 == 1) { //configuration table, search module fix mysql_query("UPDATE $table_configuration SET config_value = 'studentid,title,content' WHERE config_key = 'search_module_returnfield3' "); //users table mysql_query("ALTER TABLE $table_users MODIFY class varchar(80)"); mysql_query("ALTER TABLE $table_users MODIFY project varchar(80)"); mysql_query("ALTER TABLE $table_users ADD initial tinyint(1) default 0") ; // pupilpages module mysql_query("ALTER TABLE $table_studentpages ADD sort tinyint(4) not null default 0"); mysql_query("ALTER TABLE $table_studentpages ADD invisible tinyint(1) not null default 0"); print "Pupilpages table has been altered.
"; //downloads $table_downloads = $dbprefix ."m_downloads"; mysql_query("ALTER TABLE $table_downloads ADD counter tinyint(11) default 0"); print "Downloads table has been altered.
"; //newsletter $table_newsletters = $dbprefix ."m_newsletter_cat"; mysql_query("ALTER TABLE $table_newsletters MODIFY title text"); mysql_query("ALTER TABLE $table_newsletters ADD template text default null"); print "Newsletter table has been altered.
"; //stats $table_stats = $dbprefix."stats" ; //check if the public field already exists $result = mysql_query("SHOW COLUMNS FROM $table_stats LIKE 'public'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); } if (mysql_num_rows($result) == 0) { mysql_query("ALTER TABLE $table_stats ADD public tinyint(4)"); mysql_query("UPDATE TABLE $table_stats SET public=0 WHERE id > 0"); print "Table alterations for the stats has been done!
"; } //gbook $modtable_guestbook = "$dbprefix" . "m_gbook"; mysql_query("ALTER TABLE $modtable_guestbook add initial tinyint(1) default 1"); mysql_query("INSERT INTO $table_configuration VALUES('gbook_check_before_post' , '0' , '')") ; //ads $modtable_ads = "$dbprefix" . "adtext"; mysql_query("ALTER TABLE $modtable_ads add initial tinyint(1) default 1"); mysql_query("INSERT INTO $table_configuration VALUES('ads_check_before_post' , '0' , '')") ; //downloads mysql_query("INSERT INTO $table_configuration VALUES('download_welcome_text_prot' , 'Welcome text protected area' , '')") ; //message $message_table = $dbprefix . "m_message"; mysql_query("CREATE TABLE $message_table ( id int(11) NOT NULL auto_increment, message text NOT NULL, date datetime default NULL, name varchar(45) default NULL, days int(11) default 0, todate date, PRIMARY KEY (id))"); $result = mysql_query("SELECT id FROM $table_modules WHERE location = 'sn_message'"); $RecordCount = mysql_num_rows($result); if($RecordCount == 0) { mysql_query("INSERT INTO $table_modules VALUES (NULL, 'Messages', 'sn_message', 'message.php,Add messages,view_message.php,View messages', 'admin.php', '')"); mysql_query("INSERT INTO $table_configuration VALUES ('message_add_text', 'Add a Message
"; } print "
Migration is finished, current Site@School version is: 2.4.03 You can now continue normal operation on your site.
"; print "Please don't forget to delete the content of the starnet/install directory when you are finished!" ; ?> The S@S team.