Replace some more usages of Wikimedia\(suppress|restore)Warnings()
Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
This commit is contained in:
parent
99e1b7312e
commit
86934b2fa8
43 changed files with 175 additions and 121 deletions
|
|
@ -318,9 +318,9 @@ class GitInfo {
|
|||
$config = "{$this->basedir}/config";
|
||||
$url = false;
|
||||
if ( is_readable( $config ) ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$configArray = parse_ini_file( $config, true );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
$remote = false;
|
||||
|
||||
// Use the "origin" remote repo if available or any other repo if not.
|
||||
|
|
|
|||
|
|
@ -2359,14 +2359,14 @@ function wfMemoryLimit( $newLimit ) {
|
|||
$newLimit = wfShorthandToInteger( $newLimit );
|
||||
if ( $newLimit == -1 ) {
|
||||
wfDebug( "Removing PHP's memory limit" );
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
ini_set( 'memory_limit', $newLimit );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
} elseif ( $newLimit > $oldLimit ) {
|
||||
wfDebug( "Raising PHP's memory limit to $newLimit bytes" );
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
ini_set( 'memory_limit', $newLimit );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2483,9 +2483,9 @@ function wfUnpack( $format, $data, $length = false ) {
|
|||
}
|
||||
}
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$result = unpack( $format, $data );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $result === false ) {
|
||||
// If it cannot extract the packed data.
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ use MediaWiki\Logger\LoggerFactory;
|
|||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Permissions\PermissionStatus;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\Rdbms\ChronologyProtector;
|
||||
use Wikimedia\Rdbms\DBConnectionError;
|
||||
use Wikimedia\ScopedCallback;
|
||||
|
|
@ -1226,7 +1227,7 @@ class MediaWiki {
|
|||
$port = $info['port'];
|
||||
}
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$sock = $host ? fsockopen(
|
||||
$host,
|
||||
$port,
|
||||
|
|
@ -1235,7 +1236,7 @@ class MediaWiki {
|
|||
// If it takes more than 100ms to connect to ourselves there is a problem...
|
||||
0.100
|
||||
) : false;
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
$invokedWithSuccess = true;
|
||||
if ( $sock ) {
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use MediaWiki\Page\PageReference;
|
|||
use MediaWiki\Permissions\PermissionStatus;
|
||||
use MediaWiki\Session\SessionManager;
|
||||
use MediaWiki\Tidy\RemexDriver;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\Rdbms\IResultWrapper;
|
||||
use Wikimedia\RelPath;
|
||||
use Wikimedia\WrappedString;
|
||||
|
|
@ -802,9 +803,10 @@ class OutputPage extends ContextSource {
|
|||
# this breaks strtotime().
|
||||
$clientHeader = preg_replace( '/;.*$/', '', $clientHeader );
|
||||
|
||||
Wikimedia\suppressWarnings(); // E_STRICT system time warnings
|
||||
// E_STRICT system time warnings
|
||||
AtEase::suppressWarnings();
|
||||
$clientHeaderTime = strtotime( $clientHeader );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( !$clientHeaderTime ) {
|
||||
wfDebug( __METHOD__
|
||||
. ": unable to parse the client's If-Modified-Since header: $clientHeader" );
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ use MediaWiki\Settings\Config\PhpIniSink;
|
|||
use MediaWiki\Settings\SettingsBuilder;
|
||||
use MediaWiki\Settings\Source\PhpSettingsSource;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\RequestTimeout\RequestTimeout;
|
||||
|
||||
/**
|
||||
|
|
@ -606,9 +607,9 @@ if ( isset( $wgSlaveLagCritical ) ) {
|
|||
}
|
||||
|
||||
if ( $wgInvalidateCacheOnLocalSettingsChange && defined( 'MW_CONFIG_FILE' ) ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', filemtime( MW_CONFIG_FILE ) ) );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
|
||||
if ( $wgNewUserLog ) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ use MediaWiki\ParamValidator\TypeDef\UserDef;
|
|||
use MediaWiki\Rest\HeaderParser\Origin;
|
||||
use MediaWiki\Session\SessionManager;
|
||||
use MediaWiki\User\UserFactory;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\Timestamp\TimestampException;
|
||||
|
||||
/**
|
||||
|
|
@ -1678,9 +1679,9 @@ class ApiMain extends ApiBase {
|
|||
$this->getRequest()->response()->statusHeader( 304 );
|
||||
|
||||
// Avoid outputting the compressed representation of a zero-length body
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
ini_set( 'zlib.output_compression', 0 );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
wfResetOutputBuffers( false );
|
||||
|
||||
return false;
|
||||
|
|
|
|||
5
includes/cache/FileCacheBase.php
vendored
5
includes/cache/FileCacheBase.php
vendored
|
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\IPUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -182,9 +183,9 @@ abstract class FileCacheBase {
|
|||
* @return void
|
||||
*/
|
||||
public function clearCache() {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
unlink( $this->cachePath() );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
$this->mCached = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
10
includes/cache/dependency/FileDependency.php
vendored
10
includes/cache/dependency/FileDependency.php
vendored
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Cache
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* @newable
|
||||
* @ingroup Cache
|
||||
|
|
@ -59,11 +61,11 @@ class FileDependency extends CacheDependency {
|
|||
|
||||
public function loadDependencyValues() {
|
||||
if ( $this->timestamp === null ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
# Dependency on a non-existent file stores "false"
|
||||
# This is a valid concept!
|
||||
$this->timestamp = filemtime( $this->filename );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -71,9 +73,9 @@ class FileDependency extends CacheDependency {
|
|||
* @return bool
|
||||
*/
|
||||
public function isExpired() {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$lastmod = filemtime( $this->filename );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $lastmod === false ) {
|
||||
if ( $this->timestamp === false ) {
|
||||
# Still nonexistent
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ use MediaWiki\Storage\EditResult;
|
|||
use MediaWiki\User\UserIdentity;
|
||||
use MediaWiki\User\UserIdentityValue;
|
||||
use Wikimedia\Assert\Assert;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\IPUtils;
|
||||
|
||||
/**
|
||||
|
|
@ -1289,9 +1290,9 @@ class RecentChange implements Taggable {
|
|||
public function parseParams() {
|
||||
$rcParams = $this->getAttribute( 'rc_params' );
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$unserializedParams = unserialize( $rcParams );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
return $unserializedParams;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ use RuntimeException;
|
|||
use Throwable;
|
||||
use UDPTransport;
|
||||
use WikiMap;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* PSR-3 logger that mimics the historic implementation of MediaWiki's former
|
||||
|
|
@ -514,7 +515,7 @@ class LegacyLogger extends AbstractLogger {
|
|||
$transport = UDPTransport::newFromString( $file );
|
||||
$transport->emit( $text );
|
||||
} else {
|
||||
\Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$exists = file_exists( $file );
|
||||
$size = $exists ? filesize( $file ) : false;
|
||||
if ( !$exists ||
|
||||
|
|
@ -522,7 +523,7 @@ class LegacyLogger extends AbstractLogger {
|
|||
) {
|
||||
file_put_contents( $file, $text, FILE_APPEND );
|
||||
}
|
||||
\Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ use MediaWiki\MediaWikiServices;
|
|||
use MediaWiki\Page\PageIdentity;
|
||||
use MediaWiki\Permissions\Authority;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Base code for file repositories.
|
||||
|
|
@ -1376,9 +1377,9 @@ class FileRepo {
|
|||
}
|
||||
// Cleanup for disk source files...
|
||||
foreach ( $sourceFSFilesToDelete as $file ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
unlink( $file ); // FS cleanup
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
|
||||
return $status;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Diff-based history compression
|
||||
* Requires xdiff 1.5+ and zlib
|
||||
|
|
@ -195,9 +197,9 @@ class DiffHistoryBlob implements HistoryBlob {
|
|||
private 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"
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$diff = xdiff_string_rabdiff( $t1, $t2 ) . '';
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
return $diff;
|
||||
}
|
||||
|
||||
|
|
@ -208,9 +210,9 @@ class DiffHistoryBlob implements HistoryBlob {
|
|||
*/
|
||||
private function patch( $base, $diff ) {
|
||||
if ( function_exists( 'xdiff_string_bpatch' ) ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$text = xdiff_string_bpatch( $base, $diff ) . '';
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Imports a XML dump from a file (either from file upload, files on disk, or HTTP)
|
||||
|
|
@ -60,9 +61,9 @@ class ImportStreamSource implements ImportSource {
|
|||
* @return Status
|
||||
*/
|
||||
public static function newFromFile( $filename ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$file = fopen( $filename, 'rt' );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( !$file ) {
|
||||
return Status::newFatal( "importcantopen" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup Installer
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\Rdbms\Database;
|
||||
use Wikimedia\Rdbms\DBConnectionError;
|
||||
use Wikimedia\Rdbms\DBExpectedError;
|
||||
|
|
@ -787,10 +788,10 @@ abstract class DatabaseInstaller {
|
|||
return $status;
|
||||
}
|
||||
global $IP;
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$rows = file( "$IP/maintenance/interwiki.list",
|
||||
FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
$interwikis = [];
|
||||
if ( !$rows ) {
|
||||
return Status::newFatal( 'config-install-interwiki-list' );
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use MediaWiki\HookContainer\StaticHookRegistry;
|
|||
use MediaWiki\Interwiki\NullInterwikiLookup;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Settings\SettingsBuilder;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* The Installer helps admins create or upgrade their wiki.
|
||||
|
|
@ -652,10 +653,10 @@ abstract class Installer {
|
|||
// phpcs:ignore MediaWiki.VariableAnalysis.UnusedGlobalVariables
|
||||
global $wgExtensionDirectory, $wgStyleDirectory;
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
wfDetectLocalSettingsFile( $IP ); // defines MW_CONFIG_FILE
|
||||
$_lsExists = file_exists( MW_CONFIG_FILE );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( !$_lsExists ) {
|
||||
return false;
|
||||
|
|
@ -867,14 +868,14 @@ abstract class Installer {
|
|||
* @return bool
|
||||
*/
|
||||
protected function envCheckPCRE() {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::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', '', "-\u{3000}-" );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $regexd != '--' || $regexprop != '--' ) {
|
||||
$this->showError( 'config-pcre-no-utf8' );
|
||||
|
||||
|
|
@ -1154,7 +1155,7 @@ abstract class Installer {
|
|||
|
||||
$httpRequestFactory = MediaWikiServices::getInstance()->getHttpRequestFactory();
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
|
||||
foreach ( $scriptTypes as $ext => $contents ) {
|
||||
foreach ( $contents as $source ) {
|
||||
|
|
@ -1178,14 +1179,14 @@ abstract class Installer {
|
|||
unlink( $dir . $file );
|
||||
|
||||
if ( $text == 'exec' ) {
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
return $ext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1935,8 +1936,8 @@ abstract class Installer {
|
|||
* Some long-running pages (Install, Upgrade) will want to do this
|
||||
*/
|
||||
protected function disableTimeLimit() {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
set_time_limit( 0 );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup Installer
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\Rdbms\Database;
|
||||
use Wikimedia\Rdbms\DatabaseSqlite;
|
||||
use Wikimedia\Rdbms\DBConnectionError;
|
||||
|
|
@ -173,9 +174,9 @@ class SqliteInstaller extends DatabaseInstaller {
|
|||
*/
|
||||
private static function createDataDir( $dir ): Status {
|
||||
if ( !is_dir( $dir ) ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$ok = wfMkdirParents( $dir, 0700, __METHOD__ );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( !$ok ) {
|
||||
return Status::newFatal( 'config-sqlite-mkdir-error', $dir );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ use MediaWiki\Logger\LoggerFactory;
|
|||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use Wikimedia\Assert\Assert;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\RequestTimeout\TimeoutException;
|
||||
|
||||
/**
|
||||
|
|
@ -2116,7 +2117,8 @@ class Language {
|
|||
return $ts;
|
||||
}
|
||||
|
||||
Wikimedia\suppressWarnings(); // E_STRICT system time bitching
|
||||
// E_STRICT system time bitching
|
||||
AtEase::suppressWarnings();
|
||||
# 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.
|
||||
|
|
@ -2129,7 +2131,7 @@ class Language {
|
|||
(int)substr( $ts, 0, 4 ) ); # Year
|
||||
|
||||
$date = date( 'YmdHis', $t );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
return $date;
|
||||
}
|
||||
|
|
@ -2623,9 +2625,9 @@ class Language {
|
|||
# *input* string. We just ignore those too.
|
||||
# REF: https://bugs.php.net/bug.php?id=37166
|
||||
# REF: https://phabricator.wikimedia.org/T18885
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$text = iconv( $in, $out . '//IGNORE', $string );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@
|
|||
*
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Server-side helper for client-side compressed content.
|
||||
*
|
||||
|
|
@ -60,9 +62,9 @@ class Deflate {
|
|||
if ( $deflated === false ) {
|
||||
return StatusValue::newFatal( 'deflate-invaliddeflate' );
|
||||
}
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$inflated = gzinflate( $deflated );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $inflated === false ) {
|
||||
return StatusValue::newFatal( 'deflate-invaliddeflate' );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace MediaWiki\FileBackend\FSFile;
|
||||
|
||||
use TempFSFile;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* @ingroup FileBackend
|
||||
|
|
@ -38,9 +39,9 @@ class TempFSFileFactory {
|
|||
while ( $attempts-- ) {
|
||||
$hex = sprintf( '%06x%06x', mt_rand( 0, 0xffffff ), mt_rand( 0, 0xffffff ) );
|
||||
$path = "$tmpDirectory/$prefix$hex$ext";
|
||||
\Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$newFileHandle = fopen( $path, 'x' );
|
||||
\Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $newFileHandle ) {
|
||||
fclose( $newFileHandle );
|
||||
$tmpFile = new TempFSFile( $path );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup LockManager
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Simple version of LockManager based on using FS lock files.
|
||||
* All locks are non-blocking, which avoids deadlocks.
|
||||
|
|
@ -122,7 +124,7 @@ class FSLockManager extends LockManager {
|
|||
if ( isset( $this->handles[$path] ) ) {
|
||||
$handle = $this->handles[$path];
|
||||
} else {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$handle = fopen( $this->getLockPath( $path ), 'a+' );
|
||||
if ( !$handle && !is_dir( $this->lockDir ) ) {
|
||||
// Create the lock directory in case it is missing
|
||||
|
|
@ -132,7 +134,7 @@ class FSLockManager extends LockManager {
|
|||
$this->logger->error( "Cannot create directory '{$this->lockDir}'." );
|
||||
}
|
||||
}
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
if ( $handle ) {
|
||||
// Either a shared or exclusive lock
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@
|
|||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Read the directory of a Microsoft Compound File Binary file, a.k.a. an OLE
|
||||
* file, and detect the MIME type.
|
||||
|
|
@ -216,9 +218,9 @@ class MSCompoundFileReader {
|
|||
|
||||
private function readOffset( $offset, $length ) {
|
||||
$this->fseek( $offset );
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$block = fread( $this->file, $length );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $block === false ) {
|
||||
$this->error( 'error reading from file', self::ERROR_READ );
|
||||
}
|
||||
|
|
@ -243,9 +245,9 @@ class MSCompoundFileReader {
|
|||
}
|
||||
|
||||
private function fseek( $offset ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$result = fseek( $this->file, $offset );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $result !== 0 ) {
|
||||
$this->error( "unable to seek to offset $offset", self::ERROR_SEEK );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
use Psr\Log\LoggerAwareInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\Mime\MimeMap;
|
||||
use Wikimedia\Mime\MimeMapMinimal;
|
||||
|
||||
|
|
@ -545,9 +546,9 @@ class MimeAnalyzer implements LoggerAwareInterface {
|
|||
*/
|
||||
private function doGuessMimeType( string $file, $ext ) {
|
||||
// Read a chunk of the file
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$f = fopen( $file, 'rb' );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( !$f ) {
|
||||
return 'unknown/unknown';
|
||||
|
|
@ -681,9 +682,9 @@ class MimeAnalyzer implements LoggerAwareInterface {
|
|||
/**
|
||||
* look for XML formats (XHTML and SVG)
|
||||
*/
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$xml = new XmlTypeCheck( $file );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $xml->wellFormed ) {
|
||||
$xmlTypes = $this->xmlTypes;
|
||||
return $xmlTypes[$xml->getRootElement()] ?? 'application/xml';
|
||||
|
|
@ -759,9 +760,9 @@ class MimeAnalyzer implements LoggerAwareInterface {
|
|||
}
|
||||
}
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$gis = getimagesize( $file );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $gis && isset( $gis['mime'] ) ) {
|
||||
$mime = $gis['mime'];
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@
|
|||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\IPUtils;
|
||||
|
||||
// {{{ class MemcachedClient
|
||||
|
|
@ -800,13 +801,13 @@ class MemcachedClient {
|
|||
$timeout = $this->_connect_timeout;
|
||||
$errno = $errstr = null;
|
||||
for ( $i = 0; !$sock && $i < $this->_connect_attempts; $i++ ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
if ( $this->_persistent == 1 ) {
|
||||
$sock = pfsockopen( $ip, $port, $errno, $errstr, $timeout );
|
||||
} else {
|
||||
$sock = fsockopen( $ip, $port, $errno, $errstr, $timeout );
|
||||
}
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
if ( !$sock ) {
|
||||
$this->_error_log( "Error connecting to $host: $errstr" );
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
use MediaWiki\Logger\LoggerFactory;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\Rdbms\IDatabase;
|
||||
|
||||
/**
|
||||
|
|
@ -181,9 +182,9 @@ class DatabaseLogEntry extends LogEntryBase {
|
|||
public function getParameters() {
|
||||
if ( !isset( $this->params ) ) {
|
||||
$blob = $this->getRawParameters();
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$params = LogEntryBase::extractParams( $blob );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $params !== false ) {
|
||||
$this->params = $params;
|
||||
$this->legacy = false;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Collection of static functions for sending mail
|
||||
|
|
@ -390,13 +391,13 @@ class UserMailer {
|
|||
|
||||
$recips = array_map( 'strval', $to );
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
|
||||
// Create the mail object using the Mail::factory method
|
||||
$mail_object = Mail::factory( 'smtp', $smtp );
|
||||
if ( PEAR::isError( $mail_object ) ) {
|
||||
wfDebug( "PEAR::Mail factory failed: " . $mail_object->getMessage() );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
return Status::newFatal( 'pear-mail-error', $mail_object->getMessage() );
|
||||
}
|
||||
'@phan-var Mail_smtp $mail_object';
|
||||
|
|
@ -417,11 +418,11 @@ class UserMailer {
|
|||
$status = self::sendWithPear( $mail_object, $chunk, $headers, $body );
|
||||
// FIXME : some chunks might be sent while others are not!
|
||||
if ( !$status->isOK() ) {
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
return Status::newGood();
|
||||
} else {
|
||||
// PHP mail()
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Shell\Shell;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Support for detecting/validating DjVu image files and getting
|
||||
|
|
@ -123,9 +124,9 @@ class DjVuImage {
|
|||
}
|
||||
|
||||
private function getInfo() {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$file = fopen( $this->mFilename, 'rb' );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $file === false ) {
|
||||
wfDebug( __METHOD__ . ": missing or failed file read" );
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
* @file
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Class to extract and validate Exif data from jpeg (and possibly tiff) files.
|
||||
* @ingroup Media
|
||||
|
|
@ -292,9 +294,9 @@ class Exif {
|
|||
|
||||
$this->debugFile( __FUNCTION__, true );
|
||||
if ( function_exists( 'exif_read_data' ) ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$data = exif_read_data( $this->file, 0, true );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
} else {
|
||||
throw new MWException( "Internal error: exif_read_data not present. " .
|
||||
"\$wgShowEXIF may be incorrectly set or not checked by an extension." );
|
||||
|
|
@ -474,17 +476,17 @@ class Exif {
|
|||
break;
|
||||
}
|
||||
if ( $charset ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$val = iconv( $charset, 'UTF-8//IGNORE', $val );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
} else {
|
||||
// if valid utf-8, assume that, otherwise assume windows-1252
|
||||
$valCopy = $val;
|
||||
UtfNormal\Validator::quickIsNFCVerify( $valCopy ); // validates $valCopy.
|
||||
if ( $valCopy !== $val ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$val = iconv( 'Windows-1252', 'UTF-8//IGNORE', $val );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
* @ingroup Media
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* GIF frame counter.
|
||||
*
|
||||
|
|
@ -172,9 +174,9 @@ class GIFMetadataExtractor {
|
|||
UtfNormal\Validator::quickIsNFCVerify( $dataCopy );
|
||||
|
||||
if ( $dataCopy !== $data ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$data = iconv( 'windows-1252', 'UTF-8', $data );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
|
||||
$commentCount = count( $comment );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Media
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Class for some IPTC functions.
|
||||
*
|
||||
|
|
@ -429,9 +431,9 @@ class IPTC {
|
|||
*/
|
||||
private static function convIPTCHelper( $data, $charset ) {
|
||||
if ( $charset ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$data = iconv( $charset, "UTF-8//IGNORE", $data );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $data === false ) {
|
||||
$data = "";
|
||||
wfDebugLog( 'iptc', __METHOD__ . " Error converting iptc data charset $charset to utf-8" );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup Media
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Media handler abstract base class for images
|
||||
*
|
||||
|
|
@ -221,9 +223,9 @@ abstract class ImageHandler extends MediaHandler {
|
|||
}
|
||||
|
||||
public function getImageSize( $image, $path ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$gis = getimagesize( $path );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
return $gis;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
* @ingroup Media
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\XMPReader\Reader as XMPReader;
|
||||
|
||||
/**
|
||||
|
|
@ -103,9 +104,9 @@ class JpegMetadataExtractor {
|
|||
// turns $com to valid utf-8.
|
||||
// thus if no change, its utf-8, otherwise its something else.
|
||||
if ( $com !== $oldCom ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$com = $oldCom = iconv( 'windows-1252', 'UTF-8//IGNORE', $oldCom );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
// Try it again, if its still not a valid string, then probably
|
||||
// binary junk or some really weird encoding, so don't extract.
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
* @ingroup Media
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* PNG frame counter.
|
||||
*
|
||||
|
|
@ -201,9 +203,9 @@ class PNGMetadataExtractor {
|
|||
// if compressed
|
||||
if ( $items[2] == "\x01" ) {
|
||||
if ( function_exists( 'gzuncompress' ) && $items[4] === "\x00" ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$items[5] = gzuncompress( $items[5] );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $items[5] === false ) {
|
||||
// decompression failed
|
||||
|
|
@ -242,9 +244,9 @@ class PNGMetadataExtractor {
|
|||
// Don't recognize chunk, so skip.
|
||||
continue;
|
||||
}
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$content = iconv( 'ISO-8859-1', 'UTF-8', $content );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $content === false ) {
|
||||
wfDebug( __METHOD__ . ": Read error (error with iconv)" );
|
||||
|
|
@ -281,9 +283,9 @@ class PNGMetadataExtractor {
|
|||
continue;
|
||||
}
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$content = gzuncompress( $content );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $content === false ) {
|
||||
// decompression failed
|
||||
|
|
@ -291,9 +293,9 @@ class PNGMetadataExtractor {
|
|||
continue;
|
||||
}
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$content = iconv( 'ISO-8859-1', 'UTF-8', $content );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $content === false ) {
|
||||
wfDebug( __METHOD__ . ": iconv error in zTXt chunk" );
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* @ingroup Media
|
||||
|
|
@ -99,7 +100,7 @@ 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.
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
try {
|
||||
$this->read();
|
||||
} catch ( Exception $e ) {
|
||||
|
|
@ -108,7 +109,7 @@ class SVGReader {
|
|||
throw $e;
|
||||
} finally {
|
||||
libxml_disable_entity_loader( $oldDisable );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Shell\Shell;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
use Wikimedia\RequestTimeout\TimeoutException;
|
||||
use Wikimedia\ScopedCallback;
|
||||
|
||||
|
|
@ -277,10 +278,10 @@ class SvgHandler extends ImageHandler {
|
|||
$ok = symlink( $srcPath, $lnPath );
|
||||
/** @noinspection PhpUnusedLocalVariableInspection */
|
||||
$cleaner = new ScopedCallback( static function () use ( $tmpDir, $lnPath ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
unlink( $lnPath );
|
||||
rmdir( $tmpDir );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
} );
|
||||
if ( !$ok ) {
|
||||
wfDebugLog( 'thumbnail',
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Search engine hook for MySQL
|
||||
|
|
@ -58,9 +59,9 @@ class SearchMySQL extends SearchDatabase {
|
|||
$contLang = $services->getContentLanguage();
|
||||
$langConverter = $services->getLanguageConverterFactory()->getLanguageConverter( $contLang );
|
||||
foreach ( $m as $bits ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $nonQuoted != '' ) {
|
||||
$term = $nonQuoted;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Search engine hook for SQLite
|
||||
|
|
@ -61,9 +62,9 @@ class SearchSqlite extends SearchDatabase {
|
|||
if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
|
||||
$filteredText, $m, PREG_SET_ORDER ) ) {
|
||||
foreach ( $m as $bits ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
list( /* all */, $modifier, $term, $nonQuoted, $wildcard ) = $bits;
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $nonQuoted != '' ) {
|
||||
$term = $nonQuoted;
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ namespace MediaWiki\Session;
|
|||
use BagOStuff;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\Log\NullLogger;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Adapter for PHP's session handling
|
||||
|
|
@ -126,7 +127,7 @@ class PHPSessionHandler implements \SessionHandlerInterface {
|
|||
session_write_close();
|
||||
|
||||
try {
|
||||
\Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
|
||||
// Tell PHP not to mess with cookies itself
|
||||
ini_set( 'session.use_cookies', 0 );
|
||||
|
|
@ -145,7 +146,7 @@ class PHPSessionHandler implements \SessionHandlerInterface {
|
|||
// shutdown function.
|
||||
session_set_save_handler( self::$instance, true );
|
||||
} finally {
|
||||
\Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
namespace MediaWiki\Sparql;
|
||||
|
||||
use MediaWiki\Http\HttpRequestFactory;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Simple SPARQL client
|
||||
|
|
@ -169,9 +170,9 @@ class SparqlClient {
|
|||
throw new SparqlException( 'HTTP error: ' . $status->getWikiText( false, false, 'en' ) );
|
||||
}
|
||||
$result = $request->getContent();
|
||||
\Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$data = json_decode( $result, true );
|
||||
\Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $data === null || $data === false ) {
|
||||
throw new SparqlException( "HTTP request failed, response:\n" .
|
||||
substr( $result, 1024 ) );
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* A form to make the database readonly (eg for maintenance purposes).
|
||||
*
|
||||
|
|
@ -76,9 +78,9 @@ class SpecialLockdb extends FormSpecialPage {
|
|||
return Status::newFatal( 'locknoconfirm' );
|
||||
}
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$fp = fopen( $this->getConfig()->get( 'ReadOnlyFile' ), 'w' );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $fp === false ) {
|
||||
# This used to show a file not found error, but the likeliest reason for fopen()
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@
|
|||
* @ingroup SpecialPage
|
||||
*/
|
||||
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Implements Special:Unlockdb
|
||||
*
|
||||
|
|
@ -69,9 +71,9 @@ class SpecialUnlockdb extends FormSpecialPage {
|
|||
}
|
||||
|
||||
$readOnlyFile = $this->getConfig()->get( 'ReadOnlyFile' );
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$res = unlink( $readOnlyFile );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $res ) {
|
||||
return Status::newGood();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use MediaWiki\Permissions\Authority;
|
|||
use MediaWiki\Permissions\PermissionStatus;
|
||||
use MediaWiki\Shell\Shell;
|
||||
use MediaWiki\User\UserIdentity;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* @defgroup Upload Upload related
|
||||
|
|
@ -1466,9 +1467,9 @@ abstract class UploadBase {
|
|||
// detect the encoding in case is specifies an encoding not whitelisted in self::$safeXmlEncodings
|
||||
$attemptEncodings = [ 'UTF-16', 'UTF-16BE', 'UTF-32', 'UTF-32BE' ];
|
||||
foreach ( $attemptEncodings as $encoding ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$str = iconv( $encoding, 'UTF-8', $contents );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
if ( $str != '' && preg_match( "!<\?xml\b(.*?)\?>!si", $str, $matches ) ) {
|
||||
if ( preg_match( $encodingRegex, $matches[1], $encMatch )
|
||||
&& !in_array( strtoupper( $encMatch[1] ), self::$safeXmlEncodings )
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
use MediaWiki\Shell\Shell;
|
||||
use Wikimedia\AtEase\AtEase;
|
||||
|
||||
/**
|
||||
* Utility class to find executables in likely places
|
||||
|
|
@ -62,9 +63,9 @@ class ExecutableFinder {
|
|||
protected static function findExecutable( $path, $name, $versionInfo = false ) {
|
||||
$command = $path . DIRECTORY_SEPARATOR . $name;
|
||||
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
$file_exists = is_executable( $command );
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
|
||||
if ( $file_exists ) {
|
||||
if ( !$versionInfo ) {
|
||||
|
|
|
|||
|
|
@ -808,7 +808,7 @@ TEXT
|
|||
}
|
||||
|
||||
private function closeSpawn() {
|
||||
Wikimedia\suppressWarnings();
|
||||
AtEase::suppressWarnings();
|
||||
if ( $this->spawnRead ) {
|
||||
fclose( $this->spawnRead );
|
||||
}
|
||||
|
|
@ -825,7 +825,7 @@ TEXT
|
|||
pclose( $this->spawnProc );
|
||||
}
|
||||
$this->spawnProc = false;
|
||||
Wikimedia\restoreWarnings();
|
||||
AtEase::restoreWarnings();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue