Remove references to safe_mode INI setting

The feature no longer exists starting in PHP 5.4.0, and MediaWiki
now only supports PHP 5.5.9 or newer.

Change-Id: I3f2d1b564c50f0a28ec1ec0abd7d1b242e26953b
This commit is contained in:
Kevin Israel 2016-02-12 19:18:26 -05:00
parent 592637225a
commit 94e5b80fee
9 changed files with 16 additions and 57 deletions

View file

@ -18,8 +18,7 @@ MediaWiki is developed and tested mainly on Unix/Linux platforms, but should
work on Windows as well.
If your PHP is configured as a CGI plug-in rather than an Apache module you may
experience problems, as this configuration is not well tested. safe_mode is also
not tested and unlikely to work.
experience problems, as this configuration is not well tested.
Support for rendering mathematical formulas requires installing the Math extension,
see https://www.mediawiki.org/wiki/Extension:Math

View file

@ -1555,7 +1555,6 @@ $wgSMTP = false;
/**
* Additional email parameters, will be passed as the last argument to mail() call.
* If using safe_mode this has no effect
*/
$wgAdditionalMailParams = null;

View file

@ -2366,16 +2366,13 @@ function wfEscapeShellArg( /*...*/ ) {
/**
* Check if wfShellExec() is effectively disabled via php.ini config
*
* @return bool|string False or one of (safemode,disabled)
* @return bool|string False or 'disabled'
* @since 1.22
*/
function wfShellExecDisabled() {
static $disabled = null;
if ( is_null( $disabled ) ) {
if ( wfIniGetBool( 'safe_mode' ) ) {
wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" );
$disabled = 'safemode';
} elseif ( !function_exists( 'proc_open' ) ) {
if ( !function_exists( 'proc_open' ) ) {
wfDebug( "proc_open() is disabled\n" );
$disabled = 'disabled';
} else {
@ -2416,9 +2413,7 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(),
$disabled = wfShellExecDisabled();
if ( $disabled ) {
$retval = 1;
return $disabled == 'safemode' ?
'Unable to run external programs in safe mode.' :
'Unable to run external programs, proc_open() is disabled.';
return 'Unable to run external programs, proc_open() is disabled.';
}
$includeStderr = isset( $options['duplicateStderr'] ) && $options['duplicateStderr'];
@ -2659,10 +2654,8 @@ function wfInitShellLocale() {
}
$done = true;
global $wgShellLocale;
if ( !wfIniGetBool( 'safe_mode' ) ) {
putenv( "LC_CTYPE=$wgShellLocale" );
setlocale( LC_CTYPE, $wgShellLocale );
}
putenv( "LC_CTYPE=$wgShellLocale" );
setlocale( LC_CTYPE, $wgShellLocale );
}
/**

View file

@ -818,7 +818,7 @@ class CurlHttpRequest extends MWHttpRequest {
MediaWiki\suppressWarnings();
if ( !curl_setopt( $curlHandle, CURLOPT_FOLLOWLOCATION, true ) ) {
wfDebug( __METHOD__ . ": Couldn't set CURLOPT_FOLLOWLOCATION. " .
"Probably safe_mode or open_basedir is set.\n" );
"Probably open_basedir is set.\n" );
// Continue the processing. If it were in curl_setopt_array,
// processing would have halted on its entry
}
@ -863,8 +863,8 @@ class CurlHttpRequest extends MWHttpRequest {
}
if ( version_compare( PHP_VERSION, '5.6.0', '<' ) ) {
if ( strval( ini_get( 'open_basedir' ) ) !== '' || wfIniGetBool( 'safe_mode' ) ) {
wfDebug( "Cannot follow redirects in safe mode\n" );
if ( strval( ini_get( 'open_basedir' ) ) !== '' ) {
wfDebug( "Cannot follow redirects when open_basedir is set\n" );
return false;
}
}

View file

@ -118,7 +118,6 @@ abstract class Installer {
'envCheckDB',
'envCheckBrokenXML',
'envCheckMbstring',
'envCheckSafeMode',
'envCheckXML',
'envCheckPCRE',
'envCheckMemory',
@ -194,7 +193,6 @@ abstract class Installer {
protected $internalDefaults = array(
'_UserLang' => 'en',
'_Environment' => false,
'_SafeMode' => false,
'_RaiseMemory' => false,
'_UpgradeDone' => false,
'_InstallDone' => false,
@ -763,19 +761,6 @@ abstract class Installer {
return true;
}
/**
* Environment check for safe_mode.
* @return bool
*/
protected function envCheckSafeMode() {
if ( wfIniGetBool( 'safe_mode' ) ) {
$this->setVar( '_SafeMode', true );
$this->showMessage( 'config-safe-mode' );
}
return true;
}
/**
* Environment check for the XML module.
* @return bool

View file

@ -33,7 +33,6 @@ class LocalSettingsGenerator {
protected $values = array();
protected $groupPermissions = array();
protected $dbSettings = '';
protected $safeMode = false;
protected $IP;
/**
@ -91,7 +90,6 @@ class LocalSettingsGenerator {
}
$this->dbSettings = $db->getLocalSettings();
$this->safeMode = $installer->getVar( '_SafeMode' );
$this->values['wgEmergencyContact'] = $this->values['wgPasswordSender'];
}
@ -248,7 +246,6 @@ class LocalSettingsGenerator {
$locale = '';
}
$hashedUploads = $this->safeMode ? '' : '#';
$metaNamespace = '';
if ( $this->values['wgMetaNamespace'] !== $this->values['wgSitename'] ) {
$metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n";
@ -380,12 +377,6 @@ ${serverSetting}
## available UTF-8 locale
{$locale}\$wgShellLocale = \"{$this->values['wgShellLocale']}\";
## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
{$hashedUploads}\$wgHashedUploadDirectory = false;
## Set \$wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.

View file

@ -52,7 +52,6 @@
"config-outdated-sqlite": "<strong>Warning:</strong> you have SQLite $1, which is lower than minimum required version $2. SQLite will be unavailable.",
"config-no-fts3": "<strong>Warning:</strong> SQLite is compiled without the [//sqlite.org/fts3.html FTS3 module], search features will be unavailable on this backend.",
"config-mbstring": "<strong>Fatal: [http://www.php.net/manual/en/ref.mbstring.php#mbstring.overload mbstring.func_overload] is active!</strong>\nThis option causes errors and may corrupt data unpredictably.\nYou cannot install or use MediaWiki unless this option is disabled.",
"config-safe-mode": "<strong>Warning:</strong> PHP's [http://www.php.net/features.safe-mode safe mode] is active.\nIt may cause problems, particularly if using file uploads and <code>math</code> support.",
"config-xml-bad": "PHP's XML module is missing.\nMediaWiki requires functions in this module and will not work in this configuration.\nYou may need to install the php-xml RPM package.",
"config-pcre-old": "<strong>Fatal:</strong> PCRE $1 or later is required.\nYour PHP binary is linked with PCRE $2.\n[https://www.mediawiki.org/wiki/Manual:Errors_and_symptoms/PCRE More information].",
"config-pcre-no-utf8": "<strong>Fatal:</strong> PHP's PCRE module seems to be compiled without PCRE_UTF8 support.\nMediaWiki requires UTF-8 support to function correctly.",

View file

@ -70,7 +70,6 @@
"config-outdated-sqlite": "Used as warning. Parameters:\n* $1 - the version of SQLite that has been installed\n* $2 - minimum version",
"config-no-fts3": "A \"[[:wikipedia:Front and back ends|backend]]\" is a system or component that ordinary users don't interact with directly and don't need to know about, and that is responsible for a distinct task or service - for example, a storage back-end is a generic system for storing data which other applications can use. Possible alternatives for back-end are \"system\" or \"service\", or (depending on context and language) even leave it untranslated.",
"config-mbstring": "{{Related|Config-fatal}}",
"config-safe-mode": "Status message in the MediaWiki installer environment checks.",
"config-xml-bad": "Status message in the MediaWiki installer environment checks.",
"config-pcre-old": "Parameters:\n* $1 - minimum PCRE version number\n* $2 - the installed version of [[wikipedia:PCRE|PCRE]]\n{{Related|Config-fatal}}",
"config-pcre-no-utf8": "PCRE is a name of a programmers' library for supporting regular expressions. It can probably be translated without change.\n{{Related|Config-fatal}}",

View file

@ -409,20 +409,14 @@ class UserMailer {
set_error_handler( 'UserMailer::errorHandler' );
try {
$safeMode = wfIniGetBool( 'safe_mode' );
foreach ( $to as $recip ) {
if ( $safeMode ) {
$sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers );
} else {
$sent = mail(
$recip,
self::quotedPrintable( $subject ),
$body,
$headers,
$extraParams
);
}
$sent = mail(
$recip,
self::quotedPrintable( $subject ),
$body,
$headers,
$extraParams
);
}
} catch ( Exception $e ) {
restore_error_handler();