Use mediawiki/at-ease library for suppressing warnings
authorKunal Mehta <legoktm@gmail.com>
Wed, 10 Jun 2015 18:29:05 +0000 (11:29 -0700)
committerBryanDavis <bdavis@wikimedia.org>
Thu, 11 Jun 2015 18:49:29 +0000 (18:49 +0000)
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.

Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.

Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.

Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4

95 files changed:
composer.json
includes/Collation.php
includes/GitInfo.php
includes/GlobalFunctions.php
includes/HistoryBlob.php
includes/HttpFunctions.php
includes/Import.php
includes/MediaWiki.php
includes/MimeMagic.php
includes/OutputPage.php
includes/Sanitizer.php
includes/Setup.php
includes/SquidPurgeClient.php
includes/StreamFile.php
includes/WebRequest.php
includes/api/ApiQueryImageInfo.php
includes/cache/CacheDependency.php
includes/cache/FileCacheBase.php
includes/cache/LocalisationCache.php
includes/cache/MessageCache.php
includes/changes/RecentChange.php
includes/content/ContentHandler.php
includes/db/Database.php
includes/db/DatabaseMssql.php
includes/db/DatabaseMysqlBase.php
includes/db/DatabaseOracle.php
includes/db/DatabasePostgres.php
includes/debug/logger/LegacyLogger.php
includes/exception/MWExceptionHandler.php
includes/filebackend/FSFile.php
includes/filebackend/FileBackendStore.php
includes/filebackend/FileOp.php
includes/filebackend/MemoryFileBackend.php
includes/filebackend/SwiftFileBackend.php
includes/filebackend/TempFSFile.php
includes/filebackend/lockmanager/FSLockManager.php
includes/filerepo/FileRepo.php
includes/installer/DatabaseInstaller.php
includes/installer/Installer.php
includes/installer/SqliteInstaller.php
includes/logging/LogEntry.php
includes/mail/UserMailer.php
includes/media/Bitmap.php
includes/media/DjVu.php
includes/media/DjVuImage.php
includes/media/Exif.php
includes/media/ExifBitmap.php
includes/media/GIF.php
includes/media/GIFMetadataExtractor.php
includes/media/IPTC.php
includes/media/ImageHandler.php
includes/media/JpegMetadataExtractor.php
includes/media/MediaHandler.php
includes/media/PNG.php
includes/media/PNGMetadataExtractor.php
includes/media/SVG.php
includes/media/SVGMetadataExtractor.php
includes/media/XCF.php
includes/media/XMP.php
includes/objectcache/MemcachedClient.php
includes/objectcache/SqlBagOStuff.php
includes/parser/Preprocessor_DOM.php
includes/resourceloader/ResourceLoaderModule.php
includes/search/SearchMySQL.php
includes/search/SearchSqlite.php
includes/skins/MediaWikiI18N.php
includes/specials/SpecialContributions.php
includes/specials/SpecialDeletedContributions.php
includes/specials/SpecialExport.php
includes/specials/SpecialLockdb.php
includes/specials/SpecialUnlockdb.php
includes/specials/SpecialVersion.php
includes/upload/UploadBase.php
includes/utils/MWCryptRand.php
includes/utils/UIDGenerator.php
languages/Language.php
maintenance/Maintenance.php
maintenance/backup.inc
maintenance/backupTextPass.inc
maintenance/checkSyntax.php
maintenance/importImages.php
maintenance/install.php
maintenance/jsparse.php
maintenance/language/StatOutputs.php
maintenance/rebuildFileCache.php
maintenance/sqlite.php
maintenance/storage/fixBug20757.php
maintenance/storage/recompressTracked.php
tests/phpunit/MediaWikiTestCase.php
tests/phpunit/includes/GlobalFunctions/GlobalTest.php
tests/phpunit/includes/api/ApiUploadTest.php
tests/phpunit/includes/debug/MWDebugTest.php
tests/phpunit/includes/libs/JavaScriptMinifierTest.php
tests/phpunit/structure/AutoLoaderTest.php
thumb.php

index 7df8ca0..fba1a82 100644 (file)
@@ -20,6 +20,7 @@
                "ext-iconv": "*",
                "leafo/lessphp": "0.5.0",
                "liuggio/statsd-php-client": "1.0.12",
+               "mediawiki/at-ease": "1.0.0",
                "oojs/oojs-ui": "0.11.4",
                "php": ">=5.3.3",
                "psr/log": "1.0.0",
index 481d8e7..c1f0b38 100644 (file)
@@ -320,16 +320,16 @@ class IcuCollation extends Collation {
                // intl extension produces non null-terminated
                // strings. Appending '' fixes it so that it doesn't generate
                // a warning on each access in debug php.
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $key = $this->mainCollator->getSortKey( $string ) . '';
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                return $key;
        }
 
        function getPrimarySortKey( $string ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $key = $this->primaryCollator->getSortKey( $string ) . '';
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                return $key;
        }
 
