some adjustements to the installer

git-svn-id: file:///svn/phpbb/trunk@9284 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-01-21 17:03:00 +00:00
parent dcd073bb44
commit 9f060eba6e
6 changed files with 125 additions and 50 deletions

View file

@ -136,15 +136,15 @@
<li>A webserver or web hosting account running on any major Operating System with support for PHP</li> <li>A webserver or web hosting account running on any major Operating System with support for PHP</li>
<li>A SQL database system, <strong>one of</strong>: <li>A SQL database system, <strong>one of</strong>:
<ul> <ul>
<li>MySQL 3.23 or above (MySQLi supported)</li> <li>MySQL(i): 4.1 or above</li>
<li>PostgreSQL 7.3+</li> <li>PostgreSQL: 8.2+</li>
<li>SQLite 2.8.2+</li> <li>SQLite: 2.8.2+</li>
<li>Firebird 2.0+</li> <li>Firebird: 2.0+</li>
<li>MS SQL Server 2000 or above (directly or via ODBC)</li> <li>MS SQL Server 2000 or above (directly or via ODBC)</li>
<li>Oracle</li> <li>Oracle: 9.2+</li>
</ul> </ul>
</li> </li>
<li><strong>PHP 4.3.3+ (>=4.3.3, >4.4.x, >5.x.x, >6.0-dev (compatible))</strong> with support for the database you intend to use.</li> <li><strong>PHP 5.2.0+ </strong> with support for the database you intend to use.</li>
<li>getimagesize() function need to be enabled.</li> <li>getimagesize() function need to be enabled.</li>
<li>These optional presence of the following modules within PHP will provide access to additional features, but they are not required. <li>These optional presence of the following modules within PHP will provide access to additional features, but they are not required.
<ul> <ul>

View file

@ -100,6 +100,16 @@ abstract class phpbb
'installed' => false, 'installed' => false,
); );
/**
* @var array Last notice occurred in message handler
*/
public static $last_notice = array(
'file' => '',
'line' => 0,
'message' => '',
'errno' => E_NOTICE,
);
/**#@+ /**#@+
* Permission constant * Permission constant
*/ */

View file

