Migration of 1.2.1 to 2.0
  Welcome
 



This wizard will perform the migration of version 1.2.1 to 2.0 .

Before you continue , please make sure you have made a backup of you MYSQL database.
This can be done with PHPMYADMIN or a simular tool.
 

  Step 1
Database migration.
 


Tables will be altered during the next step..
Click on continue.
 

  Step 2
 

" ; include("../configuration/database.inc.php"); mysql_connect("$db_server", "$db_username", "$db_password"); mysql_select_db("$db_name"); $RecordCount = 0 ; $query = "SELECT config_value FROM $table_configuration where config_key='send_alerts'" ; $result = mysql_query($query) or die_script(mysql_error()); $RecordCount = mysql_num_rows($result); if($RecordCount == 1) { Print "Send Alerts already exists,
" ; } else { mysql_query("INSERT INTO $table_configuration VALUES ('send_alerts', '1', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { Print "Alerts send added to configuration!
" ; } } $RecordCount = 0 ; $query = "SELECT config_value FROM $table_configuration where config_key='send_alerts_per_section'" ; $result = mysql_query($query) or die_script(mysql_error()); $RecordCount = mysql_num_rows($result); if($RecordCount == 1) { Print "Send Alerts per section already exists,
" ; } else { mysql_query("INSERT INTO $table_configuration VALUES ('send_alerts_per_section', '1', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { Print "Alerts send per section added in configuration!
" ; } } $table_alerts = $dbprefix."alerts"; mysql_query("CREATE TABLE $table_alerts (id int(11) NOT NULL auto_increment, email varchar(80) NOT NULL default '', sections varchar(50) NOT NULL default '', name char(40) NOT NULL default '', PRIMARY KEY (id))"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { Print "Alerts table created.
" ; } $table_prot_pages = $dbprefix."prot_pages"; $table_prot_sections = $dbprefix."prot_sections"; mysql_query("ALTER TABLE $table_pages MODIFY category varchar(20) NOT NULL"); mysql_query("CREATE TABLE $table_prot_pages (id int(11) NOT NULL auto_increment, section varchar(10) NOT NULL default '', name varchar(80) NOT NULL default '', invisible varchar(10) NOT NULL default '', content text NOT NULL, module varchar(80) NOT NULL default '', sort TINYINT(4) NOT NULL default '0', count int(11), createdate date, lastvisitdate date, category char(20) NOT NULL, lastupdate DATE, PRIMARY KEY (id))"); mysql_query("CREATE TABLE $table_prot_sections (id int(11) NOT NULL auto_increment, name varchar(80) NOT NULL default '', invisible varchar(20) NOT NULL default '', frontpage int(11) NOT NULL default '0', parent varchar(120) NOT NULL default '', sort tinyint(4) NOT NULL default '0', PRIMARY KEY (id,id))"); print "Tables for protected area created!
" ; //Up/download $downloadstable = $dbprefix . "m_downloads"; $downloadcategorytable = $dbprefix . "m_downloads_cat"; mysql_query("CREATE TABLE $downloadcategorytable (id int(11) NOT NULL auto_increment, title varchar(40) NOT NULL default '', ispage tinyint NOT NULL default '0' , KEY (id))"); mysql_query("CREATE TABLE $downloadstable (id int(11) NOT NULL auto_increment, description text NOT NULL, category int(11) NOT NULL default '0', creator varchar(80) NOT NULL default '', filename varchar(80) NOT NULL default '', date timestamp(14) NOT NULL, PRIMARY KEY (id))"); mysql_query("INSERT INTO $table_modules VALUES (NULL, 'Up/Download', 'sn_downloads', 'download_cat.php,Download page (categories),download_pag.php,Download page (per page),upload.php,Upload ', 'admin.php', '$downloadstable,$downloadcategorytable ')"); mysql_query("INSERT INTO $table_configuration VALUES ('download_welcome_text', 'Download welcome text, see module configuration', '')"); print "Tables for download module created!
" ; $table_stats = $dbprefix."stats"; mysql_query("CREATE TABLE $table_stats (id int default '0' not null auto_increment, ip varchar(15) not null, received date not null, pageid varchar(10) not null, sectionid varchar(10) not null, primary key (id) )"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } mysql_query("INSERT INTO $table_configuration VALUES ('stats_ip_filter', '', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { print "Tables for new statistics is created!
" ; } mysql_query("INSERT INTO $table_configuration VALUES ('protected_theme', 'standard', '')"); mysql_query("INSERT INTO $table_configuration VALUES ('protected_startsection', '1', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { print "Theme entry for protected area in configuration created!
" ; } mysql_query("ALTER TABLE $table_users MODIFY email varchar(80)") ; if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } mysql_query("ALTER TABLE $table_teachers MODIFY email varchar(80)") ; if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } mysql_query("ALTER TABLE $table_studentpages ADD send_email tinyint") ; if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } mysql_query("ALTER TABLE $table_studentpages ADD title varchar(15)") ; if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } mysql_query("ALTER TABLE $table_studentpages ADD dir_number int(11)") ; if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } mysql_query("UPDATE $table_studentpages SET dir_number = studentid WHERE studentid > 0") ; if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { print "Migration for pupil pages finished

" ; } $RecordCount = 0 ; $query = "SELECT config_value FROM $table_configuration where config_key='email_text'" ; // getting the email welcome text $result = mysql_query($query) or die_script(mysql_error()); $RecordCount = mysql_num_rows($result); if($RecordCount == 1) { Print "Welcome text already exists,
" ; } else { mysql_query("INSERT INTO $table_configuration VALUES ('email_text', 'Here comes youre welcome text, see mail module configuration.', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { Print "Welcome text added in configuration!
" ; } } unset($query); unset($result); $RecordCount = 0 ; $query = "SELECT config_value FROM $table_configuration where config_key='email_thankyou_text'" ; // getting the email welcome text $result = mysql_query($query) or die_script(mysql_error()); $RecordCount = mysql_num_rows($result); if($RecordCount == 1) { Print "Thankyou text already exists!
" ; } else { mysql_query("INSERT INTO $table_configuration VALUES ('email_thankyou_text', '

Your message has been send,

Thank you very much.

', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { Print "Thankyou text added in configuration!
" ; } } $RecordCount = 0 ; $query = "SELECT config_value FROM $table_configuration where config_key='gbook_welcome_text'" ; // getting the gbook welcome text $result = mysql_query($query) or die_script(mysql_error()); $RecordCount = mysql_num_rows($result); if($RecordCount == 1) { Print "Guestbook welcome text already exists!
" ; } else { mysql_query("INSERT INTO $table_configuration VALUES ('gbook_welcome_text', '', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { Print "Guestbook welcome text added in configuration!
" ; } } mysql_query("INSERT INTO $table_modules VALUES (NULL, 'Sitemap', 'sn_sitemap', 'view_sitemap.php,Sitemap', 'admin.php', '')"); if (mysql_errno() != 0) { echo mysql_errno() . ": " . mysql_error(). "\n"; } else { print "Sitemap module has been installed in modules table!.
"; } echo "Migration is finished for version 2.0
You can now continue normal operation on your site." ; ?>

The S@S team.