(bug 11013) Make sure dl() is available before attempting to use it to check availabl...
authorRob Church <robchurch@users.mediawiki.org>
Wed, 22 Aug 2007 15:05:30 +0000 (15:05 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Wed, 22 Aug 2007 15:05:30 +0000 (15:05 +0000)
RELEASE-NOTES
config/index.php
install-utils.inc

index d94c362..83773fd 100644 (file)
@@ -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 ==
 
index 82b651c..274a153 100644 (file)
@@ -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;
        }
index 9723e8d..a989257 100644 (file)
@@ -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