@ -2006,18 +2006,27 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
{ {
global $msg_title, $msg_long_text; global $msg_title, $msg_long_text;
// Do not display notices if we suppress them via @
if (error_reporting() == 0)
{
return;
}
// Message handler is stripping text. In case we need it, we are able to define long text... // Message handler is stripping text. In case we need it, we are able to define long text...
if (isset($msg_long_text) && $msg_long_text && !$msg_text) if (isset($msg_long_text) && $msg_long_text && !$msg_text)
{ {
$msg_text = $msg_long_text; $msg_text = $msg_long_text;
} }
// Store information for later use
phpbb::$last_notice = array(
'file' => $errfile,
'line' => $errline,
'message' => $msg_text,
'php_error' => (!empty($php_errormsg)) ? $php_errormsg : '',
'errno' => $errno,
);
// Do not display notices if we suppress them via @
if (error_reporting() == 0)
{
return;
}
switch ($errno) switch ($errno)
{ {
case E_NOTICE: case E_NOTICE:

View file

@ -70,8 +70,8 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30
'3.0.x' => true, '3.0.x' => true,
), ),
'mssql_2005'=> array( 'mssql_2005'=> array(
'LABEL' => 'MS SQL Server [ 2005 ]', 'LABEL' => 'MS SQL Server [ 2005/2008 ]',
'MODULE' => 'sqlsrv', 'MODULE' => array('sqlsrv', 'sqlsrv_ts'),
'DRIVER' => 'mssql_2005', 'DRIVER' => 'mssql_2005',
'AVAILABLE' => true, 'AVAILABLE' => true,
'3.0.x' => true, '3.0.x' => true,
@ -118,6 +118,8 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30
} }
} }
$any_db_support = false;
// now perform some checks whether they are really available // now perform some checks whether they are really available
foreach ($available_dbms as $db_name => $db_ary) foreach ($available_dbms as $db_name => $db_ary)
{ {
@ -136,9 +138,22 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30
$dll = $db_ary['MODULE']; $dll = $db_ary['MODULE'];
if (!@extension_loaded($dll)) if (!is_array($dll))
{ {
if (!can_load_dll($dll)) $dll = array($dll);
}
$is_available = false;
foreach ($dll as $test_dll)
{
if (@extension_loaded($test_dll) || can_load_dll($test_dll))
{
$is_available = true;
break;
}
}
if (!$is_available)
{ {
if ($return_unavailable) if ($return_unavailable)
{ {
@ -150,7 +165,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_30
} }
continue; continue;
} }
}
$any_db_support = true; $any_db_support = true;
} }
@ -343,21 +358,21 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
case 'mysql': case 'mysql':
if (version_compare($db->sql_server_info(true), '4.1.3', '<')) if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQL']; $error[] = phpbb::$user->lang['INST_ERR_DB_MYSQL_VERSION'];
} }
break; break;
case 'mysqli': case 'mysqli':
if (version_compare($db->sql_server_info(true), '4.1.3', '<')) if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQLI']; $error[] = phpbb::$user->lang['INST_ERR_DB_MYSQLI_VERSION'];
} }
break; break;
case 'sqlite': case 'sqlite':
if (version_compare($db->sql_server_info(true), '2.8.2', '<')) if (version_compare($db->sql_server_info(true), '2.8.2', '<'))
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_SQLITE']; $error[] = phpbb::$user->lang['INST_ERR_DB_SQLITE_VERSION'];
} }
break; break;
@ -369,7 +384,7 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
preg_match('#V([\d.]+)#', $val, $match); preg_match('#V([\d.]+)#', $val, $match);
if ($match[1] < 2) if ($match[1] < 2)
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD']; $error[] = phpbb::$user->lang['INST_ERR_DB_FIREBIRD_VERSION'];
} }
$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES); $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
@ -383,9 +398,9 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
else else
{ {
$sql = "SELECT * $sql = "SELECT *
FROM RDB$FUNCTIONS FROM RDB\$FUNCTIONS
WHERE RDB$SYSTEM_FLAG IS NULL WHERE RDB\$SYSTEM_FLAG IS NULL
AND RDB$FUNCTION_NAME = 'CHAR_LENGTH'"; AND RDB\$FUNCTION_NAME = 'CHAR_LENGTH'";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
@ -393,7 +408,7 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
// if its a UDF, its too old // if its a UDF, its too old
if ($row) if ($row)
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD']; $error[] = phpbb::$user->lang['INST_ERR_DB_FIREBIRD_VERSION'];
} }
else else
{ {
@ -402,7 +417,7 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if (!$result) // This can only fail if char_length is not defined if (!$result) // This can only fail if char_length is not defined
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD']; $error[] = phpbb::$user->lang['INST_ERR_DB_FIREBIRD_VERSION'];
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
@ -456,7 +471,7 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<')) if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<'))
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE']; $error[] = phpbb::$user->lang['INST_ERR_DB_ORACLE_VERSION'];
} }
if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8') if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8')
@ -466,6 +481,13 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
break; break;
case 'postgres': case 'postgres':
if (version_compare($db->sql_server_info(true), '8.2', '<'))
{
$error[] = phpbb::$user->lang['INST_ERR_DB_POSTGRES_VERSION'];
}
else
{
$sql = "SHOW server_encoding;"; $sql = "SHOW server_encoding;";
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result); $row = $db->sql_fetchrow($result);
@ -473,7 +495,8 @@ function connect_check_db($dbms_details, $table_prefix, $dbhost, $dbuser, $dbpas
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
{ {
$error[] = phpbb::$user->lang['INST_ERR_DB_NO_POSTGRES']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_POSTGRES_UTF8'];
}
} }
break; break;

View file

