From f36d56a2fea763c9a6de4e941f3c460c9686d89a Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Fri, 5 Dec 2008 17:25:22 +0000 Subject: [PATCH] Cleanup to wfGetNull(): * Add override in case /dev/null isn't accessible (bug 11009) * Use wfGetNull() in ProxyTools rather than hardcoding it --- RELEASE-NOTES | 2 ++ includes/DefaultSettings.php | 7 +++++++ includes/GlobalFunctions.php | 4 ++++ includes/ProxyTools.php | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e94bf4c7e2..23f61fc1fa 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -68,6 +68,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN and should still be used in code meant to be compatible with v1.13 or older. * MediaWiki can be forced to use private IPs forwarded by a proxy server by using $wgUsePrivateIPs. +* (bug 11009) The null file (ie: /dev/null) can be configured with $wgNullFile. + Useful for overriding if the normal file isn't accessible === Migrated extensions === The following extensions are migrated into MediaWiki 1.14: diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index f299ec6980..06035d4bac 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -169,6 +169,13 @@ $wgUploadBaseUrl = ""; */ $wgDirectoryMode = 0777; +/** + * Path to null output (/dev/null on *nix, NUL on Windows) + * Can be left unset unless you need to override it (ie: + * open_basedir won't let you hit /dev/null. See bug 11009) + */ +$wgNullFile = false; + /** * New file storage paths; currently used only for deleted files. * Set it like this: diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 44304409dc..d99bf67819 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2816,6 +2816,10 @@ function wfLoadExtensionMessages( $extensionName, $langcode = false ) { * @return string */ function wfGetNull() { + global $wgNullFile; + if ( $wgNullFile ) { + return $wgNullFile; + } return wfIsWindows() ? 'NUL' : '/dev/null'; diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 771fd57796..e7c22f89c2 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -166,7 +166,7 @@ function wfProxyCheck() { escapeshellarg( $port ), escapeshellarg( $url ) )); - exec( "php $params &>/dev/null &" ); + exec( "php $params &>" . wfGetNull() . " &" ); } # Set MemCached key $wgMemc->set( $mcKey, 1, $wgProxyMemcExpiry ); -- 2.20.1