From eb0542703351b5fbec8b9b59ea5b781b045ecb61 Mon Sep 17 00:00:00 2001 From: seek3r Date: Thu, 28 Sep 2000 09:23:09 +0000 Subject: [PATCH] completed upgrade procedures for mysql. someone else will have to do pgsql, because im too tired --- setup/index.php | 5 +- setup/lang_records.inc.php | 2 +- setup/upgradetables_mysql.inc.php | 194 ++++++++++++++++++++++++++++++ 3 files changed, 198 insertions(+), 3 deletions(-) create mode 100644 setup/upgradetables_mysql.inc.php diff --git a/setup/index.php b/setup/index.php index 0df9bc4123..7482288e95 100644 --- a/setup/index.php +++ b/setup/index.php @@ -119,10 +119,11 @@ echo "  Information\n"; echo " \n"; echo " \n"; - echo " At your request, this script is going to attempt to upgrade your tables to the new format.\n"; + echo " At your request, this script is going to attempt to upgrade your old tables to the new format.\n"; echo " \n"; echo "\n"; - include ("createtables_".$phpgw_info["server"]["db_type"].".inc.php"); + $currentver = $oldversion; + include ("upgradetables_".$phpgw_info["server"]["db_type"].".inc.php"); include ("default_records.inc.php"); include ("lang_records.inc.php"); echo "\n"; diff --git a/setup/lang_records.inc.php b/setup/lang_records.inc.php index 3810f80e67..98cc79e7db 100644 --- a/setup/lang_records.inc.php +++ b/setup/lang_records.inc.php @@ -107,7 +107,7 @@ $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'only yours','common','en','only yours')"); $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'print','common','en','Print')"); $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'trouble ticket system','common','en','Trouble Ticket System')"); - $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'you are required to change your password during your first login','common','en','You are required to change your password durring your first login')"); + $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'you are required to change your password during your first login','common','en','You are required to change your password during your first login')"); $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'powered by phpgroupware version x','common','en','Powered by phpGroupWare version %1')"); $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'sorry, there was a problem processing your request.','common','en','Sorry, there was a problem processing your request.')"); $db->query("INSERT INTO lang (message_id, app_name, lang, content) VALUES( 'your message has been sent','common','en','Your message has been sent')"); diff --git a/setup/upgradetables_mysql.inc.php b/setup/upgradetables_mysql.inc.php new file mode 100644 index 0000000000..959feacff1 --- /dev/null +++ b/setup/upgradetables_mysql.inc.php @@ -0,0 +1,194 @@ +\n"; +// echo " \n"; + echo " \n"; + echo " \n"; + $currentver = "8032000"; + } + } + function v8032000to8072000(){ + global $currentver, $db; + if ($currentver == "8032000"){ + echo " \n"; +// echo " \n"; + echo " \n"; + echo " \n"; + $currentver = "8072000"; + } + } + + function v8072000to8212000(){ + global $currentver, $db; + if ($currentver == "8072000"){ + + $sql = "CREATE TABLE applications (" + ."app_name varchar(25) NOT NULL," + ."app_title varchar(50)," + ."app_enabled int," + ."UNIQUE app_name (app_name)" + .")"; + $db->query($sql); + + $db->query("insert into applications (app_name, app_title, app_enabled) values ('admin', 'Administration', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('tts', 'Trouble Ticket System', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('inv', 'Inventory', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('chat', 'Chat', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('headlines', 'Headlines', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('filemanager', 'File manager', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('ftp', 'FTP', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('addressbook', 'Address Book', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('todo', 'ToDo List', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('calendar', 'Calendar', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('email', 'Email', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('nntp', 'NNTP', 1)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('bookmarks', 'Bookmarks', 0)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('cron_apps', 'cron_apps', 0)"); + $db->query("insert into applications (app_name, app_title, app_enabled) values ('napster', 'Napster', 0)"); + + echo " \n"; + echo " \n"; + echo " \n"; + $currentver = "8212000"; + } + } + function v8212000to9052000(){ + global $currentver, $db; + if ($currentver == "8212000"){ + $db->query("alter table chat_channel change name name varchar(10) not null"); + $db->query("alter table chat_messages change channel channel char(20) not null"); + $db->query("alter table chat_messages change loginid loginid varchar(20) not null"); + $db->query("alter table chat_currentin change loginid loginid varchar(25) not null"); + $db->query("alter table chat_currentin change channel channel char(20)"); + $db->query("alter table chat_privatechat change user1 user1 varchar(25) not null"); + $db->query("alter table chat_privatechat change user2 user2 varchar(25) not null"); + + echo " \n"; + echo " \n"; + echo " \n"; + $currentver = "9052000"; + } + } + function v9052000to9072000(){ + global $currentver, $db; + if ($currentver == "9052000"){ + echo " \n"; +// echo " \n"; + echo " \n"; + echo " \n"; + $currentver = "9072000"; + } + } + function v9072000to0_9_1(){ + global $currentver, $db; + if ($currentver == "9072000"){ + + $db->query("alter table accounts change con account_id int(11) DEFAULT '0' NOT NULL auto_increment"); + $db->query("alter table accounts change loginid account_lid varchar(25) NOT NULL"); + $db->query("alter table accounts change passwd account_pwd varchar(32) NOT NULL"); + $db->query("alter table accounts change firstname account_firstname varchar(50)"); + $db->query("alter table accounts change lastname account_lastname varchar(50)"); + $db->query("alter table accounts change permissions account_permissions text"); + $db->query("alter table accounts change groups account_groups varchar(30)"); + $db->query("alter table accounts change lastlogin account_lastlogin int(11)"); + $db->query("alter table accounts change lastloginfrom account_lastloginfrom varchar(255)"); + $db->query("alter table accounts change lastpasswd_change account_lastpwd_change int(11)"); + $db->query("alter table accounts change status account_status enum('A','L') DEFAULT 'A' NOT NULL"); + $db->query("alter table applications add app_order int"); + $db->query("alter table applications add app_tables varchar(255)"); + $db->query("alter table preferences change owner preference_owner varchar(20)"); + $db->query("alter table preferences change name preference_name varchar(50)"); + $db->query("alter table preferences change value preference_value varchar(50)"); + $db->query("alter table preferences add preference_appname varchar(50) default ''"); + $db->query("alter table sessions change sessionid session_id varchar(255) NOT NULL"); + $db->query("alter table sessions change loginid session_lid varchar(20)"); + $db->query("alter table sessions change passwd session_pwd varchar(255)"); + $db->query("alter table sessions change ip session_ip varchar(255)"); + $db->query("alter table sessions change logintime session_logintime int(11)"); + $db->query("alter table sessions change dla session_dla int(11)"); + + $db->query("update applications set app_order=1,app_tables=NULL where app_name='admin'"); + $db->query("update applications set app_order=2,app_tables=NULL where app_name='tts'"); + $db->query("update applications set app_order=3,app_tables=NULL where app_name='inv'"); + $db->query("update applications set app_order=4,app_tables=NULL where app_name='chat'"); + $db->query("update applications set app_order=5,app_tables='news_sites,news_headlines,users_headlines' where app_name='headlines'"); + $db->query("update applications set app_order=6,app_tables=NULL where app_name='filemanager'"); + $db->query("update applications set app_order=7,app_tables='addressbook' where app_name='addressbook'"); + $db->query("update applications set app_order=8,app_tables='todo' where app_name='todo'"); + $db->query("update applications set app_order=9,app_tables='webcal_entry,webcal_entry_users,webcal_entry_groups,webcal_repeats' where app_name='calendar'"); + $db->query("update applications set app_order=10,app_tables=NULL where app_name='email'"); + $db->query("update applications set app_order=11,app_tables='newsgroups,users_newsgroups' where app_name='nntp'"); + $db->query("update applications set app_order=0,app_tables=NULL where app_name='cron_apps'"); + + $sql = "CREATE TABLE config (" + ."config_name varchar(25) NOT NULL," + ."config_value varchar(100)," + ."UNIQUE config_name (config_name)" + .")"; + $db->query($sql); + + $db->query("insert into config (config_name, config_value) values ('default_tplset', 'default')"); + $db->query("insert into config (config_name, config_value) values ('temp_dir', '/path/to/tmp')"); + $db->query("insert into config (config_name, config_value) values ('files_dir', '/path/to/dir/phpgroupware/files')"); + $db->query("insert into config (config_name, config_value) values ('encryptkey', 'change this phrase 2 something else'"); + $db->query("insert into config (config_name, config_value) values ('site_title', 'phpGroupWare')"); + $db->query("insert into config (config_name, config_value) values ('hostname', 'local.machine.name')"); + $db->query("insert into config (config_name, config_value) values ('webserver_url', '/phpgroupware')"); + $db->query("insert into config (config_name, config_value) values ('auth_type', 'sql')"); + $db->query("insert into config (config_name, config_value) values ('ldap_host', 'localhost')"); + $db->query("insert into config (config_name, config_value) values ('ldap_context', 'o=phpGroupWare')"); + $db->query("insert into config (config_name, config_value) values ('usecookies', 'True')"); + $db->query("insert into config (config_name, config_value) values ('mail_server', 'localhost')"); + $db->query("insert into config (config_name, config_value) values ('mail_server_type', 'imap')"); + $db->query("insert into config (config_name, config_value) values ('imap_server_type', 'Cyrus')"); + $db->query("insert into config (config_name, config_value) values ('mail_suffix', 'yourdomain.com')"); + $db->query("insert into config (config_name, config_value) values ('mail_login_type', 'standard')"); + $db->query("insert into config (config_name, config_value) values ('smtp_server', 'localhost')"); + $db->query("insert into config (config_name, config_value) values ('smtp_port', '25')"); + $db->query("insert into config (config_name, config_value) values ('nntp_server', 'yournewsserver.com')"); + $db->query("insert into config (config_name, config_value) values ('nntp_port', '119')"); + $db->query("insert into config (config_name, config_value) values ('nntp_sender', 'complaints@yourserver.com')"); + $db->query("insert into config (config_name, config_value) values ('nntp_organization', 'phpGroupWare')"); + $db->query("insert into config (config_name, config_value) values ('nntp_admin', 'admin@yourserver.com')"); + $db->query("insert into config (config_name, config_value) values ('nntp_login_username', '')"); + $db->query("insert into config (config_name, config_value) values ('nntp_login_password', '')"); + $db->query("insert into config (config_name, config_value) values ('charset', 'iso-8859-1')"); + $db->query("insert into config (config_name, config_value) values ('default_ftp_server', 'localhost')"); + $db->query("insert into config (config_name, config_value) values ('httpproxy_server', '')"); + $db->query("insert into config (config_name, config_value) values ('httpproxy_port', '')"); + $db->query("insert into config (config_name, config_value) values ('showpoweredbyon', 'bottom')"); + $db->query("insert into config (config_name, config_value) values ('checkfornewversion', 'False')"); + + echo " \n"; + echo " \n"; + echo " \n"; + $currentver = "0_9_1"; + } + } + + echo "
Upgrade from 7122000 to 8032000 is completed.Upgrading from 7122000 is not yet ready.
You can do this manually if you choose, otherwise dump your tables and start over.
Upgrade from 8032000 to 8072000 is completed.Upgrading from 8032000 is not yet ready.
You can do this manually if you choose, otherwise dump your tables and start over.
Upgrade from 8072000 to 8212000 is completed.
Upgrade from 8212000 to 9052000 is completed.
Upgrade from 9052000 to 9072000 is completed.Upgrading from 9052000 is not available.
I dont believe there were any changes, so this should be fine.
Upgrade from 9072000 to 0.9.1 is completed.
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + v7122000to8032000(); + v8032000to8072000(); + v8072000to8212000(); + v8212000to9052000(); + v9052000to9072000(); + v9072000to0_9_1(); + echo "
 Table Upgrades
\n"; +?> \ No newline at end of file