index fb298cf..7f05bb0 100644 (file)
@@ -281,9 +281,9 @@ class GitInfo {
                        $config = "{$this->basedir}/config";
                        $url = false;
                        if ( is_readable( $config ) ) {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $configArray = parse_ini_file( $config, true );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                                $remote = false;
 
                                // Use the "origin" remote repo if available or any other repo if not.
index 25876fb..7a9b27b 100644 (file)
@@ -860,9 +860,9 @@ function wfParseUrl( $url ) {
        if ( $wasRelative ) {
                $url = "http:$url";
        }
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        $bits = parse_url( $url );
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
        // parse_url() returns an array without scheme for some invalid URLs, e.g.
        // parse_url("%0Ahttp://example.com") == array( 'host' => '%0Ahttp', 'path' => 'example.com' )
        if ( !$bits || !isset( $bits['scheme'] ) ) {
@@ -2322,40 +2322,19 @@ function wfNegotiateType( $cprefs, $sprefs ) {
 /**
  * Reference-counted warning suppression
  *
+ * @deprecated since 1.26, use MediaWiki\suppressWarnings() directly
  * @param bool $end
  */
 function wfSuppressWarnings( $end = false ) {
-       static $suppressCount = 0;
-       static $originalLevel = false;
-
-       if ( $end ) {
-               if ( $suppressCount ) {
-                       --$suppressCount;
-                       if ( !$suppressCount ) {
-                               error_reporting( $originalLevel );
-                       }
-               }
-       } else {
-               if ( !$suppressCount ) {
-                       $originalLevel = error_reporting( E_ALL & ~(
-                               E_WARNING |
-                               E_NOTICE |
-                               E_USER_WARNING |
-                               E_USER_NOTICE |
-                               E_DEPRECATED |
-                               E_USER_DEPRECATED |
-                               E_STRICT
-                       ) );
-               }
-               ++$suppressCount;
-       }
+       MediaWiki\suppressWarnings( $end );
 }
 
 /**
+ * @deprecated since 1.26, use MediaWiki\restoreWarnings() directly
  * Restore error level to previous value
  */
 function wfRestoreWarnings() {
-       wfSuppressWarnings( true );
+       MediaWiki\suppressWarnings( true );
 }
 
 # Autodetect, convert and provide timestamps of various types
@@ -2536,9 +2515,9 @@ function wfMkdirParents( $dir, $mode = null, $caller = null ) {
        }
 
        // Turn off the normal warning, we're doing our own below
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        $ok = mkdir( $dir, $mode, true ); // PHP5 <3
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
 
        if ( !$ok ) {
                //directory may have been created on another request since we last checked
@@ -3033,9 +3012,9 @@ function wfMerge( $old, $mine, $yours, &$result ) {
 
        # This check may also protect against code injection in
        # case of broken installations.
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        $haveDiff3 = $wgDiff3 && file_exists( $wgDiff3 );
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
 
        if ( !$haveDiff3 ) {
                wfDebug( "diff3 not found\n" );
@@ -3112,9 +3091,9 @@ function wfDiff( $before, $after, $params = '-u' ) {
        }
 
        global $wgDiff;
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        $haveDiff = $wgDiff && file_exists( $wgDiff );
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
 
        # This check may also protect against code injection in
        # case of broken installations.
@@ -3491,9 +3470,9 @@ function wfSetupSession( $sessionId = false ) {
        } else {
                wfFixSessionID();
        }
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        session_start();
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
 }
 
 /**
@@ -3846,15 +3825,15 @@ function wfMemoryLimit() {
                $conflimit = wfShorthandToInteger( $wgMemoryLimit );
                if ( $conflimit == -1 ) {
                        wfDebug( "Removing PHP's memory limit\n" );
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        ini_set( 'memory_limit', $conflimit );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        return $conflimit;
                } elseif ( $conflimit > $memlimit ) {
                        wfDebug( "Raising PHP's memory limit to $conflimit bytes\n" );
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        ini_set( 'memory_limit', $conflimit );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        return $conflimit;
                }
        }
@@ -3999,9 +3978,9 @@ function wfUnpack( $format, $data, $length = false ) {
                }
        }
 
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        $result = unpack( $format, $data );
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
 
        if ( $result === false ) {
                // If it cannot extract the packed data.
index 69f1120..494cbfa 100644 (file)
@@ -522,9 +522,9 @@ class DiffHistoryBlob implements HistoryBlob {
        function diff( $t1, $t2 ) {
                # Need to do a null concatenation with warnings off, due to bugs in the current version of xdiff
                # "String is not zero-terminated"
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $diff = xdiff_string_rabdiff( $t1, $t2 ) . '';
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                return $diff;
        }
 
@@ -535,9 +535,9 @@ class DiffHistoryBlob implements HistoryBlob {
         */
        function patch( $base, $diff ) {
                if ( function_exists( 'xdiff_string_bpatch' ) ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $text = xdiff_string_bpatch( $base, $diff ) . '';
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        return $text;
                }
 
index 8e05f59..825cd06 100644 (file)
@@ -792,14 +792,14 @@ class CurlHttpRequest extends MWHttpRequest {
                }
 
                if ( $this->followRedirects && $this->canFollowRedirects() ) {
-                       wfSuppressWarnings();
+                       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" );
                                // Continue the processing. If it were in curl_setopt_array,
                                // processing would have halted on its entry
                        }
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
 
                if ( $this->profiler ) {
@@ -938,9 +938,9 @@ class PhpHttpRequest extends MWHttpRequest {
                }
                do {
                        $reqCount++;
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $fh = fopen( $url, "r", false, $context );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        if ( !$fh ) {
                                break;
index ee57a9e..214bc4e 100644 (file)
@@ -1857,9 +1857,9 @@ class ImportStreamSource implements ImportSource {
         * @return Status
         */
        static function newFromFile( $filename ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $file = fopen( $filename, 'rt' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$file ) {
                        return Status::newFatal( "importcantopen" );
                }
index df0870b..7a0d7b7 100644 (file)
@@ -715,7 +715,7 @@ class MediaWiki {
 
                $errno = $errstr = null;
                $info = wfParseUrl( $this->config->get( 'Server' ) );
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $sock = fsockopen(
                        $info['host'],
                        isset( $info['port'] ) ? $info['port'] : 80,
@@ -725,7 +725,7 @@ class MediaWiki {
                        // is a problem elsewhere.
                        0.1
                );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$sock ) {
                        $runJobsLogger->error( "Failed to start cron API (socket error $errno): $errstr" );
                        // Fall back to running the job here while the user waits
index ebe98a3..0d907b7 100644 (file)
@@ -624,9 +624,9 @@ class MimeMagic {
         */
        private function doGuessMimeType( $file, $ext ) { // TODO: remove $ext param
                // Read a chunk of the file
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $f = fopen( $file, 'rb' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$f ) {
                        return 'unknown/unknown';
@@ -780,9 +780,9 @@ class MimeMagic {
                        return $this->detectZipType( $head, $tail, $ext );
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $gis = getimagesize( $file );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $gis && isset( $gis['mime'] ) ) {
                        $mime = $gis['mime'];
index a8fc01d..fd55379 100644 (file)
@@ -809,9 +809,9 @@ class OutputPage extends ContextSource {
                # this breaks strtotime().
                $clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
 
-               wfSuppressWarnings(); // E_STRICT system time bitching
+               MediaWiki\suppressWarnings(); // E_STRICT system time bitching
                $clientHeaderTime = strtotime( $clientHeader );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$clientHeaderTime ) {
                        wfDebug( __METHOD__
                                . ": unable to parse the client's If-Modified-Since header: $clientHeader\n" );
index 8256db9..677d5a4 100644 (file)
@@ -488,9 +488,9 @@ class Sanitizer {
                                                $badtag = true;
                                        } elseif ( $slash ) {
                                                # Closing a tag... is it the one we just opened?
-                                               wfSuppressWarnings();
+                                               MediaWiki\suppressWarnings();
                                                $ot = array_pop( $tagstack );
-                                               wfRestoreWarnings();
+                                               MediaWiki\restoreWarnings();
 
                                                if ( $ot != $t ) {
                                                        if ( isset( $htmlsingleallowed[$ot] ) ) {
@@ -498,32 +498,32 @@ class Sanitizer {
                                                                # and see if we find a match below them
                                                                $optstack = array();
                                                                array_push( $optstack, $ot );
-                                                               wfSuppressWarnings();
+                                                               MediaWiki\suppressWarnings();
                                                                $ot = array_pop( $tagstack );
-                                                               wfRestoreWarnings();
+                                                               MediaWiki\restoreWarnings();
                                                                while ( $ot != $t && isset( $htmlsingleallowed[$ot] ) ) {
                                                                        array_push( $optstack, $ot );
-                                                                       wfSuppressWarnings();
+                                                                       MediaWiki\suppressWarnings();
                                                                        $ot = array_pop( $tagstack );
-                                                                       wfRestoreWarnings();
+                                                                       MediaWiki\restoreWarnings();
                                                                }
                                                                if ( $t != $ot ) {
                                                                        # No match. Push the optional elements back again
                                                                        $badtag = true;
-                                                                       wfSuppressWarnings();
+                                                                       MediaWiki\suppressWarnings();
                                                                        $ot = array_pop( $optstack );
-                                                                       wfRestoreWarnings();
+                                                                       MediaWiki\restoreWarnings();
                                                                        while ( $ot ) {
                                                                                array_push( $tagstack, $ot );
-                                                                               wfSuppressWarnings();
+                                                                               MediaWiki\suppressWarnings();
                                                                                $ot = array_pop( $optstack );
-                                                                               wfRestoreWarnings();
+                                                                               MediaWiki\restoreWarnings();
                                                                        }
                                                                }
                                                        } else {
-                                                               wfSuppressWarnings();
+                                                               MediaWiki\suppressWarnings();
                                                                array_push( $tagstack, $ot );
-                                                               wfRestoreWarnings();
+                                                               MediaWiki\restoreWarnings();
 
                                                                # <li> can be nested in <ul> or <ol>, skip those cases:
                                                                if ( !isset( $htmllist[$ot] ) || !isset( $listtags[$t] ) ) {
index 3fec2ff..70c935d 100644 (file)
@@ -434,9 +434,9 @@ if ( !$wgHtml5Version && $wgAllowRdfaAttributes ) {
 $wgFileExtensions = array_values( array_diff ( $wgFileExtensions, $wgFileBlacklist ) );
 
 if ( $wgInvalidateCacheOnLocalSettingsChange ) {
-       // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged - No GlobalFunction here yet.
-       $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
-       // @codingStandardsIgnoreEnd
+       MediaWiki\suppressWarnings();
+       $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( "$IP/LocalSettings.php" ) ) );
+       MediaWiki\restoreWarnings();
 }
 
 if ( $wgNewUserLog ) {
@@ -565,9 +565,9 @@ wfMemoryLimit();
  * explicitly set. Inspired by phpMyAdmin's treatment of the problem.
  */
 if ( is_null( $wgLocaltimezone ) ) {
-       wfSuppressWarnings();
+       MediaWiki\suppressWarnings();
        $wgLocaltimezone = date_default_timezone_get();
-       wfRestoreWarnings();
+       MediaWiki\restoreWarnings();
 }
 
 date_default_timezone_set( $wgLocaltimezone );
index 824dd06..ca8f11a 100644 (file)
@@ -95,9 +95,9 @@ class SquidPurgeClient {
                }
                $this->socket = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
                socket_set_nonblock( $this->socket );
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $ok = socket_connect( $this->socket, $ip, $this->port );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$ok ) {
                        $error = socket_last_error( $this->socket );
                        if ( $error !== self::EINPROGRESS ) {
@@ -153,12 +153,12 @@ class SquidPurgeClient {
                        } elseif ( IP::isIPv6( $this->host ) ) {
                                throw new MWException( '$wgSquidServers does not support IPv6' );
                        } else {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $this->ip = gethostbyname( $this->host );
                                if ( $this->ip === $this->host ) {
                                        $this->ip = false;
                                }
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                        }
                }
                return $this->ip;
@@ -178,11 +178,11 @@ class SquidPurgeClient {
         */
        public function close() {
                if ( $this->socket ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        socket_set_block( $this->socket );
                        socket_shutdown( $this->socket );
                        socket_close( $this->socket );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
                $this->socket = null;
                $this->readBuffer = '';
@@ -252,9 +252,9 @@ class SquidPurgeClient {
                        $buf = substr( $this->writeBuffer, 0, self::BUFFER_SIZE );
                        $flags = 0;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $bytesSent = socket_send( $socket, $buf, strlen( $buf ), $flags );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $bytesSent === false ) {
                        $error = socket_last_error( $socket );
@@ -278,9 +278,9 @@ class SquidPurgeClient {
                }
 
                $buf = '';
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $bytesRead = socket_recv( $socket, $buf, self::BUFFER_SIZE, 0 );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $bytesRead === false ) {
                        $error = socket_last_error( $socket );
                        if ( $error != self::EAGAIN && $error != self::EINTR ) {
@@ -442,9 +442,9 @@ class SquidPurgeClientPool {
                        }
                        $exceptSockets = null;
                        $timeout = min( $startTime + $this->timeout - microtime( true ), 1 );
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $numReady = socket_select( $readSockets, $writeSockets, $exceptSockets, $timeout );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $numReady === false ) {
                                wfDebugLog( 'squid', __METHOD__ . ': Error in stream_select: ' .
                                        socket_strerror( socket_last_error() ) . "\n" );
index a7522ea..bac4db6 100644 (file)
@@ -44,9 +44,9 @@ class StreamFile {
                        throw new MWException( __FUNCTION__ . " given storage path '$fname'." );
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $stat = stat( $fname );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                $res = self::prepareForStream( $fname, $stat, $headers, $sendErrors );
                if ( $res == self::NOT_MODIFIED ) {
index a5fd9d8..6bdcc87 100644 (file)
@@ -104,9 +104,9 @@ class WebRequest {
                        if ( !preg_match( '!^https?://!', $url ) ) {
                                $url = 'http://unused' . $url;
                        }
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $a = parse_url( $url );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $a ) {
                                $path = isset( $a['path'] ) ? $a['path'] : '';
 
index 02846dc..bcd3c32 100644 (file)
@@ -523,9 +523,9 @@ class ApiQueryImageInfo extends ApiQueryBase {
                }
 
                if ( $meta ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $metadata = unserialize( $file->getMetadata() );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $metadata && $version !== 'latest' ) {
                                $metadata = $file->convertMetadataVersion( $metadata, $version );
                        }
index 517f379..2abcabd 100644 (file)
@@ -181,11 +181,11 @@ class FileDependency extends CacheDependency {
 
        function loadDependencyValues() {
                if ( is_null( $this->timestamp ) ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        # Dependency on a non-existent file stores "false"
                        # This is a valid concept!
                        $this->timestamp = filemtime( $this->filename );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
        }
 
@@ -193,9 +193,9 @@ class FileDependency extends CacheDependency {
         * @return bool
         */
        function isExpired() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $lastmod = filemtime( $this->filename );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $lastmod === false ) {
                        if ( $this->timestamp === false ) {
                                # Still nonexistent
index 4bf3611..5632596 100644 (file)
@@ -185,9 +185,9 @@ abstract class FileCacheBase {
         * @return void
         */
        public function clearCache() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                unlink( $this->cachePath() );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                $this->mCached = false;
        }
 
index febde7a..5b802aa 100644 (file)
@@ -509,15 +509,15 @@ class LocalisationCache {
         */
        protected function readPHPFile( $_fileName, $_fileType ) {
                // Disable APC caching
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $_apcEnabled = ini_set( 'apc.cache_by_default', '0' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                include $_fileName;
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                ini_set( 'apc.cache_by_default', $_apcEnabled );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $_fileType == 'core' || $_fileType == 'extension' ) {
                        $data = compact( self::$allKeys );
index 99b969f..90fa065 100644 (file)
@@ -167,9 +167,9 @@ class MessageCache {
                $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code";
 
                # Check file existence
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $file = fopen( $filename, 'r' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$file ) {
                        return false; // No cache file
                }
@@ -204,9 +204,9 @@ class MessageCache {
                $filename = "$wgCacheDirectory/messages-" . wfWikiID() . "-$code";
                wfMkdirParents( $wgCacheDirectory, null, __METHOD__ ); // might fail
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $file = fopen( $filename, 'w' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$file ) {
                        wfDebug( "Unable to open local cache file for writing\n" );
@@ -216,9 +216,9 @@ class MessageCache {
 
                fwrite( $file, $hash . $serialized );
                fclose( $file );
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                chmod( $filename, 0666 );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
        }
 
        /**
index 691f9b2..77bf5df 100644 (file)
@@ -859,9 +859,9 @@ class RecentChange {
        public function parseParams() {
                $rcParams = $this->getAttribute( 'rc_params' );
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $unserializedParams = unserialize( $rcParams );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return $unserializedParams;
        }
index a188e48..b25bf14 100644 (file)
@@ -1132,7 +1132,7 @@ abstract class ContentHandler {
                        $handlers = Hooks::getHandlers( $event );
                        $handlerInfo = array();
 
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
 
                        foreach ( $handlers as $handler ) {
                                if ( is_array( $handler ) ) {
@@ -1155,7 +1155,7 @@ abstract class ContentHandler {
                                $handlerInfo[] = $info;
                        }
 
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " .
                                implode( ', ', $handlerInfo ), 2 );
index 97073dd..e15c248 100644 (file)
@@ -4025,9 +4025,9 @@ abstract class DatabaseBase implements IDatabase {
        public function sourceFile(
                $filename, $lineCallback = false, $resultCallback = false, $fname = false, $inputCallback = false
        ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $fp = fopen( $filename, 'r' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( false === $fp ) {
                        throw new MWException( "Could not open \"{$filename}\".\n" );
index 2b8f395..b5b6825 100644 (file)
@@ -119,9 +119,9 @@ class DatabaseMssql extends DatabaseBase {
                        $connectionInfo['PWD'] = $password;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $this->mConn = sqlsrv_connect( $server, $connectionInfo );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $this->mConn === false ) {
                        throw new DBConnectionError( $this, $this->lastError() );
index 561c811..a189648 100644 (file)
@@ -104,9 +104,9 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                }
 
                if ( $dbName != '' ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $success = $this->selectDB( $dbName );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( !$success ) {
                                wfLogDBError(
                                        "Error selecting database {db_name} on server {db_server}",
@@ -203,9 +203,9 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $ok = $this->mysqlFreeResult( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$ok ) {
                        throw new DBUnexpectedError( $this, "Unable to free MySQL result" );
                }
@@ -228,9 +228,9 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $row = $this->mysqlFetchObject( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                $errno = $this->lastErrno();
                // Unfortunately, mysql_fetch_object does not reset the last errno.
@@ -264,9 +264,9 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $row = $this->mysqlFetchArray( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                $errno = $this->lastErrno();
                // Unfortunately, mysql_fetch_array does not reset the last errno.
@@ -300,9 +300,9 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $n = $this->mysqlNumRows( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                // Unfortunately, mysql_num_rows does not reset the last errno.
                // We are not checking for any errors here, since
@@ -413,12 +413,12 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
        function lastError() {
                if ( $this->mConn ) {
                        # Even if it's non-zero, it can still be invalid
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $error = $this->mysqlError( $this->mConn );
                        if ( !$error ) {
                                $error = $this->mysqlError();
                        }
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                } else {
                        $error = $this->mysqlError();
                }
index 9b00fbd..081174a 100644 (file)
@@ -220,9 +220,9 @@ class DatabaseOracle extends DatabaseBase {
 
        function __destruct() {
                if ( $this->mOpened ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $this->close();
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
        }
 
@@ -306,7 +306,7 @@ class DatabaseOracle extends DatabaseBase {
 
                $session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : OCI_DEFAULT;
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                if ( $this->mFlags & DBO_PERSISTENT ) {
                        $this->mConn = oci_pconnect(
                                $this->mUser,
@@ -332,7 +332,7 @@ class DatabaseOracle extends DatabaseBase {
                                $session_mode
                        );
                }
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $this->mUser != $this->mDBname ) {
                        //change current schema in session
@@ -393,7 +393,7 @@ class DatabaseOracle extends DatabaseBase {
                        $explain_count
                );
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
 
                if ( ( $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql ) ) === false ) {
                        $e = oci_error( $this->mConn );
@@ -411,7 +411,7 @@ class DatabaseOracle extends DatabaseBase {
                        }
                }
 
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $explain_count > 0 ) {
                        return $this->doQuery( 'SELECT id, cardinality "ROWS" FROM plan_table ' .
@@ -687,7 +687,7 @@ class DatabaseOracle extends DatabaseBase {
                        }
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
 
                if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
                        $e = oci_error( $stmt );
@@ -702,7 +702,7 @@ class DatabaseOracle extends DatabaseBase {
                        $this->mAffectedRows = oci_num_rows( $stmt );
                }
 
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( isset( $lob ) ) {
                        foreach ( $lob as $lob_v ) {
@@ -1250,9 +1250,9 @@ class DatabaseOracle extends DatabaseBase {
                }
                $sql = 'ALTER SESSION SET CURRENT_SCHEMA=' . strtoupper( $db );
                $stmt = oci_parse( $this->mConn, $sql );
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $success = oci_execute( $stmt );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$success ) {
                        $e = oci_error( $stmt );
                        if ( $e['code'] != '1435' ) {
@@ -1491,7 +1491,7 @@ class DatabaseOracle extends DatabaseBase {
                        }
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
 
                if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
                        $e = oci_error( $stmt );
@@ -1506,7 +1506,7 @@ class DatabaseOracle extends DatabaseBase {
                        $this->mAffectedRows = oci_num_rows( $stmt );
                }
 
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( isset( $lob ) ) {
                        foreach ( $lob as $lob_v ) {
index 9287f7a..60999e5 100644 (file)
@@ -551,9 +551,9 @@ class DatabasePostgres extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $ok = pg_free_result( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$ok ) {
                        throw new DBUnexpectedError( $this, "Unable to free Postgres result\n" );
                }
@@ -568,9 +568,9 @@ class DatabasePostgres extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $row = pg_fetch_object( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                # @todo FIXME: HACK HACK HACK HACK debug
 
                # @todo hashar: not sure if the following test really trigger if the object
@@ -589,9 +589,9 @@ class DatabasePostgres extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $row = pg_fetch_array( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( pg_last_error( $this->mConn ) ) {
                        throw new DBUnexpectedError(
                                $this,
@@ -606,9 +606,9 @@ class DatabasePostgres extends DatabaseBase {
                if ( $res instanceof ResultWrapper ) {
                        $res = $res->result;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $n = pg_num_rows( $res );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( pg_last_error( $this->mConn ) ) {
                        throw new DBUnexpectedError(
                                $this,
index 6027375..71fc328 100644 (file)
@@ -365,7 +365,7 @@ class LegacyLogger extends AbstractLogger {
                        $transport = UDPTransport::newFromString( $file );
                        $transport->emit( $text );
                } else {
-                       wfSuppressWarnings();
+                       \MediaWiki\suppressWarnings();
                        $exists = file_exists( $file );
                        $size = $exists ? filesize( $file ) : false;
                        if ( !$exists ||
@@ -373,7 +373,7 @@ class LegacyLogger extends AbstractLogger {
                        ) {
                                file_put_contents( $file, $text, FILE_APPEND );
                        }
-                       wfRestoreWarnings();
+                       \MediaWiki\restoreWarnings();
                }
        }
 
index a58705f..1681dc0 100644 (file)
@@ -502,7 +502,7 @@ TXT;
                global $wgLogExceptionBacktrace;
 
                // The set_error_handler callback is independent from error_reporting.
-               // Filter out unwanted errors manually (e.g. when wfSuppressWarnings is active).
+               // Filter out unwanted errors manually (e.g. when MediaWiki\suppressWarnings is active).
                $suppressed = ( error_reporting() & $e->getSeverity() ) === 0;
                if ( !$suppressed ) {
                        $log = self::getLogMessage( $e );
index 6ee9b2e..a75f328 100644 (file)
@@ -75,9 +75,9 @@ class FSFile {
         * @return string|bool TS_MW timestamp or false on failure
         */
        public function getTimestamp() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $timestamp = filemtime( $this->path );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $timestamp !== false ) {
                        $timestamp = wfTimestamp( TS_MW, $timestamp );
                }
@@ -204,9 +204,9 @@ class FSFile {
                        return $this->sha1Base36;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $this->sha1Base36 = sha1_file( $this->path );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $this->sha1Base36 !== false ) {
                        $this->sha1Base36 = wfBaseConvert( $this->sha1Base36, 16, 36, 31 );
index 9f147f0..7d2d831 100644 (file)
@@ -377,9 +377,9 @@ abstract class FileBackendStore extends FileBackend {
                unset( $params['latest'] ); // sanity
 
                // Check that the specified temp file is valid...
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $ok = ( is_file( $tmpPath ) && filesize( $tmpPath ) == 0 );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$ok ) { // not present or not empty
                        $status->fatal( 'backend-fail-opentemp', $tmpPath );
 
@@ -694,9 +694,9 @@ abstract class FileBackendStore extends FileBackend {
        protected function doGetFileContentsMulti( array $params ) {
                $contents = array();
                foreach ( $this->doGetLocalReferenceMulti( $params ) as $path => $fsFile ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $contents[$path] = $fsFile ? file_get_contents( $fsFile->getPath() ) : false;
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
 
                return $contents;
index 66d8794..5d4e8e1 100644 (file)
@@ -577,9 +577,9 @@ class StoreFileOp extends FileOp {
        }
 
        protected function getSourceSha1Base36() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $hash = sha1_file( $this->params['src'] );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $hash !== false ) {
                        $hash = wfBaseConvert( $hash, 16, 36, 31 );
                }
index 7c2f825..ba2cf23 100644 (file)
@@ -67,9 +67,9 @@ class MemoryFileBackend extends FileBackendStore {
                        return $status;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $data = file_get_contents( $params['src'] );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $data === false ) { // source doesn't exist?
                        $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
 
index 0dcaf2a..9bae2ae 100644 (file)
@@ -270,9 +270,9 @@ class SwiftFileBackend extends FileBackendStore {
                        return $status;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $sha1Hash = sha1_file( $params['src'] );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $sha1Hash === false ) { // source doesn't exist?
                        $status->fatal( 'backend-fail-store', $params['src'], $params['dst'] );
 
index fa4eb5f..312b65c 100644 (file)
@@ -59,9 +59,9 @@ class TempFSFile extends FSFile {
                $ext = ( $extension != '' ) ? ".{$extension}" : "";
                for ( $attempt = 1; true; $attempt++ ) {
                        $path = "{$base}-{$attempt}{$ext}";
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $newFileHandle = fopen( $path, 'x' );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $newFileHandle ) {
                                fclose( $newFileHandle );
                                break; // got it
@@ -84,9 +84,9 @@ class TempFSFile extends FSFile {
         */
        public function purge() {
                $this->canDelete = false; // done
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $ok = unlink( $this->path );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                unset( self::$pathsCollect[$this->path] );
 
@@ -144,9 +144,9 @@ class TempFSFile extends FSFile {
         */
        public static function purgeAllOnShutdown() {
                foreach ( self::$pathsCollect as $path ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        unlink( $path );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
        }
 
index bce6b34..6f46f0e 100644 (file)
@@ -117,9 +117,9 @@ class FSLockManager extends LockManager {
                        if ( isset( $this->handles[$path] ) ) {
                                $handle = $this->handles[$path];
                        } else {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $handle = fopen( $this->getLockPath( $path ), 'a+' );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                                if ( !$handle ) { // lock dir missing?
                                        wfMkdirParents( $this->lockDir );
                                        $handle = fopen( $this->getLockPath( $path ), 'a+' ); // try again
index 5b42c2c..c0c6d9d 100644 (file)
@@ -907,9 +907,9 @@ class FileRepo {
                $status->merge( $backend->doOperations( $operations, $opts ) );
                // Cleanup for disk source files...
                foreach ( $sourceFSFilesToDelete as $file ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        unlink( $file ); // FS cleanup
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
 
                return $status;
@@ -1295,9 +1295,9 @@ class FileRepo {
                }
                // Cleanup for disk source files...
                foreach ( $sourceFSFilesToDelete as $file ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        unlink( $file ); // FS cleanup
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
 
                return $status;
index 6ccf2d5..752450f 100644 (file)
@@ -649,10 +649,10 @@ abstract class DatabaseInstaller {
                        return $status;
                }
                global $IP;
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $rows = file( "$IP/maintenance/interwiki.list",
                        FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                $interwikis = array();
                if ( !$rows ) {
                        return Status::newFatal( 'config-install-interwiki-list' );
index 5ae499d..955f24d 100644 (file)
@@ -540,9 +540,9 @@ abstract class Installer {
                global $wgAutoloadClasses;
                $wgAutoloadClasses = array();
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $_lsExists = file_exists( "$IP/LocalSettings.php" );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$_lsExists ) {
                        return false;
@@ -830,14 +830,14 @@ abstract class Installer {
         * @return bool
         */
        protected function envCheckPCRE() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
                // Need to check for \p support too, as PCRE can be compiled
                // with utf8 support, but not unicode property support.
                // check that \p{Zs} (space separators) matches
                // U+3000 (Ideographic space)
                $regexprop = preg_replace( '/\p{Zs}/u', '', "-\xE3\x80\x80-" );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $regexd != '--' || $regexprop != '--' ) {
                        $this->showError( 'config-pcre-no-utf8' );
 
@@ -1289,9 +1289,9 @@ abstract class Installer {
                foreach ( $names as $name ) {
                        $command = $path . DIRECTORY_SEPARATOR . $name;
 
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $file_exists = file_exists( $command );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        if ( $file_exists ) {
                                if ( !$versionInfo ) {
@@ -1349,7 +1349,7 @@ abstract class Installer {
 
                // it would be good to check other popular languages here, but it'll be slow.
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
 
                foreach ( $scriptTypes as $ext => $contents ) {
                        foreach ( $contents as $source ) {
@@ -1368,14 +1368,14 @@ abstract class Installer {
                                unlink( $dir . $file );
 
                                if ( $text == 'exec' ) {
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
 
                                        return $ext;
                                }
                        }
                }
 
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return false;
        }
@@ -1809,8 +1809,8 @@ abstract class Installer {
         * Some long-running pages (Install, Upgrade) will want to do this
         */
        protected function disableTimeLimit() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                set_time_limit( 0 );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
        }
 }
index f990ddf..43b809c 100644 (file)
@@ -157,9 +157,9 @@ class SqliteInstaller extends DatabaseInstaller {
                        # Called early on in the installer, later we just want to sanity check
                        # if it's still writable
                        if ( $create ) {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $ok = wfMkdirParents( $dir, 0700, __METHOD__ );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                                if ( !$ok ) {
                                        return Status::newFatal( 'config-sqlite-mkdir-error', $dir );
                                }
index b391be3..8427adb 100644 (file)
@@ -246,9 +246,9 @@ class DatabaseLogEntry extends LogEntryBase {
        public function getParameters() {
                if ( !isset( $this->params ) ) {
                        $blob = $this->getRawParameters();
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $params = LogEntryBase::extractParams( $blob );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $params !== false ) {
                                $this->params = $params;
                                $this->legacy = false;
index 8264673..546cc8c 100644 (file)
@@ -271,13 +271,13 @@ class UserMailer {
                        }
                        require_once 'Mail.php';
 
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
 
                        // Create the mail object using the Mail::factory method
                        $mail_object =& Mail::factory( 'smtp', $wgSMTP );
                        if ( PEAR::isError( $mail_object ) ) {
                                wfDebug( "PEAR::Mail factory failed: " . $mail_object->getMessage() . "\n" );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                                return Status::newFatal( 'pear-mail-error', $mail_object->getMessage() );
                        }
 
@@ -297,11 +297,11 @@ class UserMailer {
                                $status = self::sendWithPear( $mail_object, $chunk, $headers, $body );
                                # FIXME : some chunks might be sent while others are not!
                                if ( !$status->isOK() ) {
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
                                        return $status;
                                }
                        }
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        return Status::newGood();
                } else {
                        #
index eadcf94..09d3807 100644 (file)
@@ -121,9 +121,9 @@ class BitmapHandler extends TransformationalImageHandler {
                                '-layers', 'merge',
                                '-background', 'white',
                        );
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $xcfMeta = unserialize( $image->getMetadata() );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $xcfMeta
                                && isset( $xcfMeta['colorType'] )
                                && $xcfMeta['colorType'] === 'greyscale-alpha'
index 749ef23..b422bfa 100644 (file)
@@ -265,9 +265,9 @@ class DjVuHandler extends ImageHandler {
                        return $metadata;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $unser = unserialize( $metadata );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( is_array( $unser ) ) {
                        if ( isset( $unser['error'] ) ) {
                                return false;
@@ -304,7 +304,7 @@ class DjVuHandler extends ImageHandler {
                        return false;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                try {
                        // Set to false rather than null to avoid further attempts
                        $image->dejaMetaTree = false;
@@ -327,7 +327,7 @@ class DjVuHandler extends ImageHandler {
                } catch ( Exception $e ) {
                        wfDebug( "Bogus multipage XML metadata on '{$image->getName()}'\n" );
                }
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $gettext ) {
                        return $image->djvuTextTree;
                } else {
index e8faa70..dbbe991 100644 (file)
@@ -123,9 +123,9 @@ class DjVuImage {
        }
 
        function getInfo() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $file = fopen( $this->mFilename, 'rb' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( $file === false ) {
                        wfDebug( __METHOD__ . ": missing or failed file read\n" );
 
index 3386868..b4cc43e 100644 (file)
@@ -294,9 +294,9 @@ class Exif {
 
                $this->debugFile( $this->basename, __FUNCTION__, true );
                if ( function_exists( 'exif_read_data' ) ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $data = exif_read_data( $this->file, 0, true );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                } else {
                        throw new MWException( "Internal error: exif_read_data not present. " .
                                "\$wgShowEXIF may be incorrectly set or not checked by an extension." );
@@ -471,17 +471,17 @@ class Exif {
                                        break;
                        }
                        if ( $charset ) {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $val = iconv( $charset, 'UTF-8//IGNORE', $val );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                        } else {
                                // if valid utf-8, assume that, otherwise assume windows-1252
                                $valCopy = $val;
                                UtfNormal\Validator::quickIsNFCVerify( $valCopy ); //validates $valCopy.
                                if ( $valCopy !== $val ) {
-                                       wfSuppressWarnings();
+                                       MediaWiki\suppressWarnings();
                                        $val = iconv( 'Windows-1252', 'UTF-8//IGNORE', $val );
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
                                }
                        }
 
index f56a947..bf6f7fc 100644 (file)
@@ -100,9 +100,9 @@ class ExifBitmapHandler extends BitmapHandler {
                if ( $metadata === self::BROKEN_FILE ) {
                        return self::METADATA_GOOD;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $exif = unserialize( $metadata );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !isset( $exif['MEDIAWIKI_EXIF_VERSION'] )
                        || $exif['MEDIAWIKI_EXIF_VERSION'] != Exif::version()
                ) {
@@ -224,9 +224,9 @@ class ExifBitmapHandler extends BitmapHandler {
                if ( !$data ) {
                        return 0;
                }
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $data = unserialize( $data );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( isset( $data['Orientation'] ) ) {
                        # See http://sylvana.net/jpegcrop/exif_orientation.html
                        switch ( $data['Orientation'] ) {
index e3621fb..94aca61 100644 (file)
@@ -131,9 +131,9 @@ class GIFHandler extends BitmapHandler {
                        return self::METADATA_GOOD;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $data = unserialize( $metadata );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$data || !is_array( $data ) ) {
                        wfDebug( __METHOD__ . " invalid GIF metadata\n" );
@@ -161,9 +161,9 @@ class GIFHandler extends BitmapHandler {
 
                $original = parent::getLongDesc( $image );
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $metadata = unserialize( $image->getMetadata() );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$metadata || $metadata['frameCount'] <= 1 ) {
                        return $original;
index 5c37046..6ee23cd 100644 (file)
@@ -161,9 +161,9 @@ class GIFMetadataExtractor {
                                        UtfNormal\Validator::quickIsNFCVerify( $dataCopy );
 
                                        if ( $dataCopy !== $data ) {
-                                               wfSuppressWarnings();
+                                               MediaWiki\suppressWarnings();
                                                $data = iconv( 'windows-1252', 'UTF-8', $data );
-                                               wfRestoreWarnings();
+                                               MediaWiki\restoreWarnings();
                                        }
 
                                        $commentCount = count( $comment );
index 0eb27cc..c3d58b8 100644 (file)
@@ -445,9 +445,9 @@ class IPTC {
         */
        private static function convIPTCHelper( $data, $charset ) {
                if ( $charset ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $data = iconv( $charset, "UTF-8//IGNORE", $data );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $data === false ) {
                                $data = "";
                                wfDebugLog( 'iptc', __METHOD__ . " Error converting iptc data charset $charset to utf-8" );
index 968e424..db74bb3 100644 (file)
@@ -201,9 +201,9 @@ abstract class ImageHandler extends MediaHandler {
        }
 
        function getImageSize( $image, $path ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $gis = getimagesize( $path );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return $gis;
        }
index ae4af8d..5069f18 100644 (file)
@@ -102,9 +102,9 @@ class JpegMetadataExtractor {
                                // turns $com to valid utf-8.
                                // thus if no change, its utf-8, otherwise its something else.
                                if ( $com !== $oldCom ) {
-                                       wfSuppressWarnings();
+                                       MediaWiki\suppressWarnings();
                                        $com = $oldCom = iconv( 'windows-1252', 'UTF-8//IGNORE', $oldCom );
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
                                }
                                // Try it again, if its still not a valid string, then probably
                                // binary junk or some really weird encoding, so don't extract.
index 33aed34..3a59996 100644 (file)
@@ -181,9 +181,9 @@ abstract class MediaHandler {
                if ( !is_array( $metadata ) ) {
 
                        //unserialize to keep return parameter consistent.
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $ret = unserialize( $metadata );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        return $ret;
                }
index 5f1aca5..c3f0832 100644 (file)
@@ -118,9 +118,9 @@ class PNGHandler extends BitmapHandler {
                        return self::METADATA_GOOD;
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $data = unserialize( $metadata );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$data || !is_array( $data ) ) {
                        wfDebug( __METHOD__ . " invalid png metadata\n" );
@@ -147,9 +147,9 @@ class PNGHandler extends BitmapHandler {
                global $wgLang;
                $original = parent::getLongDesc( $image );
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $metadata = unserialize( $image->getMetadata() );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$metadata || $metadata['frameCount'] <= 0 ) {
                        return $original;
index bccd36c..ac92460 100644 (file)
@@ -201,9 +201,9 @@ class PNGMetadataExtractor {
                                        // if compressed
                                        if ( $items[2] == "\x01" ) {
                                                if ( function_exists( 'gzuncompress' ) && $items[4] === "\x00" ) {
-                                                       wfSuppressWarnings();
+                                                       MediaWiki\suppressWarnings();
                                                        $items[5] = gzuncompress( $items[5] );
-                                                       wfRestoreWarnings();
+                                                       MediaWiki\restoreWarnings();
 
                                                        if ( $items[5] === false ) {
                                                                // decompression failed
@@ -245,9 +245,9 @@ class PNGMetadataExtractor {
                                        fseek( $fh, self::$crcSize, SEEK_CUR );
                                        continue;
                                }
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $content = iconv( 'ISO-8859-1', 'UTF-8', $content );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
 
                                if ( $content === false ) {
                                        throw new Exception( __METHOD__ . ": Read error (error with iconv)" );
@@ -285,9 +285,9 @@ class PNGMetadataExtractor {
                                                continue;
                                        }
 
-                                       wfSuppressWarnings();
+                                       MediaWiki\suppressWarnings();
                                        $content = gzuncompress( $content );
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
 
                                        if ( $content === false ) {
                                                // decompression failed
@@ -296,9 +296,9 @@ class PNGMetadataExtractor {
                                                continue;
                                        }
 
-                                       wfSuppressWarnings();
+                                       MediaWiki\suppressWarnings();
                                        $content = iconv( 'ISO-8859-1', 'UTF-8', $content );
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
 
                                        if ( $content === false ) {
                                                throw new Exception( __METHOD__ . ": Read error (error with iconv)" );
index c2f85e8..4377f75 100644 (file)
@@ -206,10 +206,10 @@ class SvgHandler extends ImageHandler {
                $lnPath = "$tmpDir/" . basename( $srcPath );
                $ok = mkdir( $tmpDir, 0771 ) && symlink( $srcPath, $lnPath );
                $cleaner = new ScopedCallback( function () use ( $tmpDir, $lnPath ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        unlink( $lnPath );
                        rmdir( $tmpDir );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                } );
                if ( !$ok ) {
                        wfDebugLog( 'thumbnail',
@@ -375,9 +375,9 @@ class SvgHandler extends ImageHandler {
        }
 
        function unpackMetadata( $metadata ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $unser = unserialize( $metadata );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( isset( $unser['version'] ) && $unser['version'] == self::SVG_METADATA_VERSION ) {
                        return $unser;
                } else {
index 2037c33..6c53bc5 100644 (file)
@@ -108,17 +108,17 @@ class SVGReader {
                // Because we cut off the end of the svg making an invalid one. Complicated
                // try catch thing to make sure warnings get restored. Seems like there should
                // be a better way.
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                try {
                        $this->read();
                } catch ( Exception $e ) {
                        // Note, if this happens, the width/height will be taken to be 0x0.
                        // Should we consider it the default 512x512 instead?
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        libxml_disable_entity_loader( $oldDisable );
                        throw $e;
                }
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                libxml_disable_entity_loader( $oldDisable );
        }
 
index 6544d5c..e957cb2 100644 (file)
@@ -222,9 +222,9 @@ class XCFHandler extends BitmapHandler {
         * @return bool
         */
        public function canRender( $file ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $xcfMeta = unserialize( $file->getMetadata() );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( isset( $xcfMeta['colorType'] ) && $xcfMeta['colorType'] === 'index-coloured' ) {
                        return false;
                }
index 6b36e37..3fb86ba 100644 (file)
@@ -339,9 +339,9 @@ class XMPReader implements LoggerAwareInterface {
                        }
                        if ( $this->charset !== 'UTF-8' ) {
                                //don't convert if already utf-8
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                $content = iconv( $this->charset, 'UTF-8//IGNORE', $content );
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
                        }
 
                        // Ensure the XMP block does not have an xml doctype declaration, which
@@ -533,7 +533,7 @@ class XMPReader implements LoggerAwareInterface {
 
                // Even with LIBXML_NOWARNING set, XMLReader::read gives a warning
                // when parsing truncated XML, which causes unit tests to fail.
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                while ( $reader->read() ) {
                        if ( $reader->nodeType === XMLReader::ELEMENT ) {
                                // Reached the first element without hitting a doctype declaration
@@ -547,7 +547,7 @@ class XMPReader implements LoggerAwareInterface {
                                break;
                        }
                }
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !is_null( $result ) ) {
                        return $result;
index bc4a00b..6912864 100644 (file)
@@ -745,13 +745,13 @@ class MWMemcached {
                $timeout = $this->_connect_timeout;
                $errno = $errstr = null;
                for ( $i = 0; !$sock && $i < $this->_connect_attempts; $i++ ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        if ( $this->_persistent == 1 ) {
                                $sock = pfsockopen( $ip, $port, $errno, $errstr, $timeout );
                        } else {
                                $sock = fsockopen( $ip, $port, $errno, $errstr, $timeout );
                        }
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
                if ( !$sock ) {
                        $this->_error_log( "Error connecting to $host: $errstr\n" );
index 82eeb84..2017a74 100644 (file)
@@ -688,9 +688,9 @@ class SqlBagOStuff extends BagOStuff {
         */
        protected function unserialize( $serial ) {
                if ( function_exists( 'gzinflate' ) ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $decomp = gzinflate( $serial );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        if ( false !== $decomp ) {
                                $serial = $decomp;
index ff34d9b..56cddce 100644 (file)
@@ -87,9 +87,9 @@ class Preprocessor_DOM implements Preprocessor {
                $xml .= "</list>";
 
                $dom = new DOMDocument();
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $result = $dom->loadXML( $xml );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$result ) {
                        // Try running the XML through UtfNormal to get rid of invalid characters
                        $xml = UtfNormal\Validator::cleanUp( $xml );
@@ -186,9 +186,9 @@ class Preprocessor_DOM implements Preprocessor {
                }
 
                $dom = new DOMDocument;
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $result = $dom->loadXML( $xml );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( !$result ) {
                        // Try running the XML through UtfNormal to get rid of invalid characters
                        $xml = UtfNormal\Validator::cleanUp( $xml );
index 874eb66..ec7ed70 100644 (file)
@@ -790,9 +790,9 @@ abstract class ResourceLoaderModule {
         * @return int UNIX timestamp
         */
        protected static function safeFilemtime( $filename ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $mtime = filemtime( $filename ) ?: 1;
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return $mtime;
        }
index 485088c..fa2423b 100644 (file)
@@ -54,9 +54,9 @@ class SearchMySQL extends SearchDatabase {
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach ( $m as $bits ) {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
 
                                if ( $nonQuoted != '' ) {
                                        $term = $nonQuoted;
index eee6930..3a5ee0e 100644 (file)
@@ -52,9 +52,9 @@ class SearchSqlite extends SearchDatabase {
                if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
                                $filteredText, $m, PREG_SET_ORDER ) ) {
                        foreach ( $m as $bits ) {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
 
                                if ( $nonQuoted != '' ) {
                                        $term = $nonQuoted;
index 6e48d04..20cceda 100644 (file)
@@ -42,9 +42,9 @@ class MediaWikiI18N {
                $m = array();
                while ( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) {
                        list( $src, $var ) = $m;
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $varValue = $this->context[$var];
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        $value = str_replace( $src, $varValue, $value );
                }
                return $value;
index a2304e3..9672580 100644 (file)
@@ -965,14 +965,14 @@ class ContribsPager extends ReverseChronologicalPager {
                 * we're definitely dealing with revision data and we may proceed, if not, we'll leave it
                 * to extensions to subscribe to the hook to parse the row.
                 */
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                try {
                        $rev = new Revision( $row );
                        $validRevision = (bool)$rev->getId();
                } catch ( Exception $e ) {
                        $validRevision = false;
                }
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $validRevision ) {
                        $classes = array();
index 387c174..8c7f0c8 100644 (file)
@@ -201,14 +201,14 @@ class DeletedContribsPager extends IndexPager {
                 * we're definitely dealing with revision data and we may proceed, if not, we'll leave it
                 * to extensions to subscribe to the hook to parse the row.
                 */
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                try {
                        $rev = Revision::newFromArchiveRow( $row );
                        $validRevision = (bool)$rev->getId();
                } catch ( Exception $e ) {
                        $validRevision = false;
                }
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $validRevision ) {
                        $ret = $this->formatRevisionRow( $row );
index dfc7cdd..47884eb 100644 (file)
@@ -372,9 +372,9 @@ class SpecialExport extends SpecialPage {
                        $buffer = WikiExporter::STREAM;
 
                        // This might take a while... :D
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        set_time_limit( 0 );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                }
 
                $exporter = new WikiExporter( $db, $history, $buffer );
index 1c1f125..a276197 100644 (file)
@@ -73,9 +73,9 @@ class SpecialLockdb extends FormSpecialPage {
                        return Status::newFatal( 'locknoconfirm' );
                }
 
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $fp = fopen( $this->getConfig()->get( 'ReadOnlyFile' ), 'w' );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( false === $fp ) {
                        # This used to show a file not found error, but the likeliest reason for fopen()
index a8b97d7..dc03a4a 100644 (file)
@@ -65,9 +65,9 @@ class SpecialUnlockdb extends FormSpecialPage {
                }
 
                $readOnlyFile = $this->getConfig()->get( 'ReadOnlyFile' );
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $res = unlink( $readOnlyFile );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $res ) {
                        return Status::newGood();
index 620c736..4442d81 100644 (file)
@@ -1146,9 +1146,9 @@ class SpecialVersion extends SpecialPage {
                        }
 
                        // SimpleXml whines about the xmlns...
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $xml = simplexml_load_file( $entries );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        if ( $xml ) {
                                foreach ( $xml->entry as $entry ) {
index d7c19ef..f17681c 100644 (file)
@@ -1221,9 +1221,9 @@ abstract class UploadBase {
                // detect the encoding in case is specifies an encoding not whitelisted in self::$safeXmlEncodings
                $attemptEncodings = array( 'UTF-16', 'UTF-16BE', 'UTF-32', 'UTF-32BE' );
                foreach ( $attemptEncodings as $encoding ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $str = iconv( $encoding, 'UTF-8', $contents );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $str != '' && preg_match( "!<\?xml\b(.*?)\?>!si", $str, $matches ) ) {
                                if ( preg_match( $encodingRegex, $matches[1], $encMatch )
                                        && !in_array( strtoupper( $encMatch[1] ), self::$safeXmlEncodings )
index e6c0e78..f223790 100644 (file)
@@ -96,9 +96,9 @@ class MWCryptRand {
                }
 
                foreach ( $files as $file ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $stat = stat( $file );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $stat ) {
                                // stat() duplicates data into numeric and string keys so kill off all the numeric ones
                                foreach ( $stat as $k => $v ) {
@@ -363,9 +363,9 @@ class MWCryptRand {
                        }
                        // /dev/urandom is generally considered the best possible commonly
                        // available random source, and is available on most *nix systems.
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $urandom = fopen( "/dev/urandom", "rb" );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        // Attempt to read all our random data from urandom
                        // php's fread always does buffered reads based on the stream's chunk_size
index cb32357..2d7d932 100644 (file)
@@ -52,7 +52,7 @@ class UIDGenerator {
                }
                // Try to get some ID that uniquely identifies this machine (RFC 4122)...
                if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        if ( wfIsWindows() ) {
                                // http://technet.microsoft.com/en-us/library/bb490913.aspx
                                $csv = trim( wfShellExec( 'getmac /NH /FO CSV' ) );
@@ -66,7 +66,7 @@ class UIDGenerator {
                                        wfShellExec( '/sbin/ifconfig -a' ), $m );
                                $nodeId = isset( $m[1] ) ? str_replace( ':', '', $m[1] ) : '';
                        }
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( !preg_match( '/^[0-9a-f]{12}$/i', $nodeId ) ) {
                                $nodeId = MWCryptRand::generateHex( 12, true );
                                $nodeId[1] = dechex( hexdec( $nodeId[1] ) | 0x1 ); // set multicast bit
index 0634d9f..0a61be6 100644 (file)
@@ -2127,9 +2127,9 @@ class Language {
                $data = explode( '|', $tz, 3 );
 
                if ( $data[0] == 'ZoneInfo' ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $userTZ = timezone_open( $data[2] );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $userTZ !== false ) {
                                $date = date_create( $ts, timezone_open( 'UTC' ) );
                                date_timezone_set( $date, $userTZ );
@@ -2164,7 +2164,7 @@ class Language {
                        return $ts;
                }
 
-               wfSuppressWarnings(); // E_STRICT system time bitching
+               MediaWiki\suppressWarnings(); // E_STRICT system time bitching
                # Generate an adjusted date; take advantage of the fact that mktime
                # will normalize out-of-range values so we don't have to split $minDiff
                # into hours and minutes.
@@ -2177,7 +2177,7 @@ class Language {
                        (int)substr( $ts, 0, 4 ) ); # Year
 
                $date = date( 'YmdHis', $t );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return $date;
        }
@@ -2626,9 +2626,9 @@ class Language {
                # *input* string. We just ignore those too.
                # REF: http://bugs.php.net/bug.php?id=37166
                # REF: https://bugzilla.wikimedia.org/show_bug.cgi?id=16885
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $text = iconv( $in, $out . '//IGNORE', $string );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                return $text;
        }
 
index e4ac467..04aa3a5 100644 (file)
@@ -957,10 +957,9 @@ abstract class Maintenance {
 
                $wgShowSQLErrors = true;
 
-               // @codingStandardsIgnoreStart Allow error suppression. wfSuppressWarnings()
-               // is not available.
-               @set_time_limit( 0 );
-               // @codingStandardsIgnoreStart
+               MediaWiki\suppressWarnings();
+               set_time_limit( 0 );
+               MediaWiki\restoreWarnings();
 
                $this->adjustMemoryLimit();
        }
index 222c538..6e1ddb4 100644 (file)
@@ -135,9 +135,9 @@ class BackupDumper {
                foreach ( $args as $arg ) {
                        $matches = array();
                        if ( preg_match( '/^--(.+?)(?:=(.+?)(?::(.+?))?)?$/', $arg, $matches ) ) {
-                               wfSuppressWarnings();
+                               MediaWiki\suppressWarnings();
                                list( /* $full */, $opt, $val, $param ) = $matches;
-                               wfRestoreWarnings();
+                               MediaWiki\restoreWarnings();
 
                                switch ( $opt ) {
                                        case "plugin":
index d83f1fc..27be5fd 100644 (file)
@@ -659,13 +659,13 @@ class TextPassDumper extends BackupDumper {
        }
 
        private function getTextSpawned( $id ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                if ( !$this->spawnProc ) {
                        // First time?
                        $this->openSpawn();
                }
                $text = $this->getTextSpawnedOnce( $id );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return $text;
        }
@@ -712,7 +712,7 @@ class TextPassDumper extends BackupDumper {
        }
 
        private function closeSpawn() {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                if ( $this->spawnRead ) {
                        fclose( $this->spawnRead );
                }
@@ -729,7 +729,7 @@ class TextPassDumper extends BackupDumper {
                        pclose( $this->spawnProc );
                }
                $this->spawnProc = false;
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
        }
 
        private function getTextSpawnedOnce( $id ) {
index d1c2edd..30a23d3 100644 (file)
@@ -121,9 +121,9 @@ class CheckSyntax extends Maintenance {
                        return; // process only this path
                } elseif ( $this->hasOption( 'list-file' ) ) {
                        $file = $this->getOption( 'list-file' );
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $f = fopen( $file, 'r' );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( !$f ) {
                                $this->error( "Can't open file $file\n", true );
                        }
index ae70441..ad385e5 100644 (file)
@@ -88,23 +88,23 @@ if ( isset( $options['check-userblock'] ) ) {
 }
 
 # Get --from
-wfSuppressWarnings();
+MediaWiki\suppressWarnings();
 $from = $options['from'];
-wfRestoreWarnings();
+MediaWiki\restoreWarnings();
 
 # Get sleep time.
-wfSuppressWarnings();
+MediaWiki\suppressWarnings();
 $sleep = $options['sleep'];
-wfRestoreWarnings();
+MediaWiki\restoreWarnings();
 
 if ( $sleep ) {
        $sleep = (int)$sleep;
 }
 
 # Get limit number
-wfSuppressWarnings();
+MediaWiki\suppressWarnings();
 $limit = $options['limit'];
-wfRestoreWarnings();
+MediaWiki\restoreWarnings();
 
 if ( $limit ) {
        $limit = (int)$limit;
index b948b67..0037ea8 100644 (file)
@@ -104,9 +104,9 @@ class CommandLineInstaller extends Maintenance {
                                $this->error( 'WARNING: You have provided the options "dbpass" and "dbpassfile". '
                                        . 'The content of "dbpassfile" overrides "dbpass".' );
                        }
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $dbpass = file_get_contents( $dbpassfile ); // returns false on failure
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $dbpass === false ) {
                                $this->error( "Couldn't open $dbpassfile", true );
                        }
@@ -119,9 +119,9 @@ class CommandLineInstaller extends Maintenance {
                                $this->error( 'WARNING: You have provided the options "pass" and "passfile". '
                                        . 'The content of "passfile" overrides "pass".' );
                        }
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $pass = file_get_contents( $passfile ); // returns false on failure
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $pass === false ) {
                                $this->error( "Couldn't open $passfile", true );
                        }
index 3f0a9ba..fddfc02 100644 (file)
@@ -47,9 +47,9 @@ class JSParseHelper extends Maintenance {
 
                $parser = new JSParser();
                foreach ( $files as $filename ) {
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $js = file_get_contents( $filename );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( $js === false ) {
                                $this->output( "$filename ERROR: could not read file\n" );
                                $this->errs++;
index 257fe14..534a8b4 100644 (file)
@@ -26,9 +26,9 @@
 /** A general output object. Need to be overridden */
 class StatsOutput {
        function formatPercent( $subset, $total, $revert = false, $accuracy = 2 ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $return = sprintf( '%.' . $accuracy . 'f%%', 100 * $subset / $total );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                return $return;
        }
@@ -92,9 +92,9 @@ class WikiStatsOutput extends StatsOutput {
        }
 
        function formatPercent( $subset, $total, $revert = false, $accuracy = 2 ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $v = round( 255 * $subset / $total );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $revert ) {
                        # Weigh reverse with factor 20 so coloring takes effect more quickly as
index 6ce54b9..924457a 100644 (file)
@@ -131,9 +131,9 @@ class RebuildFileCache extends Maintenance {
                                        ob_start( array( &$cache, 'saveToFileCache' ) ); // save on ob_end_clean()
                                        $wgUseFileCache = false; // hack, we don't want $article fiddling with filecache
                                        $article->view();
-                                       wfSuppressWarnings(); // header notices
+                                       MediaWiki\suppressWarnings(); // header notices
                                        $wgOut->output();
-                                       wfRestoreWarnings();
+                                       MediaWiki\restoreWarnings();
                                        $wgUseFileCache = true;
                                        ob_end_clean(); // clear buffer
                                        if ( $rebuilt ) {
index 7e02a4b..b11f1c8 100644 (file)
@@ -117,12 +117,12 @@ class SqliteMaintenance extends Maintenance {
                $this->db->query( 'BEGIN IMMEDIATE TRANSACTION', __METHOD__ );
                $ourFile = $this->db->getDbFilePath();
                $this->output( "   Copying database file $ourFile to $fileName... " );
-               wfSuppressWarnings( false );
+               MediaWiki\suppressWarnings( false );
                if ( !copy( $ourFile, $fileName ) ) {
                        $err = error_get_last();
                        $this->error( "      {$err['message']}" );
                }
-               wfSuppressWarnings( true );
+               MediaWiki\suppressWarnings( true );
                $this->output( "   Releasing lock...\n" );
                $this->db->query( 'COMMIT TRANSACTION', __METHOD__ );
        }
index d2fe3b4..dd4cd54 100644 (file)
@@ -312,9 +312,9 @@ class FixBug20757 extends Maintenance {
                $text = $secondaryRow->old_text;
                if ( in_array( 'external', $flags ) ) {
                        $url = $text;
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        list( /* $proto */, $path ) = explode( '://', $url, 2 );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        if ( $path == "" ) {
                                return false;
index 3562df6..b213929 100644 (file)
@@ -234,9 +234,9 @@ class RecompressTracked {
                                array( 'file', 'php://stdout', 'w' ),
                                array( 'file', 'php://stderr', 'w' )
                        );
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $proc = proc_open( "$cmd --slave-id $i", $spec, $pipes );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
                        if ( !$proc ) {
                                $this->critical( "Error opening slave process: $cmd" );
                                exit( 1 );
index 72cac05..0ce056f 100644 (file)
@@ -716,9 +716,9 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
         * @param string $function
         */
        public function hideDeprecated( $function ) {
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                wfDeprecated( $function );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
        }
 
        /**
@@ -1002,9 +1002,9 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase {
 
                # This check may also protect against code injection in
                # case of broken installations.
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $haveDiff3 = $wgDiff3 && file_exists( $wgDiff3 );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( !$haveDiff3 ) {
                        $this->markTestSkipped( "Skip test, since diff3 is not configured" );
index 1e30273..5c28ece 100644 (file)
@@ -666,9 +666,9 @@ class GlobalTest extends MediaWikiTestCase {
        public function testWfMkdirParents() {
                // Should not return true if file exists instead of directory
                $fname = $this->getNewTempFile();
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $ok = wfMkdirParents( $fname );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                $this->assertFalse( $ok );
        }
 
index f74fc35..b7f7d10 100644 (file)
@@ -451,9 +451,9 @@ class ApiUploadTest extends ApiTestCaseUpload {
                $chunkSessionKey = false;
                $resultOffset = 0;
                // Open the file:
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $handle = fopen( $filePath, "r" );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
 
                if ( $handle === false ) {
                        $this->markTestIncomplete( "could not open file: $filePath" );
@@ -461,9 +461,9 @@ class ApiUploadTest extends ApiTestCaseUpload {
 
                while ( !feof( $handle ) ) {
                        // Get the current chunk
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $chunkData = fread( $handle, $chunkSize );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        // Upload the current chunk into the $_FILE object:
                        $this->fakeUploadChunk( 'chunk', 'blob', $mimeType, $chunkData );
index 1abb47e..7280a97 100644 (file)
@@ -12,11 +12,11 @@ class MWDebugTest extends MediaWikiTestCase {
                }
                /** Clear log before each test */
                MWDebug::clearLog();
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
        }
 
        protected function tearDown() {
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                parent::tearDown();
        }
 
index 149a28c..13908b9 100644 (file)
@@ -152,9 +152,9 @@ class JavaScriptMinifierTest extends PHPUnit_Framework_TestCase {
 
                // JSMin+'s parser will throw an exception if output is not valid JS.
                // suppression of warnings needed for stupid crap
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $parser = new JSParser();
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                $parser->parse( $minified, 'minify-test.js', 1 );
 
                $this->assertEquals(
index cde6547..8674329 100644 (file)
@@ -58,9 +58,9 @@ class AutoLoaderTest extends MediaWikiTestCase {
                                continue;
                        }
 
-                       wfSuppressWarnings();
+                       MediaWiki\suppressWarnings();
                        $contents = file_get_contents( $filePath );
-                       wfRestoreWarnings();
+                       MediaWiki\restoreWarnings();
 
                        if ( $contents === false ) {
                                $actual[$class] = "[couldn't read file '$filePath']";
index 8bc04b9..40f3754 100644 (file)
--- a/thumb.php
+++ b/thumb.php
@@ -231,9 +231,9 @@ function wfStreamThumb( array $params ) {
                // Fix IE brokenness
                $imsString = preg_replace( '/;.*$/', '', $_SERVER["HTTP_IF_MODIFIED_SINCE"] );
                // Calculate time
-               wfSuppressWarnings();
+               MediaWiki\suppressWarnings();
                $imsUnix = strtotime( $imsString );
-               wfRestoreWarnings();
+               MediaWiki\restoreWarnings();
                if ( wfTimestamp( TS_UNIX, $img->getTimestamp() ) <= $imsUnix ) {
                        HttpStatus::header( 304  );
                        return;