|
From: Markus P. <mar...@us...> - 2005-04-06 06:35:10
|
Update of /cvsroot/mxbb/core/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25583/install Modified Files: mx_install.php Log Message: The installer is now able to detect and deal with more that one phpBB board installed on the target system (it was already, but...) even if they're *using different DB engines*. The upgrade cache code is now able to deal with 2.8.0 and previous versions. Added references to the mxBB-News mailing list (a new message in last install/upgrade panels) and a link to the new Welcome Package in page footer. Index: mx_install.php =================================================================== RCS file: /cvsroot/mxbb/core/install/mx_install.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** mx_install.php 3 Apr 2005 12:34:04 -0000 1.39 --- mx_install.php 6 Apr 2005 06:35:00 -0000 1.40 *************** *** 54,58 **** // This is shown in the top right corner of the installation panels. // ! define('INSTALLER_VERSION', '1.0.8'); define('INSTALLER_NAME', 'mxBB-Installer'); --- 54,58 ---- // This is shown in the top right corner of the installation panels. // ! define('INSTALLER_VERSION', '1.0.9'); define('INSTALLER_NAME', 'mxBB-Installer'); *************** *** 61,68 **** --- 61,75 ---- // define('U_RELEASE_NOTES', 'http://www.mx-system.com/forum/viewtopic.php?t=1224'); + define('U_WELCOME_PACK', 'http://www.mx-system.com/forum/viewtopic.php?t=6445'); define('U_ONLINE_FAQ', 'http://www.mx-system.com/index.php?page=117'); define('U_ONLINE_SUPPORT', 'http://www.mx-system.com/'); define('U_TERMS_OF_USE', 'http://www.mx-system.com/index.php?page=126&dynamic_block=133'); + // + // These URLs are used in the last installation/upgrade panels. + // + define('U_MXBB_NEWS_INFO', 'http://www.mx-system.com/forum/viewtopic.php?t=6295'); + define('U_MXBB_NEWS_NOW', 'http://lists.sourceforge.net/lists/listinfo/mxbb-news'); + // *************** *** 241,245 **** 'DELIM' => ';', 'DELIM_BASIC' => ';', ! 'COMMENTS' => 'remove_remarks' ), 'mysql4' => array( --- 248,252 ---- 'DELIM' => ';', 'DELIM_BASIC' => ';', ! 'COMMENTS' => 'mx_remove_remarks' ), 'mysql4' => array( *************** *** 248,252 **** 'DELIM' => ';', 'DELIM_BASIC' => ';', ! 'COMMENTS' => 'remove_remarks' ), 'postgres' => array( --- 255,259 ---- 'DELIM' => ';', 'DELIM_BASIC' => ';', ! 'COMMENTS' => 'mx_remove_remarks' ), 'postgres' => array( *************** *** 255,259 **** 'DELIM' => ';', 'DELIM_BASIC' => ';', ! 'COMMENTS' => 'remove_comments' ), // 'mssql' => array( --- 262,266 ---- 'DELIM' => ';', 'DELIM_BASIC' => ';', ! 'COMMENTS' => 'mx_remove_comments' ), // 'mssql' => array( *************** *** 262,266 **** // 'DELIM' => 'GO', // 'DELIM_BASIC' => ';', ! // 'COMMENTS' => 'remove_comments' // ), // 'msaccess' => array( --- 269,273 ---- // 'DELIM' => 'GO', // 'DELIM_BASIC' => ';', ! // 'COMMENTS' => 'mx_remove_comments' // ), // 'msaccess' => array( *************** *** 276,280 **** // 'DELIM' => 'GO', // 'DELIM_BASIC' => ';', ! // 'COMMENTS' => 'remove_comments' // ), ); --- 283,287 ---- // 'DELIM' => 'GO', // 'DELIM_BASIC' => ';', ! // 'COMMENTS' => 'mx_remove_comments' // ), ); *************** *** 305,309 **** // Send file -------------------------------------------------- // ! if ( $HTTP_POST_VARS['send_file'] == 1 ) { header( "Content-Type: text/x-delimtext; name=\"config.$phpEx\"" ); --- 312,316 ---- // Send file -------------------------------------------------- // ! if ( isset($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 1 ) { header( "Content-Type: text/x-delimtext; name=\"config.$phpEx\"" ); *************** *** 350,354 **** include($mx_root_path . "includes/template.$phpEx"); ! $template = new mx_Template($mx_root_path . 'install/templates'); page_header_install($lang['Welcome_install'], $lang['Choose_lang_explain']); $template->set_filenames(array('language' => 'mx_install_language.tpl')); --- 357,361 ---- include($mx_root_path . "includes/template.$phpEx"); ! $template = new Template($mx_root_path . 'install/templates'); page_header_install($lang['Welcome_install'], $lang['Choose_lang_explain']); $template->set_filenames(array('language' => 'mx_install_language.tpl')); *************** *** 466,470 **** include($mx_root_path . "includes/template.$phpEx"); ! $template = new mx_Template($mx_root_path . 'install/templates'); page_header_install($lang['Welcome_install'], $instruction_text); $template->set_filenames(array('button' => 'mx_install_button.tpl')); --- 473,477 ---- include($mx_root_path . "includes/template.$phpEx"); ! $template = new Template($mx_root_path . 'install/templates'); page_header_install($lang['Welcome_install'], $instruction_text); $template->set_filenames(array('button' => 'mx_install_button.tpl')); *************** *** 564,577 **** if( $install_mode == 'upgrade' && count($schemas) > 0 ) { ! // ! // FYI: update_session_cache() needs $portal_config to be filled. ! // ! $sql = 'SELECT * FROM '.PORTAL_TABLE.' WHERE portal_id = 1'; ! if( ($result = $db->sql_query($sql)) ) { ! $portal_config = $db->sql_fetchrow($result); ! include($mx_root_path . "includes/mx_cache.$phpEx"); ! update_session_cache(); ! $process_msgs[] = $lang['Cache_generate']; } } --- 571,599 ---- if( $install_mode == 'upgrade' && count($schemas) > 0 ) { ! if( version_compare($mx_portal_version, '2.8.0', '<') ) { ! // ! // FYI: This is how the cache worked before 2.8.0. ! // ! if( @file_exists($mx_root_path . 'cache/block_config.xml') ) ! { ! include($mx_root_path . "cache/mx_cache.$phpEx"); ! write_cache_config(); ! $process_msgs[] = $lang['Cache_generate']; ! } ! } ! else ! { ! // ! // FYI: update_session_cache() needs $portal_config to be filled. ! // ! $sql = 'SELECT * FROM '.PORTAL_TABLE.' WHERE portal_id = 1'; ! if( ($result = $db->sql_query($sql)) ) ! { ! $portal_config = $db->sql_fetchrow($result); ! include($mx_root_path . "includes/mx_cache.$phpEx"); ! update_session_cache(); ! $process_msgs[] = $lang['Cache_generate']; ! } } } *************** *** 589,597 **** $message .= '<span' . ( $process_errors > 0 ? ' style="color:orange;"' : '' ) . '>' . $warning . '</span><br />'; $message .= '<hr />'; $message .= '<p><b>' . ( $install_mode == 'install' ? $lang['Portal_intalled'] : $lang['Portal_upgraded'] ) . '</b></p>'; ! $message .= $lang['Portal_install_done'] . '<br /><br />'; include($mx_root_path . "includes/template.$phpEx"); ! $template = new mx_Template($mx_root_path . 'install/templates'); page_header_install($install_title, $message); $template->set_filenames(array('button' => 'mx_install_button.tpl')); --- 611,625 ---- $message .= '<span' . ( $process_errors > 0 ? ' style="color:orange;"' : '' ) . '>' . $warning . '</span><br />'; $message .= '<hr />'; + $message .= '<p>' . sprintf($lang['Subscribe_mxBB_News_now'], '<a href="'.U_MXBB_NEWS_INFO.'" target="_blank">', '</a>', '<a href="'.U_MXBB_NEWS_NOW.'" target="_blank">', '</a>') . '</p>'; + $message .= '<hr />'; $message .= '<p><b>' . ( $install_mode == 'install' ? $lang['Portal_intalled'] : $lang['Portal_upgraded'] ) . '</b></p>'; ! for( $i=0; $i < count($lang['Portal_install_done']); $i++ ) ! { ! $message .= ($i+1) . ') ' . $lang['Portal_install_done'][$i] . '<br />'; ! } ! $message .= ' <br /> <br />' . $lang['Thanks_for_choosing'] . '<br /> <br />'; include($mx_root_path . "includes/template.$phpEx"); ! $template = new Template($mx_root_path . 'install/templates'); page_header_install($install_title, $message); $template->set_filenames(array('button' => 'mx_install_button.tpl')); *************** *** 616,620 **** // include($mx_root_path . "includes/template.$phpEx"); ! $template = new mx_Template($mx_root_path . 'install/templates'); --- 644,648 ---- // include($mx_root_path . "includes/template.$phpEx"); ! $template = new Template($mx_root_path . 'install/templates'); *************** *** 824,845 **** // ! // Validate db // ! switch ( $phpbb_info['dbms'] ) ! { ! case 'mysql': ! include($phpbb_root_path . "db/mysql.$phpEx"); ! break; ! case 'mysql4': ! include($phpbb_root_path . "db/mysql4.$phpEx"); ! break; ! case 'postgres': ! include($phpbb_root_path . "db/postgres7.$phpEx"); ! break; ! default: ! continue; ! } ! $db = new sql_db($phpbb_info['dbhost'], $phpbb_info['dbuser'], $phpbb_info['dbpasswd'], $phpbb_info['dbname'], false); ! if ( !$db->db_connect_id ) { $phpbb_failed = true; --- 852,858 ---- // ! // Try to Connect to this phpBB Database // ! if( !open_phpbb_db($db, $phpbb_info) ) { $phpbb_failed = true; *************** *** 976,979 **** --- 989,993 ---- $install_moreinfo = sprintf($lang['Install_moreinfo'], '<a href="'.U_RELEASE_NOTES.'" target="_blank">', '</a>', + '<a href="'.U_WELCOME_PACK.'" target="_blank">', '</a>', '<a href="'.U_ONLINE_FAQ.'" target="_blank">', '</a>', '<a href="'.U_ONLINE_SUPPORT.'" target="_blank">', '</a>', *************** *** 1025,1029 **** { include($mx_root_path . "includes/template.$phpEx"); ! $template = new mx_Template($mx_root_path . 'install/templates'); page_header_install($lang['Installation_error'], $message); } --- 1039,1043 ---- { include($mx_root_path . "includes/template.$phpEx"); ! $template = new Template($mx_root_path . 'install/templates'); page_header_install($lang['Installation_error'], $message); } *************** *** 1273,1277 **** // ! // Connect to a phpBB Database to get its full URL // function get_phpbb_url($table_prefix) --- 1287,1291 ---- // ! // Get the full phpBB URL by reading its config table. // function get_phpbb_url($table_prefix) *************** *** 1297,1300 **** --- 1311,1348 ---- } + // + // Connecting to a phpBB Database. + // + function open_phpbb_db(&$db, &$phpbb_info) + { + global $mx_root_path, $phpEx; + + if( !defined('BEGIN_TRANSACTION') ) + { + define('BEGIN_TRANSACTION', 1); + define('END_TRANSACTION', 2); + } + + switch ( $phpbb_info['dbms'] ) + { + case 'mysql': + include($mx_root_path . "install/db/mysql.$phpEx"); + break; + case 'mysql4': + include($mx_root_path . "install/db/mysql4.$phpEx"); + break; + case 'postgres': + include($mx_root_path . "install/db/postgres7.$phpEx"); + break; + default: + return false; + } + + $class = 'sql_db_'.$phpbb_info['dbms']; + $db = new $class($phpbb_info['dbhost'], $phpbb_info['dbuser'], $phpbb_info['dbpasswd'], $phpbb_info['dbname'], false); + + return $db->db_connect_id; + } + // *************** *** 1368,1372 **** // include($mx_root_path . "includes/template.$phpEx"); ! $template = new mx_Template($mx_root_path . 'install/templates'); page_header_install('phpInfo()'); $template->set_filenames(array('phpinfo' => 'mx_install_phpinfo.tpl')); --- 1416,1420 ---- // include($mx_root_path . "includes/template.$phpEx"); ! $template = new Template($mx_root_path . 'install/templates'); page_header_install('phpInfo()'); $template->set_filenames(array('phpinfo' => 'mx_install_phpinfo.tpl')); *************** *** 1426,1429 **** --- 1474,1488 ---- } + // + // Commands Processor (very simple parser, but still useful) + // + function mx_remove_remarks(&$sql) + { + return preg_replace('/(\n){2,}/', "\n", preg_replace('/^#.*/m', "\n", $sql)); + } + function mx_remove_comments(&$sql) + { + return preg_replace('/(\n){2,}/', "\n", preg_replace('/^--.*/m', "\n", $sql)); + } // *************** *** 1434,1438 **** global $dbms, $available_dbms, $mx_table_prefix; ! $remove_remarks = $available_dbms[$dbms]['COMMENTS'];; $delimiter = $available_dbms[$dbms]['DELIM']; $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; --- 1493,1497 ---- global $dbms, $available_dbms, $mx_table_prefix; ! $remove_remarks = $available_dbms[$dbms]['COMMENTS']; $delimiter = $available_dbms[$dbms]['DELIM']; $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; *************** *** 1441,1445 **** // Read the schemas file and build an array of statements // ! $commands_ary = @fread(@fopen($schema, 'r'), @filesize($schema)); $commands_ary = preg_replace('/mx_table_/', $mx_table_prefix, $commands_ary); $commands_ary = $remove_remarks($commands_ary); --- 1500,1504 ---- // Read the schemas file and build an array of statements // ! $commands_ary = @file_get_contents($schema); $commands_ary = preg_replace('/mx_table_/', $mx_table_prefix, $commands_ary); $commands_ary = $remove_remarks($commands_ary); |