"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",
// 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;
}
$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.
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'] ) ) {
/**
* 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
}
// 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
# 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" );
}
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.
} else {
wfFixSessionID();
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
session_start();
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
/**
$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;
}
}
}
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$result = unpack( $format, $data );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $result === false ) {
// If it cannot extract the packed data.
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;
}
*/
function patch( $base, $diff ) {
if ( function_exists( 'xdiff_string_bpatch' ) ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$text = xdiff_string_bpatch( $base, $diff ) . '';
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $text;
}
}
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 ) {
}
do {
$reqCount++;
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$fh = fopen( $url, "r", false, $context );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$fh ) {
break;
* @return Status
*/
static function newFromFile( $filename ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$file = fopen( $filename, 'rt' );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$file ) {
return Status::newFatal( "importcantopen" );
}
$errno = $errstr = null;
$info = wfParseUrl( $this->config->get( 'Server' ) );
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$sock = fsockopen(
$info['host'],
isset( $info['port'] ) ? $info['port'] : 80,
// 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
*/
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';
return $this->detectZipType( $head, $tail, $ext );
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$gis = getimagesize( $file );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $gis && isset( $gis['mime'] ) ) {
$mime = $gis['mime'];
# 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" );
$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] ) ) {
# 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] ) ) {
$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 ) {
* 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 );
}
$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 ) {
} 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;
*/
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 = '';
$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 );
}
$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 ) {
}
$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" );
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 ) {
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'] : '';
}
if ( $meta ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$metadata = unserialize( $file->getMetadata() );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $metadata && $version !== 'latest' ) {
$metadata = $file->convertMetadataVersion( $metadata, $version );
}
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();
}
}
* @return bool
*/
function isExpired() {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$lastmod = filemtime( $this->filename );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $lastmod === false ) {
if ( $this->timestamp === false ) {
# Still nonexistent
* @return void
*/
public function clearCache() {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
unlink( $this->cachePath() );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
$this->mCached = false;
}
*/
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 );
$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
}
$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" );
fwrite( $file, $hash . $serialized );
fclose( $file );
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
chmod( $filename, 0666 );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
/**
public function parseParams() {
$rcParams = $this->getAttribute( 'rc_params' );
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$unserializedParams = unserialize( $rcParams );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $unserializedParams;
}
$handlers = Hooks::getHandlers( $event );
$handlerInfo = array();
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
foreach ( $handlers as $handler ) {
if ( is_array( $handler ) ) {
$handlerInfo[] = $info;
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
wfWarn( "Using obsolete hook $event via ContentHandler::runLegacyHooks()! Handlers: " .
implode( ', ', $handlerInfo ), 2 );
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" );
$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() );
}
if ( $dbName != '' ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$success = $this->selectDB( $dbName );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$success ) {
wfLogDBError(
"Error selecting database {db_name} on server {db_server}",
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" );
}
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.
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.
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
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();
}
function __destruct() {
if ( $this->mOpened ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$this->close();
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
}
$session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : OCI_DEFAULT;
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( $this->mFlags & DBO_PERSISTENT ) {
$this->mConn = oci_pconnect(
$this->mUser,
$session_mode
);
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $this->mUser != $this->mDBname ) {
//change current schema in session
$explain_count
);
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( ( $this->mLastResult = $stmt = oci_parse( $this->mConn, $sql ) ) === false ) {
$e = oci_error( $this->mConn );
}
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $explain_count > 0 ) {
return $this->doQuery( 'SELECT id, cardinality "ROWS" FROM plan_table ' .
}
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
$e = oci_error( $stmt );
$this->mAffectedRows = oci_num_rows( $stmt );
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( isset( $lob ) ) {
foreach ( $lob as $lob_v ) {
}
$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' ) {
}
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( oci_execute( $stmt, $this->execFlags() ) === false ) {
$e = oci_error( $stmt );
$this->mAffectedRows = oci_num_rows( $stmt );
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( isset( $lob ) ) {
foreach ( $lob as $lob_v ) {
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" );
}
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
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,
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,
$transport = UDPTransport::newFromString( $file );
$transport->emit( $text );
} else {
- wfSuppressWarnings();
+ \MediaWiki\suppressWarnings();
$exists = file_exists( $file );
$size = $exists ? filesize( $file ) : false;
if ( !$exists ||
) {
file_put_contents( $file, $text, FILE_APPEND );
}
- wfRestoreWarnings();
+ \MediaWiki\restoreWarnings();
}
}
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 );
* @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 );
}
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 );
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 );
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;
}
protected function getSourceSha1Base36() {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$hash = sha1_file( $this->params['src'] );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $hash !== false ) {
$hash = wfBaseConvert( $hash, 16, 36, 31 );
}
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'] );
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'] );
$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
*/
public function purge() {
$this->canDelete = false; // done
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$ok = unlink( $this->path );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
unset( self::$pathsCollect[$this->path] );
*/
public static function purgeAllOnShutdown() {
foreach ( self::$pathsCollect as $path ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
unlink( $path );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
}
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
$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;
}
// Cleanup for disk source files...
foreach ( $sourceFSFilesToDelete as $file ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
unlink( $file ); // FS cleanup
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
return $status;
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' );
global $wgAutoloadClasses;
$wgAutoloadClasses = array();
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$_lsExists = file_exists( "$IP/LocalSettings.php" );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$_lsExists ) {
return false;
* @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' );
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 ) {
// 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 ) {
unlink( $dir . $file );
if ( $text == 'exec' ) {
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $ext;
}
}
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return false;
}
* Some long-running pages (Install, Upgrade) will want to do this
*/
protected function disableTimeLimit() {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
set_time_limit( 0 );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
}
# 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 );
}
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;
}
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() );
}
$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 {
#
'-layers', 'merge',
'-background', 'white',
);
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$xcfMeta = unserialize( $image->getMetadata() );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $xcfMeta
&& isset( $xcfMeta['colorType'] )
&& $xcfMeta['colorType'] === 'greyscale-alpha'
return $metadata;
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$unser = unserialize( $metadata );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( is_array( $unser ) ) {
if ( isset( $unser['error'] ) ) {
return false;
return false;
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
try {
// Set to false rather than null to avoid further attempts
$image->dejaMetaTree = false;
} catch ( Exception $e ) {
wfDebug( "Bogus multipage XML metadata on '{$image->getName()}'\n" );
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $gettext ) {
return $image->djvuTextTree;
} else {
}
function getInfo() {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$file = fopen( $this->mFilename, 'rb' );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $file === false ) {
wfDebug( __METHOD__ . ": missing or failed file read\n" );
$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." );
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();
}
}
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()
) {
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'] ) {
return self::METADATA_GOOD;
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$data = unserialize( $metadata );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$data || !is_array( $data ) ) {
wfDebug( __METHOD__ . " invalid GIF metadata\n" );
$original = parent::getLongDesc( $image );
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$metadata = unserialize( $image->getMetadata() );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$metadata || $metadata['frameCount'] <= 1 ) {
return $original;
UtfNormal\Validator::quickIsNFCVerify( $dataCopy );
if ( $dataCopy !== $data ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$data = iconv( 'windows-1252', 'UTF-8', $data );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
$commentCount = count( $comment );
*/
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" );
}
function getImageSize( $image, $path ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$gis = getimagesize( $path );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $gis;
}
// 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.
if ( !is_array( $metadata ) ) {
//unserialize to keep return parameter consistent.
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$ret = unserialize( $metadata );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $ret;
}
return self::METADATA_GOOD;
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$data = unserialize( $metadata );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$data || !is_array( $data ) ) {
wfDebug( __METHOD__ . " invalid png metadata\n" );
global $wgLang;
$original = parent::getLongDesc( $image );
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$metadata = unserialize( $image->getMetadata() );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !$metadata || $metadata['frameCount'] <= 0 ) {
return $original;
// 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
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)" );
continue;
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$content = gzuncompress( $content );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $content === false ) {
// decompression failed
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)" );
$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',
}
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 {
// 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 );
}
* @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;
}
}
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
// 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
break;
}
}
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( !is_null( $result ) ) {
return $result;
$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" );
*/
protected function unserialize( $serial ) {
if ( function_exists( 'gzinflate' ) ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$decomp = gzinflate( $serial );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( false !== $decomp ) {
$serial = $decomp;
$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 );
}
$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 );
* @return int UNIX timestamp
*/
protected static function safeFilemtime( $filename ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$mtime = filemtime( $filename ) ?: 1;
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $mtime;
}
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;
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;
$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;
* 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();
* 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 );
$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 );
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()
}
$readOnlyFile = $this->getConfig()->get( 'ReadOnlyFile' );
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$res = unlink( $readOnlyFile );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $res ) {
return Status::newGood();
}
// SimpleXml whines about the xmlns...
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$xml = simplexml_load_file( $entries );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $xml ) {
foreach ( $xml->entry as $entry ) {
// 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 )
}
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 ) {
}
// /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
}
// 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' ) );
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
$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 );
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.
(int)substr( $ts, 0, 4 ) ); # Year
$date = date( 'YmdHis', $t );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $date;
}
# *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;
}
$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();
}
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":
}
private function getTextSpawned( $id ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( !$this->spawnProc ) {
// First time?
$this->openSpawn();
}
$text = $this->getTextSpawnedOnce( $id );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
return $text;
}
}
private function closeSpawn() {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
if ( $this->spawnRead ) {
fclose( $this->spawnRead );
}
pclose( $this->spawnProc );
}
$this->spawnProc = false;
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
private function getTextSpawnedOnce( $id ) {
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 );
}
}
# 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;
$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 );
}
$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 );
}
$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++;
/** 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;
}
}
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
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 ) {
$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__ );
}
$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;
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 );
* @param string $function
*/
public function hideDeprecated( $function ) {
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
wfDeprecated( $function );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
}
/**
# 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" );
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 );
}
$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" );
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 );
}
/** Clear log before each test */
MWDebug::clearLog();
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
}
protected function tearDown() {
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
parent::tearDown();
}
// 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(
continue;
}
- wfSuppressWarnings();
+ MediaWiki\suppressWarnings();
$contents = file_get_contents( $filePath );
- wfRestoreWarnings();
+ MediaWiki\restoreWarnings();
if ( $contents === false ) {
$actual[$class] = "[couldn't read file '$filePath']";
// 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;