|
From: Jon O. <jon...@us...> - 2006-07-01 22:01:27
|
Update of /cvsroot/mxbb/mx_linkdb In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv22600/modules/mx_linkdb Modified Files: db_install.php db_upgrade.php Log Message: fixing installation Index: db_install.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/db_install.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** db_install.php 30 Jun 2006 19:54:14 -0000 1.9 --- db_install.php 1 Jul 2006 22:01:23 -0000 1.10 *************** *** 33,36 **** --- 33,44 ---- $mx_module_copy = 'Original phpBB <i>LinkDb</i> MOD by <a href="http://www.phpbb.com/phpBB/viewtopic.php?p=1183059" target="_blank">CRLin</a>, <a href="http://www.hostsector.com/~mohd/" target="_blank">pafileDB</a> & <a href="http://www.phpbb.com/phpBB/viewtopic.php?t=110836" target="_blank">Advanced Links Mod</a> :: Adapted for mxBB by <a href="http://www.mxbb-portal.com" target="_blank">Jon</a>'; + // For compatibility with core 2.7.+ + define( 'MXBB_27x', file_exists( $mx_root_path . 'mx_login.php' ) ); + + if ( MXBB_27x ) + { + include_once( $mx_root_path . 'modules/mx_pafiledb/pafiledb/includes/functions_mx.' . $phpEx ); + } + // If fresh install if ( !$result = $db->sql_query( "SELECT config_name from " . $mx_table_prefix . "linkdb_config" ) ) *************** *** 47,80 **** "CREATE TABLE " . $mx_table_prefix . "linkdb_categories ( ! cat_id int(10) NOT NULL auto_increment, ! cat_name text, ! cat_parent int(50) default NULL, ! parents_data text NOT NULL, ! cat_order int(50) default NULL, ! cat_links mediumint(8) NOT NULL default '-1', ! PRIMARY KEY (cat_id), ! KEY cat_order (cat_order))", ! "CREATE TABLE " . $mx_table_prefix . "linkdb ( ! link_id mediumint(8) unsigned NOT NULL auto_increment, ! link_name text, ! link_longdesc text, ! link_catid mediumint(8) unsigned NOT NULL default '0', ! link_url varchar(100) NOT NULL default '', ! link_logo_src varchar(120) default NULL, ! link_time int(25) default '0', ! link_approved tinyint(1) NOT NULL default '0', ! link_hits int(10) unsigned NOT NULL default '0', ! user_id mediumint(8) NOT NULL default '0', ! poster_ip varchar(8) NOT NULL default '', ! last_user_ip varchar(8) NOT NULL default '', ! post_username varchar(25) default NULL, ! PRIMARY KEY (link_id))", "INSERT INTO " . $mx_table_prefix . "linkdb_categories VALUES (1,'PHP',0,'',1,1)", "INSERT INTO " . $mx_table_prefix . "linkdb_categories VALUES (2,'Bulletin Board',1,'',2,-1)", "INSERT INTO " . $mx_table_prefix . "linkdb VALUES (1, 'phpBB Official Website', 'Official phpBB Website', 2, 'http://www.phpbb.com/', 'linkdb/images/phpBB_88a.gif', " . time() . ", 1, 0, " . $tmp . ", '', '', '')", "CREATE TABLE " . $mx_table_prefix . "linkdb_config ( ! config_name varchar(255) NOT NULL default '', ! config_value varchar(255) NOT NULL default '' ! )", "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('site_logo', 'http://" . $board_config['server_name'] . $board_config['script_path'] . "linkdb/images/web_logo88a.gif')", "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('site_url', 'http://" . $board_config['server_name'] . $board_config['script_path'] . "')", --- 55,95 ---- "CREATE TABLE " . $mx_table_prefix . "linkdb_categories ( ! cat_id int(10) NOT NULL auto_increment, ! cat_name text, ! cat_parent int(50) default NULL, ! parents_data text NOT NULL, ! cat_order int(50) default NULL, ! cat_links mediumint(8) NOT NULL default '-1', ! PRIMARY KEY (cat_id), ! KEY cat_order (cat_order) ! )", ! "INSERT INTO " . $mx_table_prefix . "linkdb_categories VALUES (1,'PHP',0,'',1,1)", "INSERT INTO " . $mx_table_prefix . "linkdb_categories VALUES (2,'Bulletin Board',1,'',2,-1)", + + "CREATE TABLE " . $mx_table_prefix . "linkdb ( + link_id mediumint(8) unsigned NOT NULL auto_increment, + link_name text, + link_longdesc text, + link_catid mediumint(8) unsigned NOT NULL default '0', + link_url varchar(100) NOT NULL default '', + link_logo_src varchar(120) default NULL, + link_time int(25) default '0', + link_approved tinyint(1) NOT NULL default '0', + link_hits int(10) unsigned NOT NULL default '0', + user_id mediumint(8) NOT NULL default '0', + poster_ip varchar(8) NOT NULL default '', + last_user_ip varchar(8) NOT NULL default '', + post_username varchar(25) default NULL, + PRIMARY KEY (link_id) + )", + "INSERT INTO " . $mx_table_prefix . "linkdb VALUES (1, 'phpBB Official Website', 'Official phpBB Website', 2, 'http://www.phpbb.com/', 'linkdb/images/phpBB_88a.gif', " . time() . ", 1, 0, " . $tmp . ", '', '', '')", + "CREATE TABLE " . $mx_table_prefix . "linkdb_config ( ! config_name varchar(255) NOT NULL default '', ! config_value varchar(255) NOT NULL default '' ! )", ! "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('site_logo', 'http://" . $board_config['server_name'] . $board_config['script_path'] . "linkdb/images/web_logo88a.gif')", "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('site_url', 'http://" . $board_config['server_name'] . $board_config['script_path'] . "')", *************** *** 97,120 **** "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('linkdb_versions', '0.0.7')", "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('link_validation', '1')", "CREATE TABLE " . $mx_table_prefix . "linkdb_custom ( ! custom_id int(50) NOT NULL auto_increment, ! custom_name text NOT NULL, ! custom_description text NOT NULL, ! data text NOT NULL, ! field_order int(20) NOT NULL default '0', ! field_type tinyint(2) NOT NULL default '0', ! regex varchar(255) NOT NULL default '', ! PRIMARY KEY (custom_id))", "CREATE TABLE " . $mx_table_prefix . "linkdb_customdata ( ! customdata_file int(50) NOT NULL default '0', ! customdata_custom int(50) NOT NULL default '0', ! data text NOT NULL)", "CREATE TABLE " . $mx_table_prefix . "linkdb_votes ( ! user_id mediumint(8) NOT NULL default '0', ! votes_ip varchar(50) NOT NULL default '0', ! votes_link int(50) NOT NULL default '0', ! rate_point tinyint(3) unsigned NOT NULL default '0', ! KEY user_id (user_id))" ! ); $sql[] = "UPDATE " . $mx_table_prefix . "module" . " --- 112,141 ---- "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('linkdb_versions', '0.0.7')", "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('link_validation', '1')", + "CREATE TABLE " . $mx_table_prefix . "linkdb_custom ( ! custom_id int(50) NOT NULL auto_increment, ! custom_name text NOT NULL, ! custom_description text NOT NULL, ! data text NOT NULL, ! field_order int(20) NOT NULL default '0', ! field_type tinyint(2) NOT NULL default '0', ! regex varchar(255) NOT NULL default '', ! PRIMARY KEY (custom_id) ! )", ! "CREATE TABLE " . $mx_table_prefix . "linkdb_customdata ( ! customdata_file int(50) NOT NULL default '0', ! customdata_custom int(50) NOT NULL default '0', ! data text NOT NULL ! )", ! "CREATE TABLE " . $mx_table_prefix . "linkdb_votes ( ! user_id mediumint(8) NOT NULL default '0', ! votes_ip varchar(50) NOT NULL default '0', ! votes_link int(50) NOT NULL default '0', ! rate_point tinyint(3) unsigned NOT NULL default '0', ! KEY user_id (user_id) ! )" ! ); $sql[] = "UPDATE " . $mx_table_prefix . "module" . " Index: db_upgrade.php =================================================================== RCS file: /cvsroot/mxbb/mx_linkdb/db_upgrade.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** db_upgrade.php 30 Jun 2006 19:54:14 -0000 1.11 --- db_upgrade.php 1 Jul 2006 22:01:23 -0000 1.12 *************** *** 35,156 **** $sql = array(); // Precheck ! if ( $result = $db->sql_query( "SELECT config_name from " . $mx_table_prefix . "kb_config" ) ) { // Upgrade checks ! $upgrade_101 = 0; ! $upgrade_102 = 0; ! $upgrade_103 = 0; ! $upgrade_104 = 0; ! $upgrade_105 = 0; ! $upgrade_106 = 0; ! $upgrade_107 = 0; ! $upgrade_108 = 0; ! // validate before 1.05 ! if ( !$result = $db->sql_query( "SELECT article_rating from " . $mx_table_prefix . "kb_articles" ) ) ! { ! $upgrade_105 = 1; ! } ! // validate before 1.06 ! if ( !$result = $db->sql_query( "SELECT votes_userid from " . $mx_table_prefix . "kb_votes" ) ) { ! $upgrade_106 = 1; } ! // validate before 1.07 ! $result = $db->sql_query( "SELECT config_value from " . $mx_table_prefix . "kb_config WHERE config_name = 'comments_pagination'" ); ! if ( $db->sql_numrows( $result ) == 0 ) { ! $upgrade_107 = 1; } - // validate before 1.08 - $result = $db->sql_query( "SELECT parameter_id from " . $mx_table_prefix . "parameter WHERE parameter_name = 'kb_type_select'" ); - if ( $db->sql_numrows( $result ) == 0 ) - { - $upgrade_108 = 1; - } $message = "<b>Upgrading!</b><br/><br/>"; ! if ( $upgrade_105 == 1 ) ! { ! $message .= "<b>Upgrading to v. 1.05...</b><br/><br/>"; ! $sql[] = "CREATE TABLE " . $mx_table_prefix . "kb_votes ( ! votes_ip varchar(50) NOT NULL default '0', ! votes_file int(50) NOT NULL default '0' ! ) TYPE=MyISAM"; ! ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_rating', '0')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('allow_anonymos_rating', '0')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('comments_show', '1')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('mod_group', '0')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('bump_post', '1')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('stats_list', '1')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('header_banner', '1')"; ! ! $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_articles ADD article_rating double(6,4) NOT NULL default '0.0000' "; ! $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_articles ADD article_totalvotes int(255) NOT NULL default '0' "; ! } ! ! if ( $upgrade_106 == 1 ) ! { ! $message .= "<b>Upgrading to v. 1.06...</b><br/><br/>"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('votes_check_userid', '1')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('votes_check_ip', '1')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('art_pagination', '5')"; ! $sql[] = "ALTER TABLE " . $mx_table_prefix . "kb_votes ADD votes_userid int(50) NOT NULL default '0' AFTER votes_ip "; ! } ! ! if ( $upgrade_107 == 1 ) { ! $message .= "<b>Upgrading to v. 1.07...</b><br/><br/>"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('comments_pagination', '5')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('news_sort', 'Alphabetic')"; ! $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('news_sort_par', 'ASC')"; ! } - if ( $upgrade_108 == 1 ) - { - $message .= "<b>Upgrading to v. 1.08...</b><br/><br/>"; - $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('comments_pagination', '5')"; - $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('news_sort', 'Alphabetic')"; - $sql[] = "INSERT INTO " . $mx_table_prefix . "kb_config VALUES ('news_sort_par', 'ASC')"; - /* - // Now add some new parameters - // First get function_id - $sqltmp = "SELECT function_id - FROM " . $mx_table_prefix . "function" . " - WHERE function_file = 'kb.php' - LIMIT 1"; - if ( !( $result = $db->sql_query( $sqltmp ) ) ) - { - mx_message_die( CRITICAL_ERROR, "Could not query portal version", "", __LINE__, __FILE__, $sql ); - } - $row = $db->sql_fetchrow( $result ) ; - $function_id = $row['function_id']; - // Then get block_id(s) - $sqltmp2 = "SELECT block_id - FROM " . $mx_table_prefix . "block" . " - WHERE function_id = '$function_id' - LIMIT 1"; - if ( !( $result = $db->sql_query( $sqltmp2 ) ) ) - { - mx_message_die( CRITICAL_ERROR, "Could not query portal version", "", __LINE__, __FILE__, $sql ); - } - $parameter_id = getMaxId( PARAMETER_TABLE, 'parameter_id' ); - $parameter_id1 = $parameter_id + 1; - $sql[] = "REPLACE INTO " . $mx_table_prefix . "parameter VALUES('" . $parameter_id1 . "', '" . $function_id . "', 'kb_type_select', 'Text', 'array(\"init\"=>\"1\")', '')"; - while ( $row = $db->sql_fetchrow( $result ) ) - { - $block_id = $row['block_id']; - $sql[] = "REPLACE INTO " . $mx_table_prefix . "block_system_parameter VALUES('" . $block_id . "', '" . $parameter_id1 . "', 'array(\"init\"=>\"1\")', NULL)"; - } - // Also, enable function admin file - $sql[] = "UPDATE " . $mx_table_prefix . "function SET function_admin = 'modules/mx_kb/admin/kb_config.php' - WHERE function_id = '" . $function_id . "' OR function_file = 'kb.php'"; - */ } else --- 35,68 ---- $sql = array(); // Precheck ! if ( $result = $db->sql_query( "SELECT config_name from " . $mx_table_prefix . "linkdb_config" ) ) { // Upgrade checks ! $upgrade_280 = 0; ! ! // validate before 2.8.0 ! $result = $db->sql_query( "SELECT config_value from " . $mx_table_prefix . "linkdb_config WHERE config_name = 'comments_forum_id'" ); ! if ( $db->sql_numrows( $result ) == 0 || true) { ! $upgrade_280 = 1; ! $message .= "<b>Upgrading to v. 2.8.0...ok</b><br/><br/>"; } ! else { ! $message .= "<b>Validating v. 2.8.0...ok</b><br/><br/>"; } $message = "<b>Upgrading!</b><br/><br/>"; ! if ( $upgrade_280 == 1 ) { ! //$sql[] = "INSERT INTO " . $mx_table_prefix . "linkdb_config VALUES ('comments_forum_id', '0')"; ! //$sql[] = "ALTER TABLE " . $mx_table_prefix . "linkdb_cat MODIFY cat_allow_ratings tinyint(2) NOT NULL default '-1' "; ! //$sql[] = "ALTER TABLE " . $mx_table_prefix . "linkdb_cat ADD auth_approval_groups tinyint(2) NOT NULL default '0' "; } else *************** *** 159,166 **** } ! $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; $message .= mx_do_install_upgrade( $sql ); --- 71,81 ---- } ! if ( !MXBB_27x ) ! { ! $sql[] = "UPDATE " . $mx_table_prefix . "module" . " SET module_version = '" . $mx_module_version . "', module_copy = '" . $mx_module_copy . "' WHERE module_id = '" . $mx_module_id . "'"; + } $message .= mx_do_install_upgrade( $sql ); *************** *** 169,173 **** { // If not installed ! $message = "<b>Module is not installed...and thus cannot be upgraded ;)</b><br/><br/>"; } --- 84,88 ---- { // If not installed ! $message = "<b>Module not installed...and thus cannot be upgraded ;)</b><br/><br/>"; } |