Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2282,19 +2282,30 @@ |
2283 | 2283 | * |
2284 | 2284 | * @param $extension String A PHP extension. The file suffix (.so or .dll) |
2285 | 2285 | * should be omitted |
| 2286 | + * @param $fileName String Name of the library, if not $extension.suffix |
2286 | 2287 | * @return Bool - Whether or not the extension is loaded |
2287 | 2288 | */ |
2288 | | -function wfDl( $extension ) { |
| 2289 | +function wfDl( $extension, $fileName = null ) { |
2289 | 2290 | if( extension_loaded( $extension ) ) { |
2290 | 2291 | return true; |
2291 | 2292 | } |
2292 | 2293 | |
2293 | | - $canDl = ( function_exists( 'dl' ) && is_callable( 'dl' ) |
| 2294 | + $canDl = false; |
| 2295 | + $sapi = php_sapi_name(); |
| 2296 | + if( version_compare( PHP_VERSION, '5.3.0', '<' ) || |
| 2297 | + $sapi == 'cli' || $sapi == 'cgi' || $sapi == 'embed' ) |
| 2298 | + { |
| 2299 | + $canDl = ( function_exists( 'dl' ) && is_callable( 'dl' ) |
2294 | 2300 | && wfIniGetBool( 'enable_dl' ) && !wfIniGetBool( 'safe_mode' ) ); |
| 2301 | + } |
2295 | 2302 | |
2296 | 2303 | if( $canDl ) { |
| 2304 | + $fileName = $fileName ? $fileName : $extension; |
| 2305 | + if( wfIsWindows() ) { |
| 2306 | + $fileName = 'php_' . $fileName; |
| 2307 | + } |
2297 | 2308 | wfSuppressWarnings(); |
2298 | | - dl( $extension . '.' . PHP_SHLIB_SUFFIX ); |
| 2309 | + dl( $fileName . '.' . PHP_SHLIB_SUFFIX ); |
2299 | 2310 | wfRestoreWarnings(); |
2300 | 2311 | } |
2301 | 2312 | return extension_loaded( $extension ); |