From 46267dce884f76204a21f8c72bb0eb28c47c228c Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Tue, 25 Feb 2003 16:49:45 +0000 Subject: [PATCH] added extension loading. please note the additional variable ' $load_extensions = "";' within config.php. git-svn-id: file:///svn/phpbb/trunk@3528 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/common.php | 11 ++++++++ phpBB/install/install.php | 56 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/phpBB/common.php b/phpBB/common.php index f9bf10da9e..e637594f5a 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -44,6 +44,17 @@ if (!defined('PHPBB_INSTALLED')) exit; } +// Load Extensions +if ( (isset($load_extensions)) && ($load_extensions != '') ) +{ + $load_extensions = explode(',', $load_extensions); + + for ($i = 0; $i < count($load_extensions); $i++) + { + @dl(trim($load_extensions[$i])); + } +} + // Include files require($phpbb_root_path . 'includes/acm/cache_' . $acm_type . '.'.$phpEx); require($phpbb_root_path . 'db/' . $dbms . '.'.$phpEx); diff --git a/phpBB/install/install.php b/phpBB/install/install.php index 79f4218879..95c612cc55 100644 --- a/phpBB/install/install.php +++ b/phpBB/install/install.php @@ -493,6 +493,8 @@ else if ( ( empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin } else { + $load_extensions = ''; + // // Go ahead and create the DB, then populate it // @@ -534,7 +536,40 @@ else ); $template->pparse('body'); */ - die("Error during installation: no $check_exts extension"); + // Try to load the Extensions + $loaded_extension = FALSE; + + if ( (!@ini_get('safe_mode')) && (@ini_get('enable_dl')) ) + { + $suffix = ( (defined('PHP_OS')) && (eregi('win', PHP_OS)) ) ? '.dll' : '.so'; + + if (!@extension_loaded($check_exts)) + { + if (@dl($check_exts . $suffix)) + { + $load_extensions .= ($load_extensions == '') ? $check_exts . $suffix : ',' . $check_exts . $suffix; + $loaded_extension = TRUE; + } + } + + if (!$loaded_extension) + { + if (!@extension_loaded($check_other)) + { + if (@dl($check_other . $suffix)) + { + $load_extensions .= ($load_extensions == '') ? $check_other . $suffix : ',' . $check_other . $suffix; + $loaded_extension = TRUE; + } + } + } + + } + + if (!$loaded_extension) + { + die("Error during installation: no $check_exts extension"); + } } include($phpbb_root_path . 'db/' . $dbms . '.' . $phpEx); @@ -542,6 +577,24 @@ else $db = new sql_db($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); } + // Add another Extension Checks here if you want, please do not specify the suffix + $check_extensions = array(); + $suffix = ( (defined('PHP_OS')) && (eregi('win', PHP_OS)) ) ? '.dll' : '.so'; + + for ($i = 0; $i < count($check_extensions); $i++) + { + if (!@extension_loaded($check_extensions[$i])) + { + if ( (!@ini_get('safe_mode')) && (@ini_get('enable_dl')) ) + { + if (@dl($check_extensions[$i] . $suffix)) + { + $load_extensions .= ($load_extensions == '') ? $check_extensions[$i] . $suffix : ',' . $check_extensions[$i] . $suffix; + } + } + } + } + $dbms_schema = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql'; $dbms_basic = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_basic.sql'; @@ -694,6 +747,7 @@ else $config_data .= '$dbpasswd = "' . $dbpasswd . '";' . "\n\n"; $config_data .= "\$acm_type = 'file';\n"; $config_data .= '$table_prefix = "' . $table_prefix . '";' . "\n\n"; + $config_data .= '$load_extensions = "' . $load_extensions . '";' . "\n\n"; $config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n"; $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!