Remove references to safe_mode INI setting
authorKevin Israel <pleasestand@live.com>
Sat, 13 Feb 2016 00:18:26 +0000 (19:18 -0500)
committerKevin Israel <pleasestand@live.com>
Sat, 13 Feb 2016 00:18:26 +0000 (19:18 -0500)
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

INSTALL
includes/DefaultSettings.php
includes/GlobalFunctions.php
includes/HttpFunctions.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php
includes/installer/i18n/en.json
includes/installer/i18n/qqq.json
includes/mail/UserMailer.php

diff --git a/INSTALL b/INSTALL
index 4651a0c..0e8eb92 100644 (file)
--- 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
index a6733d7..e3c7713 100644 (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;
 
index 4844531..a1ea936 100644 (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 );
 }
 
 /**
index 5ede04f..032710c 100644 (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;
                        }
                }
index 4a006ac..ded45c2 100644 (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
index 4f20c70..e054709 100644 (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.
index c6f3e1d..ea03831 100644 (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.",
index 80d5e3e..e20f230 100644 (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}}",
index 85595f1..b5a09bd 100644 (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();