1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11183] Remove $load_extensions and weird dl() calls

PHPBB3-11183
This commit is contained in:
Igor Wiedler
2012-11-10 11:25:22 +01:00
parent 957508c8b1
commit 195014867a
8 changed files with 23 additions and 125 deletions

View File

@@ -57,19 +57,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha
static public function is_available()
{
global $phpbb_root_path, $phpEx;
if (@extension_loaded('gd'))
{
return true;
}
if (!function_exists('can_load_dll'))
{
include($phpbb_root_path . 'includes/functions_install.' . $phpEx);
}
return can_load_dll('gd');
return @extension_loaded('gd');
}
/**

View File

@@ -46,19 +46,7 @@ class phpbb_captcha_gd_wave extends phpbb_default_captcha
static public function is_available()
{
global $phpbb_root_path, $phpEx;
if (@extension_loaded('gd'))
{
return true;
}
if (!function_exists('can_load_dll'))
{
include($phpbb_root_path . 'includes/functions_install.' . $phpEx);
}
return can_load_dll('gd');
return @extension_loaded('gd');
}
static public function get_name()

View File

@@ -15,27 +15,6 @@ if (!defined('IN_PHPBB'))
exit;
}
/**
* 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.
@@ -159,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;
}
@@ -520,17 +496,14 @@ 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.1.x auto-generated configuration file\n// Do not change anything in this file!\n";
@@ -543,7 +516,6 @@ function phpbb_create_config_file_data($data, $dbms, $load_extensions, $debug =
'dbpasswd' => htmlspecialchars_decode($data['dbpasswd']),
'table_prefix' => $data['table_prefix'],
'acm_type' => 'phpbb_cache_driver_file',
'load_extensions' => $load_extensions,
);
foreach ($config_data_array as $key => $value)

View File

@@ -476,7 +476,6 @@ class phpbb_questionnaire_phpbb_data_provider
$result['dbms'] = $dbms;
$result['acm_type'] = $acm_type;
$result['load_extensions'] = $load_extensions;
$result['user_agent'] = 'Unknown';
$result['dbms_version'] = $db->sql_server_info(true);