@ -769,7 +769,8 @@ class install_install extends module
// Create a list of any PHP modules we wish to have loaded // Create a list of any PHP modules we wish to have loaded
$load_extensions = array(); $load_extensions = array();
$available_dbms = get_available_dbms($data['dbms']); $available_dbms = get_available_dbms($data['dbms']);
$check_exts = array_merge(array($available_dbms[$data['dbms']]['MODULE']), $this->php_dlls_other);
$check_exts = array_merge($this->php_dlls_other);
foreach ($check_exts as $dll) foreach ($check_exts as $dll)
{ {
@ -784,6 +785,37 @@ class install_install extends module
} }
} }
$db_module = $available_dbms[$data['dbms']]['MODULE'];
if (!is_array($db_module))
{
$db_module = array($db_module);
}
$load_dll = true;
foreach ($db_module as $dll)
{
if (@extension_loaded($dll))
{
$load_dll = false;
break;
}
if (!can_load_dll($dll))
{
$load_dll = false;
break;
}
$load_dll = true;
}
if ($load_dll)
{
$dll = current($db_module);
$load_extensions[] = $dll . '.' . PHP_SHLIB_SUFFIX;
}
// Create a lock file to indicate that there is an install in progress // Create a lock file to indicate that there is an install in progress
$fp = @fopen(PHPBB_ROOT_PATH . 'cache/install_lock', 'wb'); $fp = @fopen(PHPBB_ROOT_PATH . 'cache/install_lock', 'wb');
if ($fp === false) if ($fp === false)

View file

@ -230,14 +230,15 @@ $lang = array_merge($lang, array(
'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.',
'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.',
'INST_ERR_DB_NO_ERROR' => 'No error message given.', 'INST_ERR_DB_NO_ERROR' => 'No error message given.',
'INST_ERR_DB_NO_MYSQL' => 'The version of MySQL installed on the target server must be at least 4.1, phpBB 3.1 cannot be installed on an older version.',
'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on the target server must be at least 4.1, phpBB 3.1 cannot be installed on an older version.', 'INST_ERR_DB_MYSQL_VERSION' => 'The version of MySQL installed on the target server must be at least 4.1, phpBB 3.1 cannot be installed on an older version.',
'INST_ERR_DB_NO_SQLITE' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.', 'INST_ERR_DB_SQLITE_VERSION' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 2.8.2.',
'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on the target server must be at least 9.2, phpBB 3.1 cannot be installed on an older version.', 'INST_ERR_DB_ORACLE_VERSION' => 'The version of Oracle installed on the target server must be at least 9.2, phpBB 3.1 cannot be installed on an older version.',
'INST_ERR_DB_FIREBIRD_VERSION' => 'The version of Firebird installed on this machine is older than 2.0, please upgrade to a newer version.',
'INST_ERR_DB_POSTGRES_VERSION' => 'The version of PostgreSQL installed on this machine is older than 8.2, please upgrade to a newer version.',
'INST_ERR_DB_NO_ORACLE_NLS' => 'You must configure Oracle so that the <var>NLS_CHARACTERSET</var> parameter is set to <var>ALU32UTF8</var>.', 'INST_ERR_DB_NO_ORACLE_NLS' => 'You must configure Oracle so that the <var>NLS_CHARACTERSET</var> parameter is set to <var>ALU32UTF8</var>.',
'INST_ERR_DB_NO_FIREBIRD' => 'The version of Firebird installed on this machine is older than 2.0, please upgrade to a newer version.',
'INST_ERR_DB_NO_FIREBIRD_PS' => 'The database you selected for Firebird has a page size less than 8192, it must be at least 8192.', 'INST_ERR_DB_NO_FIREBIRD_PS' => 'The database you selected for Firebird has a page size less than 8192, it must be at least 8192.',
'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.', 'INST_ERR_DB_NO_POSTGRES_UTF8' => 'The database you have selected was not created in <var>UNICODE</var> or <var>UTF8</var> encoding. Try installing with a database in <var>UNICODE</var> or <var>UTF8</var> encoding.',
'INST_ERR_DB_NO_NAME' => 'No database name specified.', 'INST_ERR_DB_NO_NAME' => 'No database name specified.',
'INST_ERR_EMAIL_INVALID' => 'The e-mail address you entered is invalid.', 'INST_ERR_EMAIL_INVALID' => 'The e-mail address you entered is invalid.',
'INST_ERR_EMAIL_MISMATCH' => 'The e-mails you entered did not match.', 'INST_ERR_EMAIL_MISMATCH' => 'The e-mails you entered did not match.',