diff options
Diffstat (limited to 'phpBB/includes/functions_install.php')
| -rw-r--r-- | phpBB/includes/functions_install.php | 91 | 
1 files changed, 15 insertions, 76 deletions
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index eae136808c..7a799993db 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -2,9 +2,8 @@  /**  *  * @package install -* @version $Id$  * @copyright (c) 2006 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2  *  */ @@ -17,27 +16,6 @@ if (!defined('IN_PHPBB'))  }  /** -* Determine if we are able to load a specified PHP module and do so if possible -*/ -function can_load_dll($dll) -{ -	// SQLite2 is a tricky thing, from 5.0.0 it requires PDO; if PDO is not loaded we must state that SQLite is unavailable -	// as the installer doesn't understand that the extension has a prerequisite. -	// -	// On top of this sometimes the SQLite extension is compiled for a different version of PDO -	// by some Linux distributions which causes phpBB to bomb out with a blank page. -	// -	// Net result we'll disable automatic inclusion of SQLite support -	// -	// See: r9618 and #56105 -	if ($dll == 'sqlite') -	{ -		return false; -	} -	return ((@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'on') && (!@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'off') && function_exists('dl') && @dl($dll . '.' . PHP_SHLIB_SUFFIX)) ? true : false; -} - -/**  * Returns an array of available DBMS with some data, if a DBMS is specified it will only  * return data for that DBMS and will load its extension if necessary.  */ @@ -50,7 +28,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'firebird',  			'MODULE'		=> 'interbase',  			'DELIM'			=> ';;', -			'COMMENTS'		=> 'remove_remarks',  			'DRIVER'		=> 'firebird',  			'AVAILABLE'		=> true,  			'2.0.x'			=> false, @@ -60,7 +37,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'mysql_41',  			'MODULE'		=> 'mysqli',  			'DELIM'			=> ';', -			'COMMENTS'		=> 'remove_remarks',  			'DRIVER'		=> 'mysqli',  			'AVAILABLE'		=> true,  			'2.0.x'			=> true, @@ -70,7 +46,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'mysql',  			'MODULE'		=> 'mysql',  			'DELIM'			=> ';', -			'COMMENTS'		=> 'remove_remarks',  			'DRIVER'		=> 'mysql',  			'AVAILABLE'		=> true,  			'2.0.x'			=> true, @@ -80,7 +55,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'mssql',  			'MODULE'		=> 'mssql',  			'DELIM'			=> 'GO', -			'COMMENTS'		=> 'remove_comments',  			'DRIVER'		=> 'mssql',  			'AVAILABLE'		=> true,  			'2.0.x'			=> true, @@ -90,7 +64,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'mssql',  			'MODULE'		=> 'odbc',  			'DELIM'			=> 'GO', -			'COMMENTS'		=> 'remove_comments',  			'DRIVER'		=> 'mssql_odbc',  			'AVAILABLE'		=> true,  			'2.0.x'			=> true, @@ -100,17 +73,15 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'mssql',  			'MODULE'		=> 'sqlsrv',  			'DELIM'			=> 'GO', -			'COMMENTS'		=> 'remove_comments',  			'DRIVER'		=> 'mssqlnative',  			'AVAILABLE'		=> true,  			'2.0.x'			=> false, -		),			 +		),  		'oracle'	=>	array(  			'LABEL'			=> 'Oracle',  			'SCHEMA'		=> 'oracle',  			'MODULE'		=> 'oci8',  			'DELIM'			=> '/', -			'COMMENTS'		=> 'remove_comments',  			'DRIVER'		=> 'oracle',  			'AVAILABLE'		=> true,  			'2.0.x'			=> false, @@ -120,7 +91,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'postgres',  			'MODULE'		=> 'pgsql',  			'DELIM'			=> ';', -			'COMMENTS'		=> 'remove_comments',  			'DRIVER'		=> 'postgres',  			'AVAILABLE'		=> true,  			'2.0.x'			=> true, @@ -130,7 +100,6 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  			'SCHEMA'		=> 'sqlite',  			'MODULE'		=> 'sqlite',  			'DELIM'			=> ';', -			'COMMENTS'		=> 'remove_remarks',  			'DRIVER'		=> 'sqlite',  			'AVAILABLE'		=> true,  			'2.0.x'			=> false, @@ -169,18 +138,15 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20  		if (!@extension_loaded($dll))  		{ -			if (!can_load_dll($dll)) +			if ($return_unavailable)  			{ -				if ($return_unavailable) -				{ -					$available_dbms[$db_name]['AVAILABLE'] = false; -				} -				else -				{ -					unset($available_dbms[$db_name]); -				} -				continue; +				$available_dbms[$db_name]['AVAILABLE'] = false;  			} +			else +			{ +				unset($available_dbms[$db_name]); +			} +			continue;  		}  		$any_db_support = true;  	} @@ -473,19 +439,6 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,  }  /** -* Removes comments from schema files -* -* @deprecated		Use phpbb_remove_comments() instead. -*/ -function remove_remarks(&$sql) -{ -	// Remove # style comments -	$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql)); - -	// Return by reference -} - -/**  * Removes "/* style" as well as "# style" comments from $input.  *  * @param string $input		Input string @@ -494,17 +447,11 @@ function remove_remarks(&$sql)  */  function phpbb_remove_comments($input)  { -	if (!function_exists('remove_comments')) -	{ -		global $phpbb_root_path, $phpEx; -		require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); -	} - -	// Remove /* */ comments -	remove_comments($input); +	// Remove /* */ comments (http://ostermiller.org/findcomment.html) +	$input = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $input);  	// Remove # style comments -	remove_remarks($input); +	$input = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $input));  	return $input;  } @@ -549,19 +496,16 @@ function adjust_language_keys_callback($matches)  *  * @param	array	$data Array containing the database connection information  * @param	string	$dbms The name of the DBAL class to use -* @param	array	$load_extensions Array of additional extensions that should be loaded  * @param	bool	$debug If the debug constants should be enabled by default or not  * @param	bool	$debug_test If the DEBUG_TEST constant should be added  *					NOTE: Only for use within the testing framework  *  * @return	string	The output to write to the file  */ -function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug = false, $debug_test = false) +function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test = false)  { -	$load_extensions = implode(',', $load_extensions); -  	$config_data = "<?php\n"; -	$config_data .= "// phpBB 3.0.x auto-generated configuration file\n// Do not change anything in this file!\n"; +	$config_data .= "// phpBB 3.1.x auto-generated configuration file\n// Do not change anything in this file!\n";  	$config_data_array = array(  		'dbms'			=> $dbms, @@ -571,8 +515,7 @@ function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug =  		'dbuser'		=> $data['dbuser'],  		'dbpasswd'		=> htmlspecialchars_decode($data['dbpasswd']),  		'table_prefix'	=> $data['table_prefix'], -		'acm_type'		=> 'file', -		'load_extensions'	=> $load_extensions, +		'acm_type'		=> 'phpbb_cache_driver_file',  	);  	foreach ($config_data_array as $key => $value) @@ -585,12 +528,10 @@ function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug =  	if ($debug)  	{  		$config_data .= "@define('DEBUG', true);\n"; -		$config_data .= "@define('DEBUG_EXTRA', true);\n";  	}  	else  	{  		$config_data .= "// @define('DEBUG', true);\n"; -		$config_data .= "// @define('DEBUG_EXTRA', true);\n";  	}  	if ($debug_test) @@ -600,5 +541,3 @@ function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug =  	return $config_data;  } - -?>
\ No newline at end of file  | 
