From: Rob Church Date: Wed, 22 Aug 2007 15:05:30 +0000 (+0000) Subject: (bug 11013) Make sure dl() is available before attempting to use it to check availabl... X-Git-Tag: 1.31.0-rc.0~51692 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=a870a6c74bb1be2241588cb3c9051fe30e180881;p=lhc%2Fweb%2Fwiklou.git (bug 11013) Make sure dl() is available before attempting to use it to check available databases in installer...this detection code is quite crap and could do with some work; got a partial patch, but a few bits (the UI, JavaScript) are broken...committing this to fix the *immediate* problem --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index d94c362944..83773fd304 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -407,6 +407,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 9026) Incorrect heading numbering when viewing Special:Statistics with "auto-numbered headings" enabled * Fixed invalid XHTML in Special:Upload +* (bug 11013) Make sure dl() is available before attempting to use it to check + available databases in installer == API changes since 1.10 == diff --git a/config/index.php b/config/index.php index 82b651c088..274a1531e0 100644 --- a/config/index.php +++ b/config/index.php @@ -295,7 +295,7 @@ error_reporting( 0 ); $phpdatabases = array(); foreach (array_keys($ourdb) as $db) { $compname = $ourdb[$db]['compile']; - if (extension_loaded($compname) or dl($compname . '.' . PHP_SHLIB_SUFFIX)) { + if( extension_loaded( $compname ) || ( mw_have_dl() && dl( "{$compname}." . PHP_SHLIB_SUFFIX ) ) ) { array_push($phpdatabases, $db); $ourdb[$db]['havedriver'] = 1; } diff --git a/install-utils.inc b/install-utils.inc index 9723e8dc26..a9892578c0 100644 --- a/install-utils.inc +++ b/install-utils.inc @@ -124,4 +124,17 @@ function mw_get_session_save_path() { return $path; } -?> +/** + * Is dl() available to us? + * + * According to http://uk.php.net/manual/en/function.dl.php, dl() + * is *not* available when `enable_dl` is off, or under `safe_mode` + * + * @return bool + */ +function mw_have_dl() { + return function_exists( 'dl' ) + && is_callable( 'dl' ) + && ini_get( 'enable_dl' ) + && !ini_get( 'safe_mode' ); +} \ No newline at end of file