From: Don S. <ri...@us...> - 2004-08-13 21:33:16
|
Update of /cvsroot/phpwsbb/phpwsbb/boost In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17107/boost Modified Files: install.sql uninstall.sql update.php Log Message: Patch #1002850, Eloi's changes. Need to be tested and examined. Index: install.sql =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/boost/install.sql,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** install.sql 18 Mar 2004 04:28:07 -0000 1.14 --- install.sql 13 Aug 2004 21:32:36 -0000 1.15 *************** *** 16,19 **** --- 16,23 ---- sortorder int NOT NULL default '0', lastpost int NOT NULL default '0', + posts int NOT NULL default '0', + lastpost_topic_label text NOT NULL, + lastpost_topic_id int NOT NULL default '0', + lastpost_post_id int NOT NULL default '0', PRIMARY KEY (id) ); *************** *** 35,38 **** --- 39,43 ---- replies int NOT NULL default '0', lastpost int NOT NULL default '0', + lastpost_post_id int NOT NULL default '0', PRIMARY KEY (id) ); *************** *** 42,45 **** --- 47,51 ---- id int NOT NULL default '0', owner varchar(20) default '', + owner_id int NOT NULL default '0', editor varchar(20) default '', ip text, *************** *** 57,60 **** --- 63,67 ---- ); CREATE INDEX phpwsbb_messages_tid_idx ON mod_phpwsbb_messages (tid); + CREATE INDEX phpwsbb_messages_owner_id_idx ON mod_phpwsbb_messages (owner_id); CREATE TABLE mod_phpwsbb_monitors ( *************** *** 83,87 **** latestthreadsblocktitle varchar(80) NULL, maxlatestthreads int NOT NULL default '0', ! bboffline smallint NOT NULL default '0' ); - INSERT INTO mod_phpwsbb_settings VALUES (1, 1, NULL, 'The thread [name] has been updated. Go to [url] to view it.', 0, 1, 1, 'Forums', 1, 'Latest Forum Posts', 5, 0); --- 90,124 ---- latestthreadsblocktitle varchar(80) NULL, maxlatestthreads int NOT NULL default '0', ! bboffline smallint NOT NULL default '0', ! use_avatars smallint NOT NULL default '1', ! use_offsite_avatars smallint NOT NULL default '1', ! max_avatar_height int NOT NULL default '90', ! max_avatar_width int NOT NULL default '90', ! max_avatar_size int NOT NULL default '6', ! use_signatures smallint NOT NULL default '1' ! ); ! INSERT INTO mod_phpwsbb_settings VALUES (1, 1, NULL, 'The thread [name] has been updated. Go to [url] to view it.', 0, 1, 1, 'Forums', 1, 'Latest Forum Posts', 5, 0, 1, 1, 90, 90, 6, 1); ! ! CREATE TABLE mod_phpwsbb_user_ranks ( ! rank_id int DEFAULT '0' NOT NULL, ! rank_title varchar(50) NOT NULL, ! rank_min smallint DEFAULT '0' NOT NULL, ! rank_special smallint DEFAULT '0', ! rank_image varchar(255), ! rank_image_caption varchar(255), ! PRIMARY KEY (rank_id) ! ); ! INSERT INTO `mod_phpwsbb_user_ranks` VALUES (0, 'Site Admin', 0, 1, NULL, NULL); ! INSERT INTO `mod_phpwsbb_user_ranks` VALUES (1, 'Member', 0, 0, NULL, NULL); ! ! CREATE TABLE mod_phpwsbb_user_info ( ! user_id int NOT NULL, ! posts int NOT NULL default `0`, ! location varchar(50) NOT NULL, ! avatar_dir varchar(50) NOT NULL, ! avatar_file varchar(100) NOT NULL, ! signature varchar(255) NOT NULL, ! suspendmonitors smallint NOT NULL default '0', ! monitordefault smallint NOT NULL default '1', ! PRIMARY KEY (user_id) ); Index: uninstall.sql =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/boost/uninstall.sql,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** uninstall.sql 2 Nov 2003 04:54:53 -0000 1.4 --- uninstall.sql 13 Aug 2004 21:32:36 -0000 1.5 *************** *** 7,8 **** --- 7,10 ---- DROP TABLE mod_phpwsbb_monitors; DROP TABLE mod_phpwsbb_banned; + DROP TABLE mod_phpwsbb_user_ranks; + DROP TABLE mod_phpwsbb_user_info; Index: update.php =================================================================== RCS file: /cvsroot/phpwsbb/phpwsbb/boost/update.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** update.php 11 Aug 2004 02:20:06 -0000 1.33 --- update.php 13 Aug 2004 21:32:36 -0000 1.34 *************** *** 244,246 **** --- 244,312 ---- } + if($currentVersion < '0.10.0') { + if($status = $GLOBALS['core']->query('ALTER TABLE mod_phpwsbb_messages ADD owner_id int NOT NULL default 0 AFTER owner', TRUE) + && $status = $GLOBALS['core']->sqlCreateIndex('mod_phpwsbb_messages',array('owner_id'))) { + /* Make a list of names and message ids of all message contributors */ + $msg_list = $name_list = array(); + $result = $GLOBALS['core']->query('SELECT id,owner from mod_phpwsbb_messages WHERE owner IS NOT NULL', true); + while ($result && $row = $result->fetchrow(DB_FETCHMODE_ASSOC)) { + if (!$row['owner']) continue; + $msg_list[$row['owner']][] = $row['id']; + $name_list[$row['owner']] = $row['owner']; + } + unset($result); + /* Make a list of all user ids for the users in the last list */ + $result = $GLOBALS['core']->query('SELECT username,user_id from mod_users WHERE username IN ("' . implode('","', $name_list) .'")', true); + while ($result && $row = $result->fetchrow(DB_FETCHMODE_ASSOC)) + $name_tbl[$row['username']] = $row['user_id']; + unset($result); + /* Update user id information for all messages submitted by each user */ + if (count($msg_list) && count($name_list)) { + foreach ($msg_list AS $key=>$value) { + if (!isset($name_tbl[$key])) $name_tbl[$key] = 0; + $GLOBALS['core']->query('UPDATE mod_phpwsbb_messages SET owner_id=' . $name_tbl[$key].' WHERE id IN ('.implode(',', $value).')', true); + } + } + $content .= 'Successfully modified the phpwsBB messages table.<br />'; + } else + $content .= 'There was a problem modifying the phpwsBB messages table.<br />'; + + if($status = $GLOBALS['core']->query("CREATE TABLE mod_phpwsbb_user_ranks (rank_id int DEFAULT '0' NOT NULL, rank_title varchar(50) NOT NULL, rank_min smallint DEFAULT '0' NOT NULL, rank_special smallint DEFAULT '0', rank_image varchar(255), rank_image_caption varchar(255), PRIMARY KEY (rank_id))", TRUE) + && $status = $GLOBALS['core']->query("INSERT INTO `mod_phpwsbb_user_ranks` VALUES (0, 'Site Admin', 0, 1, NULL, NULL)", TRUE) + && $status = $GLOBALS['core']->query("INSERT INTO `mod_phpwsbb_user_ranks` VALUES (1, 'Member', 0, 0, NULL, NULL)", TRUE)) + $content .= 'Successfully created the phpwsBB User Ranking table.<br />'; + else + $content .= 'There was a problem creating the phpwsBB User Ranking table.<br />'; + + // if($status = $GLOBALS['core']->sqlCreateIndex('mod_phpwsbb_threads',array('fid'))) + // $content .= 'Successfully added indexes.<br />'; + + if($status = $GLOBALS['core']->query('ALTER TABLE mod_phpwsbb_threads ADD lastpost_post_id int NOT NULL default "0"', TRUE)) { + if($status = $GLOBALS['core']->query('ALTER TABLE mod_phpwsbb_forums ADD posts int NOT NULL default "0", ADD lastpost_topic_label text NOT NULL, ADD lastpost_topic_id int NOT NULL default "0", ADD lastpost_post_id int NOT NULL default "0"', TRUE)) { + $sql = 'SELECT id FROM mod_phpwsbb_threads'; + $result = $GLOBALS['core']->getCol($sql,TRUE); + if($result) { + foreach($result as $rowid) { + $thread = new PHPWSBB_Thread($rowid); + $thread->updateThread(); + } + } + $content .= 'Successfully modified the phpwsBB threads table.<br />'; + } else + $content .= 'There was a problem modifying the phpwsBB forums table.<br />'; + } else + $content .= 'There was a problem modifying the phpwsBB threads table.<br />'; + + if($status = $GLOBALS['core']->query('ALTER TABLE mod_phpwsbb_settings ADD use_avatars smallint NOT NULL default "1", ADD use_offsite_avatars smallint NOT NULL default "1", ADD max_avatar_height int NOT NULL default "90", ADD max_avatar_width int NOT NULL default "90", ADD max_avatar_size int NOT NULL default "6", ADD use_signatures smallint NOT NULL default "1"', TRUE)) + $content .= 'phpwsBB settings table successfully modified.<br />'; + else + $content .= 'There was a problem modifying the phpwsBB settings table.<br />'; + + if($status = $GLOBALS['core']->query('CREATE TABLE mod_phpwsbb_user_info (user_id int NOT NULL, posts int NOT NULL default "0", location varchar(50) NOT NULL, avatar_dir varchar(50) NOT NULL, avatar_file varchar(100) NOT NULL, signature varchar(255),suspendmonitors smallint NOT NULL default "0", monitordefault smallint NOT NULL default "1", PRIMARY KEY (user_id))', TRUE)) + // User post counts will be created as users' messages are viewed + $content .= 'Successfully created the phpwsBB User Information table.<br />'; + else + $content .= 'There was a problem creating the phpwsBB User Information table.<br />'; + } + ?> |