From: Kevin Israel Date: Sat, 13 Feb 2016 00:18:26 +0000 (-0500) Subject: Remove references to safe_mode INI setting X-Git-Tag: 1.31.0-rc.0~7962^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=94e5b80fee82f5612897481bfa67a9a9623b2064;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/INSTALL b/INSTALL index 4651a0c7bf..0e8eb92a37 100644 --- a/INSTALL +++ b/INSTALL @@ -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 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index a6733d7a74..e3c77131d8 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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; diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 4844531a1a..a1ea9360cf 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -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 ); } /** diff --git a/includes/HttpFunctions.php b/includes/HttpFunctions.php index 5ede04f0da..032710c1e7 100644 --- a/includes/HttpFunctions.php +++ b/includes/HttpFunctions.php @@ -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; } } diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 4a006ac0d1..ded45c2313 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -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 diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 4f20c7003a..e054709184 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -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. diff --git a/includes/installer/i18n/en.json b/includes/installer/i18n/en.json index c6f3e1df7f..ea03831712 100644 --- a/includes/installer/i18n/en.json +++ b/includes/installer/i18n/en.json @@ -52,7 +52,6 @@ "config-outdated-sqlite": "Warning: you have SQLite $1, which is lower than minimum required version $2. SQLite will be unavailable.", "config-no-fts3": "Warning: SQLite is compiled without the [//sqlite.org/fts3.html FTS3 module], search features will be unavailable on this backend.", "config-mbstring": "Fatal: [http://www.php.net/manual/en/ref.mbstring.php#mbstring.overload mbstring.func_overload] is active!\nThis option causes errors and may corrupt data unpredictably.\nYou cannot install or use MediaWiki unless this option is disabled.", - "config-safe-mode": "Warning: PHP's [http://www.php.net/features.safe-mode safe mode] is active.\nIt may cause problems, particularly if using file uploads and math 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": "Fatal: 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": "Fatal: PHP's PCRE module seems to be compiled without PCRE_UTF8 support.\nMediaWiki requires UTF-8 support to function correctly.", diff --git a/includes/installer/i18n/qqq.json b/includes/installer/i18n/qqq.json index 80d5e3e844..e20f230000 100644 --- a/includes/installer/i18n/qqq.json +++ b/includes/installer/i18n/qqq.json @@ -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}}", diff --git a/includes/mail/UserMailer.php b/includes/mail/UserMailer.php index 85595f1286..b5a09bde82 100644 --- a/includes/mail/UserMailer.php +++ b/includes/mail/UserMailer.php @@ -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();