Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNull
Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
This commit is contained in:
parent
41f8acfd52
commit
0958a0bce4
216 changed files with 632 additions and 633 deletions
|
|
@ -1,7 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ruleset name="MediaWiki">
|
||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
||||
<exclude name="Generic.CodeAnalysis.EmptyPHPStatement.SemicolonWithoutCodeDetected" />
|
||||
<exclude name="Generic.ControlStructures.InlineControlStructure" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPrivate" />
|
||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
||||
|
|
@ -14,9 +13,7 @@
|
|||
<exclude name="MediaWiki.Usage.DbrQueryUsage.DbrQueryFound" />
|
||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgContLang" />
|
||||
<exclude name="MediaWiki.Usage.DeprecatedGlobalVariables.Deprecated$wgTitle" />
|
||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.isset" />
|
||||
<exclude name="MediaWiki.Usage.ForbiddenFunctions.passthru" />
|
||||
<exclude name="MediaWiki.Usage.IsNull.IsNull" />
|
||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
|
||||
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.SingleSpaceBeforeSingleLineComment" />
|
||||
<exclude name="PSR12.Properties.ConstantVisibility.NotFound" />
|
||||
|
|
|
|||
|
|
@ -537,7 +537,7 @@ class EditPage {
|
|||
* @return Title
|
||||
*/
|
||||
public function getContextTitle() {
|
||||
if ( is_null( $this->mContextTitle ) ) {
|
||||
if ( $this->mContextTitle === null ) {
|
||||
wfDeprecated( get_class( $this ) . '::getContextTitle called with no title set', '1.32' );
|
||||
global $wgTitle;
|
||||
return $wgTitle;
|
||||
|
|
@ -1028,7 +1028,7 @@ class EditPage {
|
|||
$this->allowSelfRedirect = $request->getBool( 'wpIgnoreSelfRedirect' );
|
||||
|
||||
$changeTags = $request->getVal( 'wpChangeTags' );
|
||||
if ( is_null( $changeTags ) || $changeTags === '' ) {
|
||||
if ( $changeTags === null || $changeTags === '' ) {
|
||||
$this->changeTags = [];
|
||||
} else {
|
||||
$this->changeTags = array_filter( array_map( 'trim', explode( ',',
|
||||
|
|
@ -1244,7 +1244,7 @@ class EditPage {
|
|||
# Sanity check, make sure it's the right page,
|
||||
# the revisions exist and they were not deleted.
|
||||
# Otherwise, $content will be left as-is.
|
||||
if ( !is_null( $undorev ) && !is_null( $oldrev ) &&
|
||||
if ( $undorev !== null && $oldrev !== null &&
|
||||
!$undorev->isDeleted( RevisionRecord::DELETED_TEXT ) &&
|
||||
!$oldrev->isDeleted( RevisionRecord::DELETED_TEXT )
|
||||
) {
|
||||
|
|
@ -2233,7 +2233,7 @@ ERROR;
|
|||
);
|
||||
}
|
||||
|
||||
if ( is_null( $content ) ) {
|
||||
if ( $content === null ) {
|
||||
wfDebug( __METHOD__ . ": activating conflict; section replace failed.\n" );
|
||||
$this->isConflict = true;
|
||||
$content = $textbox_content; // do not try to merge here!
|
||||
|
|
@ -2448,7 +2448,7 @@ ERROR;
|
|||
$baseRevision = $this->getBaseRevision();
|
||||
$baseContent = $baseRevision ? $baseRevision->getContent() : null;
|
||||
|
||||
if ( is_null( $baseContent ) ) {
|
||||
if ( $baseContent === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2456,7 +2456,7 @@ ERROR;
|
|||
$currentRevision = Revision::loadFromTitle( $db, $this->mTitle );
|
||||
$currentContent = $currentRevision ? $currentRevision->getContent() : null;
|
||||
|
||||
if ( is_null( $currentContent ) ) {
|
||||
if ( $currentContent === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -2658,7 +2658,7 @@ ERROR;
|
|||
$out->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
|
||||
[ 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ] );
|
||||
} elseif (
|
||||
!is_null( $block ) &&
|
||||
$block !== null &&
|
||||
$block->getType() != DatabaseBlock::TYPE_AUTO &&
|
||||
( $block->isSitewide() || $user->isBlockedFrom( $this->mTitle ) )
|
||||
) {
|
||||
|
|
@ -4097,7 +4097,7 @@ ERROR;
|
|||
protected function getPreviewParserOptions() {
|
||||
$parserOptions = $this->page->makeParserOptions( $this->context );
|
||||
$parserOptions->setIsPreview( true );
|
||||
$parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' );
|
||||
$parserOptions->setIsSectionPreview( $this->section !== null && $this->section !== '' );
|
||||
$parserOptions->enableLimitReport();
|
||||
|
||||
// XXX: we could call $parserOptions->setCurrentRevisionCallback here to force the
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class FeedUtils {
|
|||
}
|
||||
} else {
|
||||
$rev = Revision::newFromId( $newid );
|
||||
if ( $wgFeedDiffCutoff <= 0 || is_null( $rev ) ) {
|
||||
if ( $wgFeedDiffCutoff <= 0 || $rev === null ) {
|
||||
$newContent = ContentHandler::getForTitle( $title )->makeEmptyContent();
|
||||
} else {
|
||||
$newContent = $rev->getContent();
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@ class GitInfo {
|
|||
* @return GitInfo
|
||||
*/
|
||||
public static function repo() {
|
||||
if ( is_null( self::$repo ) ) {
|
||||
if ( self::$repo === null ) {
|
||||
global $IP;
|
||||
self::$repo = new self( $IP );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ function wfArrayDiff2_cmp( $a, $b ) {
|
|||
* @throws MWException
|
||||
*/
|
||||
function wfAppendToArrayIfNotDefault( $key, $value, $default, &$changed ) {
|
||||
if ( is_null( $changed ) ) {
|
||||
if ( $changed === null ) {
|
||||
throw new MWException( 'GlobalFunctions::wfAppendToArrayIfNotDefault got null' );
|
||||
}
|
||||
if ( $default[$key] !== $value ) {
|
||||
|
|
@ -309,13 +309,13 @@ function wfRandomString( $length = 32 ) {
|
|||
function wfUrlencode( $s ) {
|
||||
static $needle;
|
||||
|
||||
if ( is_null( $s ) ) {
|
||||
if ( $s === null ) {
|
||||
// Reset $needle for testing.
|
||||
$needle = null;
|
||||
return '';
|
||||
}
|
||||
|
||||
if ( is_null( $needle ) ) {
|
||||
if ( $needle === null ) {
|
||||
$needle = [ '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F', '%7E' ];
|
||||
if ( !isset( $_SERVER['SERVER_SOFTWARE'] ) ||
|
||||
( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7' ) === false )
|
||||
|
|
@ -345,13 +345,13 @@ function wfUrlencode( $s ) {
|
|||
* @return string
|
||||
*/
|
||||
function wfArrayToCgi( $array1, $array2 = null, $prefix = '' ) {
|
||||
if ( !is_null( $array2 ) ) {
|
||||
if ( $array2 !== null ) {
|
||||
$array1 = $array1 + $array2;
|
||||
}
|
||||
|
||||
$cgi = '';
|
||||
foreach ( $array1 as $key => $value ) {
|
||||
if ( !is_null( $value ) && $value !== false ) {
|
||||
if ( $value !== null && $value !== false ) {
|
||||
if ( $cgi != '' ) {
|
||||
$cgi .= '&';
|
||||
}
|
||||
|
|
@ -722,7 +722,7 @@ function wfUrlProtocols( $includeProtocolRelative = true ) {
|
|||
// Cache return values separately based on $includeProtocolRelative
|
||||
static $withProtRel = null, $withoutProtRel = null;
|
||||
$cachedValue = $includeProtocolRelative ? $withProtRel : $withoutProtRel;
|
||||
if ( !is_null( $cachedValue ) ) {
|
||||
if ( $cachedValue !== null ) {
|
||||
return $cachedValue;
|
||||
}
|
||||
|
||||
|
|
@ -1324,7 +1324,7 @@ function wfMsgReplaceArgs( $message, $args ) {
|
|||
*/
|
||||
function wfHostname() {
|
||||
static $host;
|
||||
if ( is_null( $host ) ) {
|
||||
if ( $host === null ) {
|
||||
# Hostname overriding
|
||||
global $wgOverrideHostname;
|
||||
if ( $wgOverrideHostname !== false ) {
|
||||
|
|
@ -1388,7 +1388,7 @@ function wfReportTime( $nonce = null ) {
|
|||
function wfDebugBacktrace( $limit = 0 ) {
|
||||
static $disabled = null;
|
||||
|
||||
if ( is_null( $disabled ) ) {
|
||||
if ( $disabled === null ) {
|
||||
$disabled = !function_exists( 'debug_backtrace' );
|
||||
if ( $disabled ) {
|
||||
wfDebug( "debug_backtrace() is disabled\n" );
|
||||
|
|
@ -1605,7 +1605,7 @@ function wfEscapeWikiText( $text ) {
|
|||
*/
|
||||
function wfSetVar( &$dest, $source, $force = false ) {
|
||||
$temp = $dest;
|
||||
if ( !is_null( $source ) || $force ) {
|
||||
if ( $source !== null || $force ) {
|
||||
$dest = $source;
|
||||
}
|
||||
return $temp;
|
||||
|
|
@ -1622,7 +1622,7 @@ function wfSetVar( &$dest, $source, $force = false ) {
|
|||
*/
|
||||
function wfSetBit( &$dest, $bit, $state = true ) {
|
||||
$temp = (bool)( $dest & $bit );
|
||||
if ( !is_null( $state ) ) {
|
||||
if ( $state !== null ) {
|
||||
if ( $state ) {
|
||||
$dest |= $bit;
|
||||
} else {
|
||||
|
|
@ -1885,7 +1885,7 @@ function wfTimestamp( $outputtype = TS_UNIX, $ts = 0 ) {
|
|||
* @return string
|
||||
*/
|
||||
function wfTimestampOrNull( $outputtype = TS_UNIX, $ts = null ) {
|
||||
if ( is_null( $ts ) ) {
|
||||
if ( $ts === null ) {
|
||||
return null;
|
||||
} else {
|
||||
return wfTimestamp( $outputtype, $ts );
|
||||
|
|
@ -1972,7 +1972,7 @@ function wfMkdirParents( $dir, $mode = null, $caller = null ) {
|
|||
throw new MWException( __FUNCTION__ . " given storage path '$dir'." );
|
||||
}
|
||||
|
||||
if ( !is_null( $caller ) ) {
|
||||
if ( $caller !== null ) {
|
||||
wfDebug( "$caller: called wfMkdirParents($dir)\n" );
|
||||
}
|
||||
|
||||
|
|
@ -1982,7 +1982,7 @@ function wfMkdirParents( $dir, $mode = null, $caller = null ) {
|
|||
|
||||
$dir = str_replace( [ '\\', '/' ], DIRECTORY_SEPARATOR, $dir );
|
||||
|
||||
if ( is_null( $mode ) ) {
|
||||
if ( $mode === null ) {
|
||||
$mode = $wgDirectoryMode;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ class Html {
|
|||
$ret = '';
|
||||
foreach ( $attribs as $key => $value ) {
|
||||
// Support intuitive [ 'checked' => true/false ] form
|
||||
if ( $value === false || is_null( $value ) ) {
|
||||
if ( $value === false || $value === null ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class MagicWordArray {
|
|||
* @return array
|
||||
*/
|
||||
public function getHash() {
|
||||
if ( is_null( $this->hash ) ) {
|
||||
if ( $this->hash === null ) {
|
||||
$this->hash = [ 0 => [], 1 => [] ];
|
||||
foreach ( $this->names as $name ) {
|
||||
$magic = $this->factory->get( $name );
|
||||
|
|
@ -99,7 +99,7 @@ class MagicWordArray {
|
|||
* @return string[]
|
||||
*/
|
||||
public function getBaseRegex() : array {
|
||||
if ( is_null( $this->baseRegex ) ) {
|
||||
if ( $this->baseRegex === null ) {
|
||||
$this->baseRegex = [ 0 => '', 1 => '' ];
|
||||
$allGroups = [];
|
||||
foreach ( $this->names as $name ) {
|
||||
|
|
@ -134,7 +134,7 @@ class MagicWordArray {
|
|||
* @suppress PhanTypeArraySuspiciousNullable False positive
|
||||
*/
|
||||
public function getRegex() {
|
||||
if ( is_null( $this->regex ) ) {
|
||||
if ( $this->regex === null ) {
|
||||
$base = $this->getBaseRegex();
|
||||
$this->regex = [ '', '' ];
|
||||
if ( $this->baseRegex[0] !== '' ) {
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ class MagicWordFactory {
|
|||
* @return MagicWordArray
|
||||
*/
|
||||
public function getDoubleUnderscoreArray() {
|
||||
if ( is_null( $this->mDoubleUnderscoreArray ) ) {
|
||||
if ( $this->mDoubleUnderscoreArray === null ) {
|
||||
Hooks::run( 'GetDoubleUnderscoreIDs', [ &$this->mDoubleUnderscoreIDs ] );
|
||||
$this->mDoubleUnderscoreArray = $this->newArray( $this->mDoubleUnderscoreIDs );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,14 +85,14 @@ class MediaWiki {
|
|||
$ret = Title::newFromURL( $title );
|
||||
// Alias NS_MEDIA page URLs to NS_FILE...we only use NS_MEDIA
|
||||
// in wikitext links to tell Parser to make a direct file link
|
||||
if ( !is_null( $ret ) && $ret->getNamespace() == NS_MEDIA ) {
|
||||
if ( $ret !== null && $ret->getNamespace() == NS_MEDIA ) {
|
||||
$ret = Title::makeTitle( NS_FILE, $ret->getDBkey() );
|
||||
}
|
||||
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
|
||||
// Check variant links so that interwiki links don't have to worry
|
||||
// about the possible different language variants
|
||||
if (
|
||||
$contLang->hasVariants() && !is_null( $ret ) && $ret->getArticleID() == 0
|
||||
$contLang->hasVariants() && $ret !== null && $ret->getArticleID() == 0
|
||||
) {
|
||||
$contLang->findVariantLink( $title, $ret );
|
||||
}
|
||||
|
|
@ -188,7 +188,7 @@ class MediaWiki {
|
|||
Hooks::run( 'BeforeInitialize', [ &$title, &$unused, &$output, &$user, $request, $this ] );
|
||||
|
||||
// Invalid titles. T23776: The interwikis must redirect even if the page name is empty.
|
||||
if ( is_null( $title ) || ( $title->getDBkey() == '' && !$title->isExternal() )
|
||||
if ( $title === null || ( $title->getDBkey() == '' && !$title->isExternal() )
|
||||
|| $title->isSpecial( 'Badtitle' )
|
||||
) {
|
||||
$this->context->setTitle( SpecialPage::getTitleFor( 'Badtitle' ) );
|
||||
|
|
|
|||
|
|
@ -1686,7 +1686,7 @@ class OutputPage extends ContextSource {
|
|||
* @return mixed Previous value
|
||||
*/
|
||||
public function setRevisionId( $revid ) {
|
||||
$val = is_null( $revid ) ? null : intval( $revid );
|
||||
$val = $revid === null ? null : intval( $revid );
|
||||
return wfSetVar( $this->mRevisionId, $val, true );
|
||||
}
|
||||
|
||||
|
|
@ -2131,7 +2131,7 @@ class OutputPage extends ContextSource {
|
|||
* @return ParserOutput
|
||||
*/
|
||||
private function parseInternal( $text, $title, $linestart, $tidy, $interface, $language ) {
|
||||
if ( is_null( $title ) ) {
|
||||
if ( $title === null ) {
|
||||
throw new MWException( 'Empty $mTitle in ' . __METHOD__ );
|
||||
}
|
||||
|
||||
|
|
@ -3183,7 +3183,7 @@ class OutputPage extends ContextSource {
|
|||
* @return ResourceLoader
|
||||
*/
|
||||
public function getResourceLoader() {
|
||||
if ( is_null( $this->mResourceLoader ) ) {
|
||||
if ( $this->mResourceLoader === null ) {
|
||||
// Lazy-initialise as needed
|
||||
$this->mResourceLoader = MediaWikiServices::getInstance()->getResourceLoader();
|
||||
}
|
||||
|
|
@ -3881,7 +3881,7 @@ class OutputPage extends ContextSource {
|
|||
|
||||
if ( isset( $options['media'] ) ) {
|
||||
$media = self::transformCssMedia( $options['media'] );
|
||||
if ( is_null( $media ) ) {
|
||||
if ( $media === null ) {
|
||||
return '';
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ class PathRouter {
|
|||
$this->sortByWeight();
|
||||
|
||||
$matches = $this->internalParse( $path );
|
||||
if ( is_null( $matches ) ) {
|
||||
if ( $matches === null ) {
|
||||
// Try with the normalized path (T100782)
|
||||
$path = wfRemoveDotSegments( $path );
|
||||
$path = preg_replace( '#/+#', '/', $path );
|
||||
|
|
@ -283,7 +283,7 @@ class PathRouter {
|
|||
|
||||
foreach ( $this->patterns as $pattern ) {
|
||||
$matches = self::extractTitle( $path, $pattern );
|
||||
if ( !is_null( $matches ) ) {
|
||||
if ( $matches !== null ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -394,7 +394,7 @@ class PathRouter {
|
|||
|
||||
$replacer = function ( $m ) use ( $pathMatches, $key, &$error ) {
|
||||
if ( $m[1] == "key" ) {
|
||||
if ( is_null( $key ) ) {
|
||||
if ( $key === null ) {
|
||||
$error = true;
|
||||
|
||||
return '';
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ class PageSourceHandler extends SimpleHandler {
|
|||
* @return RevisionRecord|bool latest revision or false if unable to retrieve revision
|
||||
*/
|
||||
private function getRevision() {
|
||||
if ( is_null( $this->revision ) ) {
|
||||
if ( $this->revision === null ) {
|
||||
$title = $this->getTitle();
|
||||
if ( $title && $title->getArticleID() ) {
|
||||
$this->revision = $this->revisionLookup->getKnownCurrentRevision( $title );
|
||||
|
|
@ -188,7 +188,7 @@ class PageSourceHandler extends SimpleHandler {
|
|||
* @return Title|bool Title or false if unable to retrieve title
|
||||
*/
|
||||
private function getTitle() {
|
||||
if ( is_null( $this->titleObject ) ) {
|
||||
if ( $this->titleObject === null ) {
|
||||
$this->titleObject = Title::newFromText( $this->getValidatedParams()['title'] ) ?? false;
|
||||
}
|
||||
return $this->titleObject;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class MainSlotRoleHandler extends SlotRoleHandler {
|
|||
|
||||
// Hook can determine default model
|
||||
$title = Title::newFromLinkTarget( $page );
|
||||
if ( !Hooks::run( 'ContentHandlerDefaultModelFor', [ $title, &$model ] ) && !is_null( $model ) ) {
|
||||
if ( !Hooks::run( 'ContentHandlerDefaultModelFor', [ $title, &$model ] ) && $model !== null ) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ class MainSlotRoleHandler extends SlotRoleHandler {
|
|||
}
|
||||
|
||||
// Is this wikitext, according to $wgNamespaceContentModels or the DefaultModelFor hook?
|
||||
$isWikitext = is_null( $model ) || $model == CONTENT_MODEL_WIKITEXT;
|
||||
$isWikitext = $model === null || $model == CONTENT_MODEL_WIKITEXT;
|
||||
$isWikitext = $isWikitext && !$isCodePage && !$isCodeSubpage;
|
||||
|
||||
if ( !$isWikitext ) {
|
||||
|
|
|
|||
|
|
@ -691,14 +691,14 @@ wfMemoryLimit( $wgMemoryLimit );
|
|||
* that happens whenever you use a date function without the timezone being
|
||||
* explicitly set. Inspired by phpMyAdmin's treatment of the problem.
|
||||
*/
|
||||
if ( is_null( $wgLocaltimezone ) ) {
|
||||
if ( $wgLocaltimezone === null ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
$wgLocaltimezone = date_default_timezone_get();
|
||||
Wikimedia\restoreWarnings();
|
||||
}
|
||||
|
||||
date_default_timezone_set( $wgLocaltimezone );
|
||||
if ( is_null( $wgLocalTZoffset ) ) {
|
||||
if ( $wgLocalTZoffset === null ) {
|
||||
$wgLocalTZoffset = (int)date( 'Z' ) / 60;
|
||||
}
|
||||
// The part after the System| is ignored, but rest of MW fills it
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ class SiteConfiguration {
|
|||
}
|
||||
// Do suffix settings
|
||||
$suffix = $params['suffix'];
|
||||
if ( !is_null( $suffix ) ) {
|
||||
if ( $suffix !== null ) {
|
||||
if ( array_key_exists( $suffix, $thisSetting ) ) {
|
||||
if ( is_array( $retval ) && is_array( $thisSetting[$suffix] ) ) {
|
||||
$retval = self::arrayMerge( $retval, $thisSetting[$suffix] );
|
||||
|
|
@ -261,7 +261,7 @@ class SiteConfiguration {
|
|||
} while ( false );
|
||||
}
|
||||
|
||||
if ( !is_null( $retval ) && count( $params['params'] ) ) {
|
||||
if ( $retval !== null && count( $params['params'] ) ) {
|
||||
foreach ( $params['params'] as $key => $value ) {
|
||||
$retval = $this->doReplace( '$' . $key, $value, $retval );
|
||||
}
|
||||
|
|
@ -314,7 +314,7 @@ class SiteConfiguration {
|
|||
if ( $append && is_array( $value ) && is_array( $GLOBALS[$var] ) ) {
|
||||
$value = self::arrayMerge( $value, $GLOBALS[$var] );
|
||||
}
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
$localSettings[$var] = $value;
|
||||
}
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ class SiteConfiguration {
|
|||
$params = [], $wikiTags = []
|
||||
) {
|
||||
$value = $this->get( $setting, $wiki, $suffix, $params, $wikiTags );
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
$var = $value;
|
||||
}
|
||||
}
|
||||
|
|
@ -382,7 +382,7 @@ class SiteConfiguration {
|
|||
*/
|
||||
public function extractGlobalSetting( $setting, $wiki, $params ) {
|
||||
$value = $this->getSetting( $setting, $wiki, $params );
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
if ( substr( $setting, 0, 1 ) == '+' && is_array( $value ) ) {
|
||||
$setting = substr( $setting, 1 );
|
||||
if ( is_array( $GLOBALS[$setting] ) ) {
|
||||
|
|
@ -462,7 +462,7 @@ class SiteConfiguration {
|
|||
protected function mergeParams( $wiki, $suffix, array $params, array $wikiTags ) {
|
||||
$ret = $this->getWikiParams( $wiki );
|
||||
|
||||
if ( is_null( $ret['suffix'] ) ) {
|
||||
if ( $ret['suffix'] === null ) {
|
||||
$ret['suffix'] = $suffix;
|
||||
}
|
||||
|
||||
|
|
@ -471,10 +471,10 @@ class SiteConfiguration {
|
|||
$ret['params'] += $params;
|
||||
|
||||
// Automatically fill that ones if needed
|
||||
if ( !isset( $ret['params']['lang'] ) && !is_null( $ret['lang'] ) ) {
|
||||
if ( !isset( $ret['params']['lang'] ) && $ret['lang'] !== null ) {
|
||||
$ret['params']['lang'] = $ret['lang'];
|
||||
}
|
||||
if ( !isset( $ret['params']['site'] ) && !is_null( $ret['suffix'] ) ) {
|
||||
if ( !isset( $ret['params']['site'] ) && $ret['suffix'] !== null ) {
|
||||
$ret['params']['site'] = $ret['suffix'];
|
||||
}
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ class SiteConfiguration {
|
|||
public function siteFromDB( $wiki ) {
|
||||
// Allow override
|
||||
$def = $this->getWikiParams( $wiki );
|
||||
if ( !is_null( $def['suffix'] ) && !is_null( $def['lang'] ) ) {
|
||||
if ( $def['suffix'] !== null && $def['lang'] !== null ) {
|
||||
return [ $def['suffix'], $def['lang'] ];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4166,7 +4166,7 @@ class Title implements LinkTarget, IDBAccessObject {
|
|||
*/
|
||||
Hooks::run( 'TitleIsAlwaysKnown', [ $this, &$isKnown ] );
|
||||
|
||||
if ( !is_null( $isKnown ) ) {
|
||||
if ( $isKnown !== null ) {
|
||||
return $isKnown;
|
||||
}
|
||||
|
||||
|
|
@ -4454,7 +4454,7 @@ class Title implements LinkTarget, IDBAccessObject {
|
|||
} else {
|
||||
$where[] = 'rd_interwiki = ' . $dbr->addQuotes( '' ) . ' OR rd_interwiki IS NULL';
|
||||
}
|
||||
if ( !is_null( $ns ) ) {
|
||||
if ( $ns !== null ) {
|
||||
$where['page_namespace'] = $ns;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -470,7 +470,7 @@ class WebRequest {
|
|||
} else {
|
||||
$val = $default;
|
||||
}
|
||||
if ( is_null( $val ) ) {
|
||||
if ( $val === null ) {
|
||||
return $val;
|
||||
} else {
|
||||
return (string)$val;
|
||||
|
|
@ -492,7 +492,7 @@ class WebRequest {
|
|||
if ( is_array( $val ) ) {
|
||||
$val = $default;
|
||||
}
|
||||
if ( is_null( $val ) ) {
|
||||
if ( $val === null ) {
|
||||
return $val;
|
||||
} else {
|
||||
return (string)$val;
|
||||
|
|
@ -539,7 +539,7 @@ class WebRequest {
|
|||
*/
|
||||
public function getArray( $name, $default = null ) {
|
||||
$val = $this->getGPCVal( $this->data, $name, $default );
|
||||
if ( is_null( $val ) ) {
|
||||
if ( $val === null ) {
|
||||
return null;
|
||||
} else {
|
||||
return (array)$val;
|
||||
|
|
@ -678,7 +678,7 @@ class WebRequest {
|
|||
$retVal = [];
|
||||
foreach ( $names as $name ) {
|
||||
$value = $this->getGPCVal( $this->data, $name, null );
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
$retVal[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ class Xml {
|
|||
$allowShortTag = true
|
||||
) {
|
||||
$out = '<' . $element;
|
||||
if ( !is_null( $attribs ) ) {
|
||||
if ( $attribs !== null ) {
|
||||
$out .= self::expandAttributes( $attribs );
|
||||
}
|
||||
if ( is_null( $contents ) ) {
|
||||
if ( $contents === null ) {
|
||||
$out .= '>';
|
||||
} elseif ( $allowShortTag && $contents === '' ) {
|
||||
$out .= ' />';
|
||||
|
|
@ -66,7 +66,7 @@ class Xml {
|
|||
*/
|
||||
public static function expandAttributes( $attribs ) {
|
||||
$out = '';
|
||||
if ( is_null( $attribs ) ) {
|
||||
if ( $attribs === null ) {
|
||||
return null;
|
||||
} elseif ( is_array( $attribs ) ) {
|
||||
foreach ( $attribs as $name => $val ) {
|
||||
|
|
@ -144,10 +144,10 @@ class Xml {
|
|||
global $wgLang;
|
||||
$options = [];
|
||||
$data = new XmlSelect( 'month', $id, $selected );
|
||||
if ( is_null( $selected ) ) {
|
||||
if ( $selected === null ) {
|
||||
$selected = '';
|
||||
}
|
||||
if ( !is_null( $allmonths ) ) {
|
||||
if ( $allmonths !== null ) {
|
||||
$options[wfMessage( 'monthsall' )->text()] = $allmonths;
|
||||
}
|
||||
for ( $i = 1; $i < 13; $i++ ) {
|
||||
|
|
@ -483,7 +483,7 @@ class Xml {
|
|||
*/
|
||||
public static function option( $text, $value = null, $selected = false,
|
||||
$attribs = [] ) {
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
$attribs['value'] = $value;
|
||||
}
|
||||
if ( $selected ) {
|
||||
|
|
|
|||
|
|
@ -1013,7 +1013,7 @@ abstract class ApiBase extends ContextSource {
|
|||
* @return bool
|
||||
*/
|
||||
private function parameterNotEmpty( $x ) {
|
||||
return !is_null( $x ) && $x !== false;
|
||||
return $x !== null && $x !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1108,7 +1108,7 @@ abstract class ApiBase extends ContextSource {
|
|||
return true;
|
||||
}
|
||||
# If no user option was passed, use watchdefault and watchcreations
|
||||
if ( is_null( $userOption ) ) {
|
||||
if ( $userOption === null ) {
|
||||
return $this->getUser()->getBoolOption( 'watchdefault' ) ||
|
||||
$this->getUser()->getBoolOption( 'watchcreations' ) && !$titleObj->exists();
|
||||
}
|
||||
|
|
@ -1291,14 +1291,14 @@ abstract class ApiBase extends ContextSource {
|
|||
|
||||
if ( is_array( $value ) ) {
|
||||
$value = array_map( 'intval', $value );
|
||||
if ( !is_null( $min ) || !is_null( $max ) ) {
|
||||
if ( $min !== null || $max !== null ) {
|
||||
foreach ( $value as &$v ) {
|
||||
$this->validateLimit( $paramName, $v, $min, $max, null, $enforceLimits );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$value = (int)$value;
|
||||
if ( !is_null( $min ) || !is_null( $max ) ) {
|
||||
if ( $min !== null || $max !== null ) {
|
||||
$this->validateLimit( $paramName, $value, $min, $max, null, $enforceLimits );
|
||||
}
|
||||
}
|
||||
|
|
@ -1575,7 +1575,7 @@ abstract class ApiBase extends ContextSource {
|
|||
protected function validateLimit( $paramName, &$value, $min, $max, $botMax = null,
|
||||
$enforceLimits = false
|
||||
) {
|
||||
if ( !is_null( $min ) && $value < $min ) {
|
||||
if ( $min !== null && $value < $min ) {
|
||||
$msg = ApiMessage::create(
|
||||
[ 'apierror-integeroutofrange-belowminimum',
|
||||
$this->encodeParamName( $paramName ), $min, $value ],
|
||||
|
|
@ -1595,8 +1595,8 @@ abstract class ApiBase extends ContextSource {
|
|||
|
||||
// Optimization: do not check user's bot status unless really needed -- skips db query
|
||||
// assumes $botMax >= $max
|
||||
if ( !is_null( $max ) && $value > $max ) {
|
||||
if ( !is_null( $botMax ) && $this->getMain()->canApiHighLimits() ) {
|
||||
if ( $max !== null && $value > $max ) {
|
||||
if ( $botMax !== null && $this->getMain()->canApiHighLimits() ) {
|
||||
if ( $value > $botMax ) {
|
||||
$msg = ApiMessage::create(
|
||||
[ 'apierror-integeroutofrange-abovebotmax',
|
||||
|
|
@ -1764,7 +1764,7 @@ abstract class ApiBase extends ContextSource {
|
|||
* @return User
|
||||
*/
|
||||
public function getWatchlistUser( $params ) {
|
||||
if ( !is_null( $params['owner'] ) && !is_null( $params['token'] ) ) {
|
||||
if ( $params['owner'] !== null && $params['token'] !== null ) {
|
||||
$user = User::newFromName( $params['owner'], false );
|
||||
if ( !( $user && $user->getId() ) ) {
|
||||
$this->dieWithError(
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ class ApiDelete extends ApiBase {
|
|||
$title = $page->getTitle();
|
||||
|
||||
// Auto-generate a summary, if necessary
|
||||
if ( is_null( $reason ) ) {
|
||||
if ( $reason === null ) {
|
||||
// Need to pass a throwaway variable because generateReason expects
|
||||
// a reference
|
||||
$hasHistory = false;
|
||||
|
|
@ -173,7 +173,7 @@ class ApiDelete extends ApiBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $reason ) ) { // Log and RC don't like null reasons
|
||||
if ( $reason === null ) { // Log and RC don't like null reasons
|
||||
$reason = '';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class ApiEditPage extends ApiBase {
|
|||
);
|
||||
|
||||
$toMD5 = $params['text'];
|
||||
if ( !is_null( $params['appendtext'] ) || !is_null( $params['prependtext'] ) ) {
|
||||
if ( $params['appendtext'] !== null || $params['prependtext'] !== null ) {
|
||||
$content = $pageObj->getContent();
|
||||
|
||||
if ( !$content ) {
|
||||
|
|
@ -170,7 +170,7 @@ class ApiEditPage extends ApiBase {
|
|||
$this->dieWithError( [ 'apierror-appendnotsupported', $modelName ] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['section'] ) ) {
|
||||
if ( $params['section'] !== null ) {
|
||||
if ( !$contentHandler->supportsSections() ) {
|
||||
$modelName = $contentHandler->getModelID();
|
||||
$this->dieWithError( [ 'apierror-sectionsnotsupported', $modelName ] );
|
||||
|
|
@ -209,14 +209,14 @@ class ApiEditPage extends ApiBase {
|
|||
$undoafterRev = Revision::newFromId( $params['undoafter'] );
|
||||
}
|
||||
$undoRev = Revision::newFromId( $params['undo'] );
|
||||
if ( is_null( $undoRev ) || $undoRev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
|
||||
if ( $undoRev === null || $undoRev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
|
||||
$this->dieWithError( [ 'apierror-nosuchrevid', $params['undo'] ] );
|
||||
}
|
||||
|
||||
if ( $params['undoafter'] == 0 ) {
|
||||
$undoafterRev = $undoRev->getPrevious();
|
||||
}
|
||||
if ( is_null( $undoafterRev ) || $undoafterRev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
|
||||
if ( $undoafterRev === null || $undoafterRev->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
|
||||
$this->dieWithError( [ 'apierror-nosuchrevid', $params['undoafter'] ] );
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ class ApiEditPage extends ApiBase {
|
|||
// If no summary was given and we only undid one rev,
|
||||
// use an autosummary
|
||||
|
||||
if ( is_null( $params['summary'] ) ) {
|
||||
if ( $params['summary'] === null ) {
|
||||
$nextRev = MediaWikiServices::getInstance()->getRevisionLookup()
|
||||
->getNextRevision( $undoafterRev->getRevisionRecord() );
|
||||
if ( $nextRev && $nextRev->getId() == $params['undo'] ) {
|
||||
|
|
@ -268,7 +268,7 @@ class ApiEditPage extends ApiBase {
|
|||
}
|
||||
|
||||
// See if the MD5 hash checks out
|
||||
if ( !is_null( $params['md5'] ) && md5( $toMD5 ) !== $params['md5'] ) {
|
||||
if ( $params['md5'] !== null && md5( $toMD5 ) !== $params['md5'] ) {
|
||||
$this->dieWithError( 'apierror-badmd5' );
|
||||
}
|
||||
|
||||
|
|
@ -286,11 +286,11 @@ class ApiEditPage extends ApiBase {
|
|||
'wpUnicodeCheck' => EditPage::UNICODE_CHECK,
|
||||
];
|
||||
|
||||
if ( !is_null( $params['summary'] ) ) {
|
||||
if ( $params['summary'] !== null ) {
|
||||
$requestArray['wpSummary'] = $params['summary'];
|
||||
}
|
||||
|
||||
if ( !is_null( $params['sectiontitle'] ) ) {
|
||||
if ( $params['sectiontitle'] !== null ) {
|
||||
$requestArray['wpSectionTitle'] = $params['sectiontitle'];
|
||||
}
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ class ApiEditPage extends ApiBase {
|
|||
$requestArray['wpRecreate'] = '';
|
||||
}
|
||||
|
||||
if ( !is_null( $params['section'] ) ) {
|
||||
if ( $params['section'] !== null ) {
|
||||
$section = $params['section'];
|
||||
if ( !preg_match( '/^((T-)?\d+|new)$/', $section ) ) {
|
||||
$this->dieWithError( 'apierror-invalidsection' );
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class ApiFileRevert extends ApiBase {
|
|||
protected function validateParameters() {
|
||||
// Validate the input title
|
||||
$title = Title::makeTitleSafe( NS_FILE, $this->params['filename'] );
|
||||
if ( is_null( $title ) ) {
|
||||
if ( $title === null ) {
|
||||
$this->dieWithError(
|
||||
[ 'apierror-invalidtitle', wfEscapeWikiText( $this->params['filename'] ) ]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class ApiFormatXml extends ApiFormatBase {
|
|||
$this->mXslt = $params['xslt'];
|
||||
|
||||
$this->printText( '<?xml version="1.0"?>' );
|
||||
if ( !is_null( $this->mXslt ) ) {
|
||||
if ( $this->mXslt !== null ) {
|
||||
$this->addXslt();
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ class ApiFormatXml extends ApiFormatBase {
|
|||
|
||||
protected function addXslt() {
|
||||
$nt = Title::newFromText( $this->mXslt );
|
||||
if ( is_null( $nt ) || !$nt->exists() ) {
|
||||
if ( $nt === null || !$nt->exists() ) {
|
||||
$this->addWarning( 'apiwarn-invalidxmlstylesheet' );
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ class ApiHelp extends ApiBase {
|
|||
$dflt = $settings[ApiBase::PARAM_DFLT] ?? null;
|
||||
if ( is_bool( $dflt ) ) {
|
||||
$settings[ApiBase::PARAM_TYPE] = 'boolean';
|
||||
} elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
|
||||
} elseif ( is_string( $dflt ) || $dflt === null ) {
|
||||
$settings[ApiBase::PARAM_TYPE] = 'string';
|
||||
} elseif ( is_int( $dflt ) ) {
|
||||
$settings[ApiBase::PARAM_TYPE] = 'integer';
|
||||
|
|
|
|||
|
|
@ -1555,7 +1555,7 @@ class ApiMain extends ApiBase {
|
|||
|
||||
// See if custom printer is used
|
||||
$this->mPrinter = $module->getCustomPrinter();
|
||||
if ( is_null( $this->mPrinter ) ) {
|
||||
if ( $this->mPrinter === null ) {
|
||||
// Create an appropriate printer
|
||||
$this->mPrinter = $this->createPrinterByName( $params['format'] );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -863,7 +863,7 @@ class ApiPageSet extends ApiBase {
|
|||
* If false, treat it as an array of [pageIDs]
|
||||
*/
|
||||
private function initFromQueryResult( $res, &$remaining = null, $processTitles = null ) {
|
||||
if ( !is_null( $remaining ) && is_null( $processTitles ) ) {
|
||||
if ( $remaining !== null && $processTitles === null ) {
|
||||
ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ class ApiParamInfo extends ApiBase {
|
|||
$dflt = $settings[ApiBase::PARAM_DFLT] ?? null;
|
||||
if ( is_bool( $dflt ) ) {
|
||||
$settings[ApiBase::PARAM_TYPE] = 'boolean';
|
||||
} elseif ( is_string( $dflt ) || is_null( $dflt ) ) {
|
||||
} elseif ( is_string( $dflt ) || $dflt === null ) {
|
||||
$settings[ApiBase::PARAM_TYPE] = 'string';
|
||||
} elseif ( is_int( $dflt ) ) {
|
||||
$settings[ApiBase::PARAM_TYPE] = 'integer';
|
||||
|
|
|
|||
|
|
@ -94,11 +94,11 @@ class ApiParse extends ApiBase {
|
|||
// Return result
|
||||
$result = $this->getResult();
|
||||
|
||||
if ( !is_null( $oldid ) || !is_null( $pageid ) || !is_null( $page ) ) {
|
||||
if ( $oldid !== null || $pageid !== null || $page !== null ) {
|
||||
if ( $this->section === 'new' ) {
|
||||
$this->dieWithError( 'apierror-invalidparammix-parse-new-section', 'invalidparammix' );
|
||||
}
|
||||
if ( !is_null( $oldid ) ) {
|
||||
if ( $oldid !== null ) {
|
||||
// Don't use the parser cache
|
||||
$rev = Revision::newFromId( $oldid );
|
||||
if ( !$rev ) {
|
||||
|
|
@ -125,7 +125,7 @@ class ApiParse extends ApiBase {
|
|||
'redirects' => '',
|
||||
];
|
||||
$pageParams = [];
|
||||
if ( !is_null( $pageid ) ) {
|
||||
if ( $pageid !== null ) {
|
||||
$reqParams['pageids'] = $pageid;
|
||||
$pageParams['pageid'] = $pageid;
|
||||
} else { // $page
|
||||
|
|
@ -141,7 +141,7 @@ class ApiParse extends ApiBase {
|
|||
foreach ( $pageSet->getRedirectTitles() as $title ) {
|
||||
$pageParams = [ 'title' => $title->getFullText() ];
|
||||
}
|
||||
} elseif ( !is_null( $pageid ) ) {
|
||||
} elseif ( $pageid !== null ) {
|
||||
$pageParams = [ 'pageid' => $pageid ];
|
||||
} else { // $page
|
||||
$pageParams = [ 'title' => $page ];
|
||||
|
|
@ -199,7 +199,7 @@ class ApiParse extends ApiBase {
|
|||
}
|
||||
|
||||
list( $popts, $reset ) = $this->makeParserOptions( $pageObj, $params );
|
||||
$textProvided = !is_null( $text );
|
||||
$textProvided = $text !== null;
|
||||
|
||||
if ( !$textProvided ) {
|
||||
if ( $titleProvided && ( $prop || $params['generatexml'] ) ) {
|
||||
|
|
@ -215,7 +215,7 @@ class ApiParse extends ApiBase {
|
|||
|
||||
// If we are parsing text, do not use the content model of the default
|
||||
// API title, but default to wikitext to keep BC.
|
||||
if ( $textProvided && !$titleProvided && is_null( $model ) ) {
|
||||
if ( $textProvided && !$titleProvided && $model === null ) {
|
||||
$model = CONTENT_MODEL_WIKITEXT;
|
||||
$this->addWarning( [ 'apiwarn-parse-nocontentmodel', $model ] );
|
||||
}
|
||||
|
|
@ -231,7 +231,7 @@ class ApiParse extends ApiBase {
|
|||
if ( $this->section !== false ) {
|
||||
if ( $this->section === 'new' ) {
|
||||
// Insert the section title above the content.
|
||||
if ( !is_null( $params['sectiontitle'] ) && $params['sectiontitle'] !== '' ) {
|
||||
if ( $params['sectiontitle'] !== null && $params['sectiontitle'] !== '' ) {
|
||||
$this->content = $this->content->addSectionHeader( $params['sectiontitle'] );
|
||||
}
|
||||
} else {
|
||||
|
|
@ -251,8 +251,8 @@ class ApiParse extends ApiBase {
|
|||
$result_array['wikitext'] = $this->content->serialize( $format );
|
||||
$result_array[ApiResult::META_BC_SUBELEMENTS][] = 'wikitext';
|
||||
}
|
||||
if ( !is_null( $params['summary'] ) ||
|
||||
( !is_null( $params['sectiontitle'] ) && $this->section === 'new' )
|
||||
if ( $params['summary'] !== null ||
|
||||
( $params['sectiontitle'] !== null && $this->section === 'new' )
|
||||
) {
|
||||
$result_array['parsedsummary'] = $this->formatSummary( $titleObj, $params );
|
||||
$result_array[ApiResult::META_BC_SUBELEMENTS][] = 'parsedsummary';
|
||||
|
|
@ -331,11 +331,11 @@ class ApiParse extends ApiBase {
|
|||
Hooks::run( 'ApiParseMakeOutputPage', [ $this, $outputPage ] );
|
||||
}
|
||||
|
||||
if ( !is_null( $oldid ) ) {
|
||||
if ( $oldid !== null ) {
|
||||
$result_array['revid'] = (int)$oldid;
|
||||
}
|
||||
|
||||
if ( $params['redirects'] && !is_null( $redirValues ) ) {
|
||||
if ( $params['redirects'] && $redirValues !== null ) {
|
||||
$result_array['redirects'] = $redirValues;
|
||||
}
|
||||
|
||||
|
|
@ -349,8 +349,8 @@ class ApiParse extends ApiBase {
|
|||
$result_array[ApiResult::META_BC_SUBELEMENTS][] = 'text';
|
||||
}
|
||||
|
||||
if ( !is_null( $params['summary'] ) ||
|
||||
( !is_null( $params['sectiontitle'] ) && $this->section === 'new' )
|
||||
if ( $params['summary'] !== null ||
|
||||
( $params['sectiontitle'] !== null && $this->section === 'new' )
|
||||
) {
|
||||
$result_array['parsedsummary'] = $this->formatSummary( $titleObj, $params );
|
||||
$result_array[ApiResult::META_BC_SUBELEMENTS][] = 'parsedsummary';
|
||||
|
|
@ -466,7 +466,7 @@ class ApiParse extends ApiBase {
|
|||
if ( isset( $prop['wikitext'] ) ) {
|
||||
$result_array['wikitext'] = $this->content->serialize( $format );
|
||||
$result_array[ApiResult::META_BC_SUBELEMENTS][] = 'wikitext';
|
||||
if ( !is_null( $this->pstContent ) ) {
|
||||
if ( $this->pstContent !== null ) {
|
||||
$result_array['psttext'] = $this->pstContent->serialize( $format );
|
||||
$result_array[ApiResult::META_BC_SUBELEMENTS][] = 'psttext';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class ApiPatrol extends ApiBase {
|
|||
$tags = $params['tags'];
|
||||
|
||||
// Check if user can add tags
|
||||
if ( !is_null( $tags ) ) {
|
||||
if ( $tags !== null ) {
|
||||
$ableToTag = ChangeTags::canAddTagsAccompanyingChange( $tags, $user );
|
||||
if ( !$ableToTag->isOK() ) {
|
||||
$this->dieStatus( $ableToTag );
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ApiProtect extends ApiBase {
|
|||
$tags = $params['tags'];
|
||||
|
||||
// Check if user can add tags
|
||||
if ( !is_null( $tags ) ) {
|
||||
if ( $tags !== null ) {
|
||||
$ableToTag = ChangeTags::canAddTagsAccompanyingChange( $tags, $user );
|
||||
if ( !$ableToTag->isOK() ) {
|
||||
$this->dieStatus( $ableToTag );
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
|
|||
$this->addTables( 'category' );
|
||||
$this->addFields( 'cat_title' );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 1 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
@ -120,7 +120,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
|
|||
|
||||
// Normalize titles
|
||||
$titleObj = Title::makeTitle( NS_CATEGORY, $row->cat_title );
|
||||
if ( !is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet !== null ) {
|
||||
$pages[] = $titleObj;
|
||||
} else {
|
||||
$item = [];
|
||||
|
|
@ -142,7 +142,7 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'c' );
|
||||
} else {
|
||||
$resultPageSet->populateFromTitles( $pages );
|
||||
|
|
|
|||
|
|
@ -63,13 +63,13 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
// 'user': List deleted revs by a certain user
|
||||
// 'all': List all deleted revs in NS
|
||||
$mode = 'all';
|
||||
if ( !is_null( $params['user'] ) ) {
|
||||
if ( $params['user'] !== null ) {
|
||||
$mode = 'user';
|
||||
}
|
||||
|
||||
if ( $mode == 'user' ) {
|
||||
foreach ( [ 'from', 'to', 'prefix', 'excludeuser' ] as $param ) {
|
||||
if ( !is_null( $params[$param] ) ) {
|
||||
if ( $params[$param] !== null ) {
|
||||
$p = $this->getModulePrefix();
|
||||
$this->dieWithError(
|
||||
[ 'apierror-invalidparammix-cannotusewith', $p . $param, "{$p}user" ],
|
||||
|
|
@ -79,7 +79,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
}
|
||||
} else {
|
||||
foreach ( [ 'start', 'end' ] as $param ) {
|
||||
if ( !is_null( $params[$param] ) ) {
|
||||
if ( $params[$param] !== null ) {
|
||||
$p = $this->getModulePrefix();
|
||||
$this->dieWithError(
|
||||
[ 'apierror-invalidparammix-mustusewith', $p . $param, "{$p}user" ],
|
||||
|
|
@ -126,7 +126,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
$this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'archive' ) ] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['tag'] ) ) {
|
||||
if ( $params['tag'] !== null ) {
|
||||
$this->addTables( 'change_tag' );
|
||||
$this->addJoinConds(
|
||||
[ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ]
|
||||
|
|
@ -221,14 +221,14 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
$this->addTimestampWhereRange( 'ar_timestamp', $dir, $params['start'], $params['end'] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['user'] ) ) {
|
||||
if ( $params['user'] !== null ) {
|
||||
// Don't query by user ID here, it might be able to use the ar_usertext_timestamp index.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $db, 'ar_user', User::newFromName( $params['user'], false ), false );
|
||||
$this->addTables( $actorQuery['tables'] );
|
||||
$this->addJoinConds( $actorQuery['joins'] );
|
||||
$this->addWhere( $actorQuery['conds'] );
|
||||
} elseif ( !is_null( $params['excludeuser'] ) ) {
|
||||
} elseif ( $params['excludeuser'] !== null ) {
|
||||
// Here there's no chance of using ar_usertext_timestamp.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $db, 'ar_user', User::newFromName( $params['excludeuser'], false ) );
|
||||
|
|
@ -237,7 +237,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
$this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
|
||||
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
|
||||
// Paranoia: avoid brute force searches (T19342)
|
||||
if ( !$this->getPermissionManager()->userHasRight( $user, 'deletedhistory' ) ) {
|
||||
$bitmask = RevisionRecord::DELETED_USER;
|
||||
|
|
@ -253,7 +253,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$op = ( $dir == 'newer' ? '>' : '<' );
|
||||
if ( $optimizeGenerateTitles ) {
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
// Pagination
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 1 );
|
||||
$op = $ascendingOrder ? '>' : '<';
|
||||
|
|
@ -159,7 +159,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
|
|||
);
|
||||
}
|
||||
}
|
||||
if ( !is_null( $params['user'] ) && $params['filterbots'] != 'all' ) {
|
||||
if ( $params['user'] !== null && $params['filterbots'] != 'all' ) {
|
||||
// Since filterbots checks if each user has the bot right, it
|
||||
// doesn't make sense to use it with user
|
||||
$this->dieWithError(
|
||||
|
|
@ -177,7 +177,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
|
|||
// Include in ORDER BY for uniqueness
|
||||
$this->addWhereRange( 'img_name', $ascendingOrder ? 'newer' : 'older', null, null );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$op = ( $ascendingOrder ? '>' : '<' );
|
||||
|
|
@ -190,7 +190,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
// Image filters
|
||||
if ( !is_null( $params['user'] ) ) {
|
||||
if ( $params['user'] !== null ) {
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $db, 'img_user', User::newFromName( $params['user'], false ) );
|
||||
$this->addTables( $actorQuery['tables'] );
|
||||
|
|
@ -241,7 +241,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
|
|||
$this->addWhereFld( 'img_sha1', $sha1 );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['mime'] ) ) {
|
||||
if ( $params['mime'] !== null ) {
|
||||
if ( $this->getConfig()->get( 'MiserMode' ) ) {
|
||||
$this->dieWithError( 'apierror-mimesearchdisabled' );
|
||||
}
|
||||
|
|
@ -296,7 +296,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$file = $repo->newFileFromRow( $row );
|
||||
$info = array_merge( [ 'name' => $row->img_name ],
|
||||
ApiQueryImageInfo::getInfo( $file, $prop, $result ) );
|
||||
|
|
@ -316,7 +316,7 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'img' );
|
||||
} else {
|
||||
$resultPageSet->populateFromTitles( $titles );
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
|
|||
$this->addWhereFld( $pfx . 'namespace', $namespace );
|
||||
}
|
||||
|
||||
$continue = !is_null( $params['continue'] );
|
||||
$continue = $params['continue'] !== null;
|
||||
if ( $continue ) {
|
||||
$continueArr = explode( '|', $params['continue'] );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
@ -215,7 +215,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$vals = [
|
||||
ApiResult::META_TYPE => 'assoc',
|
||||
];
|
||||
|
|
@ -247,7 +247,7 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ], $this->indexTag );
|
||||
} elseif ( $params['unique'] ) {
|
||||
$resultPageSet->populateFromTitles( $titles );
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ class ApiQueryAllMessages extends ApiQueryBase {
|
|||
public function execute() {
|
||||
$params = $this->extractRequestParams();
|
||||
|
||||
if ( is_null( $params['lang'] ) ) {
|
||||
if ( $params['lang'] === null ) {
|
||||
$langObj = $this->getLanguage();
|
||||
} elseif ( !Language::isValidCode( $params['lang'] ) ) {
|
||||
$this->dieWithError(
|
||||
|
|
@ -48,7 +48,7 @@ class ApiQueryAllMessages extends ApiQueryBase {
|
|||
}
|
||||
|
||||
if ( $params['enableparser'] ) {
|
||||
if ( !is_null( $params['title'] ) ) {
|
||||
if ( $params['title'] !== null ) {
|
||||
$title = Title::newFromText( $params['title'] );
|
||||
if ( !$title || $title->isExternal() ) {
|
||||
$this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ] );
|
||||
|
|
@ -126,8 +126,8 @@ class ApiQueryAllMessages extends ApiQueryBase {
|
|||
}
|
||||
|
||||
// Get all requested messages and print the result
|
||||
$skip = !is_null( $params['from'] );
|
||||
$useto = !is_null( $params['to'] );
|
||||
$skip = $params['from'] !== null;
|
||||
$useto = $params['to'] !== null;
|
||||
$result = $this->getResult();
|
||||
foreach ( $messages_target as $message ) {
|
||||
// Skip all messages up to $params['from']
|
||||
|
|
@ -195,7 +195,7 @@ class ApiQueryAllMessages extends ApiQueryBase {
|
|||
}
|
||||
|
||||
public function getCacheMode( $params ) {
|
||||
if ( is_null( $params['lang'] ) ) {
|
||||
if ( $params['lang'] === null ) {
|
||||
// Language not specified, will be fetched from preferences
|
||||
return 'anon-public-user-private';
|
||||
} elseif ( $params['enableparser'] ) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
|
|||
// Page filters
|
||||
$this->addTables( 'page' );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 1 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
@ -97,7 +97,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
|
|||
$db->anyString() ) );
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$selectFields = [
|
||||
'page_namespace',
|
||||
'page_title',
|
||||
|
|
@ -236,7 +236,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
|
||||
$vals = [
|
||||
'pageid' => (int)$row->page_id,
|
||||
|
|
@ -253,7 +253,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'p' );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
$commentStore = CommentStore::getStore();
|
||||
|
||||
$prop = $params['prop'];
|
||||
if ( !is_null( $prop ) ) {
|
||||
if ( $prop !== null ) {
|
||||
$prop = array_flip( $prop );
|
||||
$fld_blockinfo = isset( $prop['blockinfo'] );
|
||||
$fld_editcount = isset( $prop['editcount'] );
|
||||
|
|
@ -71,8 +71,8 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
$this->addTables( 'user' );
|
||||
|
||||
$dir = ( $params['dir'] == 'descending' ? 'older' : 'newer' );
|
||||
$from = is_null( $params['from'] ) ? null : $this->getCanonicalUserName( $params['from'] );
|
||||
$to = is_null( $params['to'] ) ? null : $this->getCanonicalUserName( $params['to'] );
|
||||
$from = $params['from'] === null ? null : $this->getCanonicalUserName( $params['from'] );
|
||||
$to = $params['to'] === null ? null : $this->getCanonicalUserName( $params['to'] );
|
||||
|
||||
# MySQL can't figure out that 'user_name' and 'qcc_title' are the same
|
||||
# despite the JOIN condition, so manually sort on the correct one.
|
||||
|
|
@ -84,12 +84,12 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
|
||||
$this->addWhereRange( $userFieldToSort, $dir, $from, $to );
|
||||
|
||||
if ( !is_null( $params['prefix'] ) ) {
|
||||
if ( $params['prefix'] !== null ) {
|
||||
$this->addWhere( $userFieldToSort .
|
||||
$db->buildLike( $this->getCanonicalUserName( $params['prefix'] ), $db->anyString() ) );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['rights'] ) && count( $params['rights'] ) ) {
|
||||
if ( $params['rights'] !== null && count( $params['rights'] ) ) {
|
||||
$groups = [];
|
||||
foreach ( $params['rights'] as $r ) {
|
||||
$groups = array_merge( $groups, $this->getPermissionManager()
|
||||
|
|
@ -105,7 +105,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
|
||||
$groups = array_unique( $groups );
|
||||
|
||||
if ( is_null( $params['group'] ) ) {
|
||||
if ( $params['group'] === null ) {
|
||||
$params['group'] = $groups;
|
||||
} else {
|
||||
$params['group'] = array_unique( array_merge( $params['group'], $groups ) );
|
||||
|
|
@ -114,7 +114,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
|
||||
$this->requireMaxOneParameter( $params, 'group', 'excludegroup' );
|
||||
|
||||
if ( !is_null( $params['group'] ) && count( $params['group'] ) ) {
|
||||
if ( $params['group'] !== null && count( $params['group'] ) ) {
|
||||
// Filter only users that belong to a given group. This might
|
||||
// produce as many rows-per-user as there are groups being checked.
|
||||
$this->addTables( 'user_groups', 'ug1' );
|
||||
|
|
@ -131,13 +131,12 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
$maxDuplicateRows *= count( $params['group'] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['excludegroup'] ) && count( $params['excludegroup'] ) ) {
|
||||
if ( $params['excludegroup'] !== null && count( $params['excludegroup'] ) ) {
|
||||
// Filter only users don't belong to a given group. This can only
|
||||
// produce one row-per-user, because we only keep on "no match".
|
||||
$this->addTables( 'user_groups', 'ug1' );
|
||||
|
||||
if ( count( $params['excludegroup'] ) == 1 ) {
|
||||
// @phan-suppress-next-line PhanTypeArraySuspiciousNullable False positive
|
||||
$exclude = [ 'ug1.ug_group' => $params['excludegroup'][0] ];
|
||||
} else {
|
||||
$exclude = [ $db->makeList(
|
||||
|
|
@ -268,7 +267,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
);
|
||||
}
|
||||
|
||||
if ( $fld_blockinfo && !is_null( $row->ipb_id ) ) {
|
||||
if ( $fld_blockinfo && $row->ipb_id !== null ) {
|
||||
$data += $this->getBlockDetails( DatabaseBlock::newFromRow( $row ) );
|
||||
}
|
||||
if ( $row->ipb_deleted ) {
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
|||
private function runFirstQuery( $resultPageSet = null ) {
|
||||
$this->addTables( [ $this->bl_table, 'page' ] );
|
||||
$this->addWhere( "{$this->bl_from}=page_id" );
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->addFields( [ 'page_id', 'page_title', 'page_namespace' ] );
|
||||
} else {
|
||||
$this->addFields( $resultPageSet->getPageTableFields() );
|
||||
|
|
@ -197,7 +197,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
|||
$this->redirTitles[] = $t;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$a = [ 'pageid' => (int)$row->page_id ];
|
||||
ApiQueryBase::addTitleInfo( $a, $t );
|
||||
if ( $row->page_is_redirect ) {
|
||||
|
|
@ -220,7 +220,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
|||
$this->addTables( [ 'page', $this->bl_table ] );
|
||||
$this->addWhere( "{$this->bl_from}=page_id" );
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->addFields( [ 'page_id', 'page_title', 'page_namespace', 'page_is_redirect' ] );
|
||||
} else {
|
||||
$this->addFields( $resultPageSet->getPageTableFields() );
|
||||
|
|
@ -321,7 +321,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
|||
$this->cont[] = $row->page_id;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$a = [ 'pageid' => (int)$row->page_id ];
|
||||
ApiQueryBase::addTitleInfo( $a, Title::makeTitle( $row->page_namespace, $row->page_title ) );
|
||||
if ( $row->page_is_redirect ) {
|
||||
|
|
@ -431,7 +431,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
|||
// Fill in any missing fields in case it's needed below
|
||||
$this->cont += [ 0, 0, 0, '', 0, 0, 0 ];
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
// Try to add the result data in one go and pray that it fits
|
||||
$code = $this->bl_code;
|
||||
$data = array_map( function ( $arr ) use ( $code ) {
|
||||
|
|
@ -510,7 +510,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
|
|||
$this->bl_code
|
||||
);
|
||||
}
|
||||
if ( !is_null( $this->continueStr ) ) {
|
||||
if ( $this->continueStr !== null ) {
|
||||
$this->setContinueEnumParameter( 'continue', $this->continueStr );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
|
|||
$sortby[$bl_from] = 'int';
|
||||
|
||||
// Now use the $sortby to figure out the continuation
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != count( $sortby ) );
|
||||
$where = '';
|
||||
|
|
@ -211,7 +211,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
|
|||
|
||||
$this->addFields( array_keys( $sortby ) );
|
||||
$this->addFields( [ 'bl_namespace' => $bl_namespace, 'bl_title' => $bl_title ] );
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$fld_pageid = isset( $prop['pageid'] );
|
||||
$fld_title = isset( $prop['title'] );
|
||||
$fld_redirect = isset( $prop['redirect'] );
|
||||
|
|
@ -285,7 +285,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
|
|||
|
||||
$res = $this->select( __METHOD__ );
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
if ( $fld_title ) {
|
||||
$this->executeGenderCacheFromResultWrapper( $res, __METHOD__ );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ abstract class ApiQueryBase extends ApiBase {
|
|||
* @return IDatabase
|
||||
*/
|
||||
protected function getDB() {
|
||||
if ( is_null( $this->mDb ) ) {
|
||||
if ( $this->mDb === null ) {
|
||||
$this->mDb = $this->getQuery()->getDB();
|
||||
}
|
||||
|
||||
|
|
@ -325,11 +325,11 @@ abstract class ApiQueryBase extends ApiBase {
|
|||
$before = ( $isDirNewer ? '<=' : '>=' );
|
||||
$db = $this->getDB();
|
||||
|
||||
if ( !is_null( $start ) ) {
|
||||
if ( $start !== null ) {
|
||||
$this->addWhere( $field . $after . $db->addQuotes( $start ) );
|
||||
}
|
||||
|
||||
if ( !is_null( $end ) ) {
|
||||
if ( $end !== null ) {
|
||||
$this->addWhere( $field . $before . $db->addQuotes( $end ) );
|
||||
}
|
||||
|
||||
|
|
@ -367,7 +367,7 @@ abstract class ApiQueryBase extends ApiBase {
|
|||
* @param int|string|string[]|null $value Option value
|
||||
*/
|
||||
protected function addOption( $name, $value = null ) {
|
||||
if ( is_null( $value ) ) {
|
||||
if ( $value === null ) {
|
||||
$this->options[] = $name;
|
||||
} else {
|
||||
$this->options[$name] = $value;
|
||||
|
|
@ -488,7 +488,7 @@ abstract class ApiQueryBase extends ApiBase {
|
|||
* @return bool Whether the element fit in the result
|
||||
*/
|
||||
protected function addPageSubItem( $pageId, $item, $elemname = null ) {
|
||||
if ( is_null( $elemname ) ) {
|
||||
if ( $elemname === null ) {
|
||||
$elemname = $this->getModulePrefix();
|
||||
}
|
||||
$result = $this->getResult();
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class ApiQueryBlocks extends ApiQueryBase {
|
|||
// Include in ORDER BY for uniqueness
|
||||
$this->addWhereRange( 'ipb_id', $params['dir'], null, null );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$op = ( $params['dir'] == 'newer' ? '>' : '<' );
|
||||
|
|
@ -153,7 +153,7 @@ class ApiQueryBlocks extends ApiQueryBase {
|
|||
] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['show'] ) ) {
|
||||
if ( $params['show'] !== null ) {
|
||||
$show = array_flip( $params['show'] );
|
||||
|
||||
/* Check for conflicting parameters. */
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
|
|||
$this->addWhereFld( 'cl_to', $cats );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
@ -132,7 +132,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
|
|||
$res = $this->select( __METHOD__ );
|
||||
|
||||
$count = 0;
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
foreach ( $res as $row ) {
|
||||
if ( ++$count > $params['limit'] ) {
|
||||
// We've reached the one extra which shows that
|
||||
|
|
@ -152,7 +152,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
|
|||
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->cl_timestamp );
|
||||
}
|
||||
if ( isset( $prop['hidden'] ) ) {
|
||||
$vals['hidden'] = !is_null( $row->pp_propname );
|
||||
$vals['hidden'] = $row->pp_propname !== null;
|
||||
}
|
||||
|
||||
$fit = $this->addPageSubItem( $row->cl_from, $vals );
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
|
|||
] );
|
||||
$this->addWhere( [ 'cat_title' => $cattitles ] );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$title = $this->getDB()->addQuotes( $params['continue'] );
|
||||
$this->addWhere( "cat_title >= $title" );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
|
|||
$fld_timestamp = isset( $prop['timestamp'] );
|
||||
$fld_type = isset( $prop['type'] );
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->addFields( [ 'cl_from', 'cl_sortkey', 'cl_type', 'page_namespace', 'page_title' ] );
|
||||
$this->addFieldsIf( 'page_id', $fld_ids );
|
||||
$this->addFieldsIf( 'cl_sortkey_prefix', $fld_sortkeyprefix );
|
||||
|
|
@ -108,7 +108,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
|
|||
// Include in ORDER BY for uniqueness
|
||||
$this->addWhereRange( 'cl_from', $dir, null, null );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$op = ( $dir === 'newer' ? '>' : '<' );
|
||||
|
|
@ -246,7 +246,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$vals = [
|
||||
ApiResult::META_TYPE => 'assoc',
|
||||
];
|
||||
|
|
@ -287,7 +287,7 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName(
|
||||
[ 'query', $this->getModuleName() ], 'cm' );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
$this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'archive' ) ] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['tag'] ) ) {
|
||||
if ( $params['tag'] !== null ) {
|
||||
$this->addTables( 'change_tag' );
|
||||
$this->addJoinConds(
|
||||
[ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ]
|
||||
|
|
@ -117,14 +117,14 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
$this->addWhere( $where );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['user'] ) ) {
|
||||
if ( $params['user'] !== null ) {
|
||||
// Don't query by user ID here, it might be able to use the ar_usertext_timestamp index.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $db, 'ar_user', User::newFromName( $params['user'], false ), false );
|
||||
$this->addTables( $actorQuery['tables'] );
|
||||
$this->addJoinConds( $actorQuery['joins'] );
|
||||
$this->addWhere( $actorQuery['conds'] );
|
||||
} elseif ( !is_null( $params['excludeuser'] ) ) {
|
||||
} elseif ( $params['excludeuser'] !== null ) {
|
||||
// Here there's no chance of using ar_usertext_timestamp.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $db, 'ar_user', User::newFromName( $params['excludeuser'], false ) );
|
||||
|
|
@ -133,7 +133,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
$this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
|
||||
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
|
||||
// Paranoia: avoid brute force searches (T19342)
|
||||
if ( !$this->getPermissionManager()->userHasRight( $user, 'deletedhistory' ) ) {
|
||||
$bitmask = RevisionRecord::DELETED_USER;
|
||||
|
|
@ -149,7 +149,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$op = ( $dir == 'newer' ? '>' : '<' );
|
||||
if ( $revCount !== 0 ) {
|
||||
|
|
|
|||
|
|
@ -83,26 +83,26 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
$mode = 'all';
|
||||
if ( count( $titles ) > 0 ) {
|
||||
$mode = 'revs';
|
||||
} elseif ( !is_null( $params['user'] ) ) {
|
||||
} elseif ( $params['user'] !== null ) {
|
||||
$mode = 'user';
|
||||
}
|
||||
|
||||
if ( $mode == 'revs' || $mode == 'user' ) {
|
||||
// Ignore namespace and unique due to inability to know whether they were purposely set
|
||||
foreach ( [ 'from', 'to', 'prefix', /*'namespace', 'unique'*/ ] as $p ) {
|
||||
if ( !is_null( $params[$p] ) ) {
|
||||
if ( $params[$p] !== null ) {
|
||||
$this->dieWithError( [ 'apierror-deletedrevs-param-not-1-2', $p ], 'badparams' );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ( [ 'start', 'end' ] as $p ) {
|
||||
if ( !is_null( $params[$p] ) ) {
|
||||
if ( $params[$p] !== null ) {
|
||||
$this->dieWithError( [ 'apierror-deletedrevs-param-not-3', $p ], 'badparams' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
|
||||
if ( $params['user'] !== null && $params['excludeuser'] !== null ) {
|
||||
$this->dieWithError( 'user and excludeuser cannot be used together', 'badparams' );
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
$this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'archive' ) ] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['tag'] ) ) {
|
||||
if ( $params['tag'] !== null ) {
|
||||
$this->addTables( 'change_tag' );
|
||||
$this->addJoinConds(
|
||||
[ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ]
|
||||
|
|
@ -178,14 +178,14 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $params['user'] ) ) {
|
||||
if ( $params['user'] !== null ) {
|
||||
// Don't query by user ID here, it might be able to use the ar_usertext_timestamp index.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $db, 'ar_user', User::newFromName( $params['user'], false ), false );
|
||||
$this->addTables( $actorQuery['tables'] );
|
||||
$this->addJoinConds( $actorQuery['joins'] );
|
||||
$this->addWhere( $actorQuery['conds'] );
|
||||
} elseif ( !is_null( $params['excludeuser'] ) ) {
|
||||
} elseif ( $params['excludeuser'] !== null ) {
|
||||
// Here there's no chance of using ar_usertext_timestamp.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $db, 'ar_user', User::newFromName( $params['excludeuser'], false ) );
|
||||
|
|
@ -194,7 +194,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
$this->addWhere( 'NOT(' . $actorQuery['conds'] . ')' );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
|
||||
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
|
||||
// Paranoia: avoid brute force searches (T19342)
|
||||
// (shouldn't be able to get here without 'deletedhistory', but
|
||||
// check it again just in case)
|
||||
|
|
@ -212,7 +212,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$op = ( $dir == 'newer' ? '>' : '<' );
|
||||
if ( $mode == 'all' || $mode == 'revs' ) {
|
||||
|
|
@ -288,7 +288,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
|
|||
if ( $fld_revid ) {
|
||||
$rev['revid'] = (int)$row->ar_rev_id;
|
||||
}
|
||||
if ( $fld_parentid && !is_null( $row->ar_parent_id ) ) {
|
||||
if ( $fld_parentid && $row->ar_parent_id !== null ) {
|
||||
$rev['parentid'] = (int)$row->ar_parent_id;
|
||||
}
|
||||
if ( $fld_user || $fld_userid ) {
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
|
|||
$this->setContinueEnumParameter( 'continue', $image . '|' . $dupName );
|
||||
break;
|
||||
}
|
||||
if ( !is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet !== null ) {
|
||||
$titles[] = $dupFile->getTitle();
|
||||
} else {
|
||||
$r = [
|
||||
|
|
@ -147,7 +147,7 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if ( !is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet !== null ) {
|
||||
$resultPageSet->populateFromTitles( $titles );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
|
|||
$fld_title = isset( $prop['title'] );
|
||||
$fld_url = isset( $prop['url'] );
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->addFields( [
|
||||
'page_id',
|
||||
'page_namespace',
|
||||
|
|
@ -155,7 +155,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$vals = [
|
||||
ApiResult::META_TYPE => 'assoc',
|
||||
];
|
||||
|
|
@ -184,7 +184,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ],
|
||||
$this->getModulePrefix() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class ApiQueryFilearchive extends ApiQueryBase {
|
|||
$this->addFields( $fileQuery['fields'] );
|
||||
$this->addJoinConds( $fileQuery['joins'] );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 3 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
@ -211,7 +211,7 @@ class ApiQueryFilearchive extends ApiQueryBase {
|
|||
if ( $fld_mime && $canViewFile ) {
|
||||
$file['mime'] = "$row->fa_major_mime/$row->fa_minor_mime";
|
||||
}
|
||||
if ( $fld_archivename && !is_null( $row->fa_archive_name ) ) {
|
||||
if ( $fld_archivename && $row->fa_archive_name !== null ) {
|
||||
$file['archivename'] = $row->fa_archive_name;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
|
|||
);
|
||||
}
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 3 );
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( !is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet !== null ) {
|
||||
$pages[] = Title::newFromRow( $row );
|
||||
} else {
|
||||
$entry = [ 'pageid' => (int)$row->page_id ];
|
||||
|
|
@ -164,7 +164,7 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'iw' );
|
||||
} else {
|
||||
$resultPageSet->populateFromTitles( $pages );
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class ApiQueryIWLinks extends ApiQueryBase {
|
|||
$this->addTables( 'iwlinks' );
|
||||
$this->addWhereFld( 'iwl_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 3 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
// We allow a subclass to override the prefix, to create a related API
|
||||
// module. Some other parts of MediaWiki construct this with a null
|
||||
// $prefix, which used to be ignored when this only took two arguments
|
||||
if ( is_null( $prefix ) ) {
|
||||
if ( $prefix === null ) {
|
||||
$prefix = 'ii';
|
||||
}
|
||||
parent::__construct( $query, $moduleName, $prefix );
|
||||
|
|
@ -72,7 +72,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
asort( $titles ); // Ensure the order is always the same
|
||||
|
||||
$fromTitle = null;
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$fromTitle = strval( $cont[0] );
|
||||
|
|
@ -173,8 +173,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
// Check that the current version is within the start-end boundaries
|
||||
$gotOne = false;
|
||||
if (
|
||||
( is_null( $start ) || $img->getTimestamp() <= $start ) &&
|
||||
( is_null( $params['end'] ) || $img->getTimestamp() >= $params['end'] )
|
||||
( $start === null || $img->getTimestamp() <= $start ) &&
|
||||
( $params['end'] === null || $img->getTimestamp() >= $params['end'] )
|
||||
) {
|
||||
$gotOne = true;
|
||||
|
||||
|
|
@ -505,7 +505,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
|
||||
if ( $url ) {
|
||||
if ( $exists ) {
|
||||
if ( !is_null( $thumbParams ) ) {
|
||||
if ( $thumbParams !== null ) {
|
||||
$mto = $file->transform( $thumbParams );
|
||||
self::$transformCount++;
|
||||
if ( $mto && !$mto->isError() ) {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
|
|||
|
||||
$this->addTables( 'imagelinks' );
|
||||
$this->addWhereFld( 'il_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
@ -100,7 +100,7 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
|
|||
|
||||
$res = $this->select( __METHOD__ );
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$count = 0;
|
||||
foreach ( $res as $row ) {
|
||||
if ( ++$count > $params['limit'] ) {
|
||||
|
|
|
|||
|
|
@ -302,7 +302,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
|
||||
public function execute() {
|
||||
$this->params = $this->extractRequestParams();
|
||||
if ( !is_null( $this->params['prop'] ) ) {
|
||||
if ( $this->params['prop'] !== null ) {
|
||||
$prop = array_flip( $this->params['prop'] );
|
||||
$this->fld_protection = isset( $prop['protection'] );
|
||||
$this->fld_watched = isset( $prop['watched'] );
|
||||
|
|
@ -325,7 +325,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
$result = $this->getResult();
|
||||
|
||||
uasort( $this->everything, [ Title::class, 'compare' ] );
|
||||
if ( !is_null( $this->params['continue'] ) ) {
|
||||
if ( $this->params['continue'] !== null ) {
|
||||
// Throw away any titles we're gonna skip so they don't
|
||||
// clutter queries
|
||||
$cont = explode( '|', $this->params['continue'] );
|
||||
|
|
@ -433,7 +433,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $this->params['token'] ) ) {
|
||||
if ( $this->params['token'] !== null ) {
|
||||
$tokenFunctions = $this->getTokenFunctions();
|
||||
$pageInfo['starttimestamp'] = wfTimestamp( TS_ISO_8601, time() );
|
||||
foreach ( $this->params['token'] as $t ) {
|
||||
|
|
@ -962,7 +962,7 @@ class ApiQueryInfo extends ApiQueryBase {
|
|||
return 'private';
|
||||
}
|
||||
|
||||
if ( !is_null( $params['token'] ) ) {
|
||||
if ( $params['token'] !== null ) {
|
||||
return 'private';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
|
|||
);
|
||||
}
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 3 );
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( !is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet !== null ) {
|
||||
$pages[] = Title::newFromRow( $row );
|
||||
} else {
|
||||
$entry = [ 'pageid' => (int)$row->page_id ];
|
||||
|
|
@ -163,7 +163,7 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'll' );
|
||||
} else {
|
||||
$resultPageSet->populateFromTitles( $pages );
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class ApiQueryLangLinks extends ApiQueryBase {
|
|||
|
||||
$this->addTables( 'langlinks' );
|
||||
$this->addWhereFld( 'll_from', array_keys( $this->getPageSet()->getGoodTitles() ) );
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
|
|||
$multiNS = $params['namespace'] === null || count( $params['namespace'] ) !== 1;
|
||||
}
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 3 );
|
||||
$op = $params['dir'] == 'descending' ? '<' : '>';
|
||||
|
|
@ -152,7 +152,7 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
|
|||
|
||||
$res = $this->select( __METHOD__ );
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->executeGenderCacheFromResultWrapper( $res, __METHOD__, 'pl' );
|
||||
|
||||
$count = 0;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
$this->addFields( [ 'ts_tags' => ChangeTags::makeTagSummarySubquery( 'logging' ) ] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['tag'] ) ) {
|
||||
if ( $params['tag'] !== null ) {
|
||||
$this->addTables( 'change_tag' );
|
||||
$this->addJoinConds( [ 'change_tag' => [ 'JOIN',
|
||||
[ 'log_id=ct_log_id' ] ] ] );
|
||||
|
|
@ -123,7 +123,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $params['action'] ) ) {
|
||||
if ( $params['action'] !== null ) {
|
||||
// Do validation of action param, list of allowed actions can contains wildcards
|
||||
// Allow the param, when the actions is in the list or a wildcard version is listed.
|
||||
$logAction = $params['action'];
|
||||
|
|
@ -146,7 +146,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
|
||||
$this->addWhereFld( 'log_type', $type );
|
||||
$this->addWhereFld( 'log_action', $action );
|
||||
} elseif ( !is_null( $params['type'] ) ) {
|
||||
} elseif ( $params['type'] !== null ) {
|
||||
$this->addWhereFld( 'log_type', $params['type'] );
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
// Include in ORDER BY for uniqueness
|
||||
$this->addWhereRange( 'log_id', $params['dir'], null, null );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$op = ( $params['dir'] === 'newer' ? '>' : '<' );
|
||||
|
|
@ -176,7 +176,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
$this->addOption( 'LIMIT', $limit + 1 );
|
||||
|
||||
$user = $params['user'];
|
||||
if ( !is_null( $user ) ) {
|
||||
if ( $user !== null ) {
|
||||
// Note the joins in $q are the same as those from ->getJoin() above
|
||||
// so we only need to add 'conds' here.
|
||||
$q = $actorMigration->getWhere(
|
||||
|
|
@ -191,9 +191,9 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
}
|
||||
|
||||
$title = $params['title'];
|
||||
if ( !is_null( $title ) ) {
|
||||
if ( $title !== null ) {
|
||||
$titleObj = Title::newFromText( $title );
|
||||
if ( is_null( $titleObj ) ) {
|
||||
if ( $titleObj === null ) {
|
||||
$this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $title ) ] );
|
||||
}
|
||||
$this->addWhereFld( 'log_namespace', $titleObj->getNamespace() );
|
||||
|
|
@ -206,13 +206,13 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
|
||||
$prefix = $params['prefix'];
|
||||
|
||||
if ( !is_null( $prefix ) ) {
|
||||
if ( $prefix !== null ) {
|
||||
if ( $this->getConfig()->get( 'MiserMode' ) ) {
|
||||
$this->dieWithError( 'apierror-prefixsearchdisabled' );
|
||||
}
|
||||
|
||||
$title = Title::newFromText( $prefix );
|
||||
if ( is_null( $title ) ) {
|
||||
if ( $title === null ) {
|
||||
$this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $prefix ) ] );
|
||||
}
|
||||
$this->addWhereFld( 'log_namespace', $title->getNamespace() );
|
||||
|
|
@ -220,7 +220,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
}
|
||||
|
||||
// Paranoia: avoid brute force searches (T19342)
|
||||
if ( $params['namespace'] !== null || !is_null( $title ) || !is_null( $user ) ) {
|
||||
if ( $params['namespace'] !== null || $title !== null || $user !== null ) {
|
||||
if ( !$this->getPermissionManager()->userHasRight( $this->getUser(), 'deletedhistory' ) ) {
|
||||
$titleBits = LogPage::DELETED_ACTION;
|
||||
$userBits = LogPage::DELETED_USER;
|
||||
|
|
@ -233,10 +233,10 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
$titleBits = 0;
|
||||
$userBits = 0;
|
||||
}
|
||||
if ( ( $params['namespace'] !== null || !is_null( $title ) ) && $titleBits ) {
|
||||
if ( ( $params['namespace'] !== null || $title !== null ) && $titleBits ) {
|
||||
$this->addWhere( $db->bitAnd( 'log_deleted', $titleBits ) . " != $titleBits" );
|
||||
}
|
||||
if ( !is_null( $user ) && $userBits ) {
|
||||
if ( $user !== null && $userBits ) {
|
||||
$this->addWhere( $db->bitAnd( 'log_deleted', $userBits ) . " != $userBits" );
|
||||
}
|
||||
}
|
||||
|
|
@ -386,7 +386,7 @@ class ApiQueryLogEvents extends ApiQueryBase {
|
|||
if ( $this->userCanSeeRevDel() ) {
|
||||
return 'private';
|
||||
}
|
||||
if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
|
||||
if ( $params['prop'] !== null && in_array( 'parsedcomment', $params['prop'] ) ) {
|
||||
// formatComment() calls wfMessage() among other things
|
||||
return 'anon-public-user-private';
|
||||
} elseif ( LogEventsList::getExcludeClause( $this->getDB(), 'user', $this->getUser() )
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
|
|||
$this->addWhereRange( 'pt_namespace', $params['dir'], null, null );
|
||||
$this->addWhereRange( 'pt_title', $params['dir'], null, null );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 3 );
|
||||
$op = ( $params['dir'] === 'newer' ? '>' : '<' );
|
||||
|
|
@ -118,14 +118,14 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
$title = Title::makeTitle( $row->pt_namespace, $row->pt_title );
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$vals = [];
|
||||
ApiQueryBase::addTitleInfo( $vals, $title );
|
||||
if ( isset( $prop['timestamp'] ) ) {
|
||||
$vals['timestamp'] = wfTimestamp( TS_ISO_8601, $row->pt_timestamp );
|
||||
}
|
||||
|
||||
if ( isset( $prop['user'] ) && !is_null( $row->user_name ) ) {
|
||||
if ( isset( $prop['user'] ) && $row->user_name !== null ) {
|
||||
$vals['user'] = $row->user_name;
|
||||
}
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName(
|
||||
[ 'query', $this->getModuleName() ],
|
||||
$this->getModulePrefix()
|
||||
|
|
@ -174,7 +174,7 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
public function getCacheMode( $params ) {
|
||||
if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
|
||||
if ( $params['prop'] !== null && in_array( 'parsedcomment', $params['prop'] ) ) {
|
||||
// formatComment() calls wfMessage() among other things
|
||||
return 'anon-public-user-private';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
$title = Title::makeTitle( $row->namespace, $row->title );
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$data = [];
|
||||
if ( isset( $row->value ) ) {
|
||||
$data['value'] = $row->value;
|
||||
|
|
@ -146,7 +146,7 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
|
|||
$titles[] = $title;
|
||||
}
|
||||
}
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$result->addIndexedTagName(
|
||||
[ 'query', $this->getModuleName(), 'results' ],
|
||||
'page'
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
|
|||
$this->resetQueryParams();
|
||||
$this->addTables( 'page' );
|
||||
$this->addFields( [ 'page_id', 'page_random' ] );
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->addFields( [ 'page_title', 'page_namespace' ] );
|
||||
} else {
|
||||
$this->addFields( $resultPageSet->getPageTableFields() );
|
||||
|
|
@ -64,7 +64,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
|
|||
$this->addWhereFld( 'page_is_redirect', 1 );
|
||||
} elseif ( $params['filterredir'] === 'nonredirects' ) {
|
||||
$this->addWhereFld( 'page_is_redirect', 0 );
|
||||
} elseif ( is_null( $resultPageSet ) ) {
|
||||
} elseif ( $resultPageSet === null ) {
|
||||
$this->addFields( [ 'page_is_redirect' ] );
|
||||
}
|
||||
$this->addOption( 'LIMIT', $limit + 1 );
|
||||
|
|
@ -97,7 +97,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
|
|||
if ( $count++ >= $limit ) {
|
||||
return [ 0, "{$row->page_random}|{$row->page_id}" ];
|
||||
}
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$title = Title::makeTitle( $row->page_namespace, $row->page_title );
|
||||
$page = [
|
||||
'id' => (int)$row->page_id,
|
||||
|
|
@ -173,7 +173,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
|
|||
$this->setContinueEnumParameter( 'continue', "$rand|$continue|$endFlag" );
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->getResult()->addIndexedTagName( [ 'query', $this->getModuleName() ], 'page' );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
// The patrol token is always the same, let's exploit that
|
||||
static $cachedPatrolToken = null;
|
||||
|
||||
if ( is_null( $cachedPatrolToken ) ) {
|
||||
if ( $cachedPatrolToken === null ) {
|
||||
$cachedPatrolToken = $wgUser->getEditToken( 'patrol' );
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +154,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
$this->addTables( 'recentchanges' );
|
||||
$this->addTimestampWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] );
|
||||
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$db = $this->getDB();
|
||||
|
|
@ -177,7 +177,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
|
||||
$this->addWhereFld( 'rc_namespace', $params['namespace'] );
|
||||
|
||||
if ( !is_null( $params['type'] ) ) {
|
||||
if ( $params['type'] !== null ) {
|
||||
try {
|
||||
$this->addWhereFld( 'rc_type', RecentChange::parseToRCType( $params['type'] ) );
|
||||
} catch ( Exception $e ) {
|
||||
|
|
@ -186,16 +186,16 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
$title = $params['title'];
|
||||
if ( !is_null( $title ) ) {
|
||||
if ( $title !== null ) {
|
||||
$titleObj = Title::newFromText( $title );
|
||||
if ( is_null( $titleObj ) ) {
|
||||
if ( $titleObj === null ) {
|
||||
$this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $title ) ] );
|
||||
}
|
||||
$this->addWhereFld( 'rc_namespace', $titleObj->getNamespace() );
|
||||
$this->addWhereFld( 'rc_title', $titleObj->getDBkey() );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['show'] ) ) {
|
||||
if ( $params['show'] !== null ) {
|
||||
$show = array_flip( $params['show'] );
|
||||
|
||||
/* Check for conflicting parameters. */
|
||||
|
|
@ -269,7 +269,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
|
||||
$this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
|
||||
|
||||
if ( !is_null( $params['user'] ) ) {
|
||||
if ( $params['user'] !== null ) {
|
||||
// Don't query by user ID here, it might be able to use the rc_user_text index.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $this->getDB(), 'rc_user', User::newFromName( $params['user'], false ), false );
|
||||
|
|
@ -278,7 +278,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
$this->addWhere( $actorQuery['conds'] );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['excludeuser'] ) ) {
|
||||
if ( $params['excludeuser'] !== null ) {
|
||||
// Here there's no chance to use the rc_user_text index, so allow ID to be used.
|
||||
$actorQuery = ActorMigration::newMigration()
|
||||
->getWhere( $this->getDB(), 'rc_user', User::newFromName( $params['excludeuser'], false ) );
|
||||
|
|
@ -300,7 +300,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
|
||||
$showRedirects = false;
|
||||
/* Determine what properties we need to display. */
|
||||
if ( !is_null( $params['prop'] ) ) {
|
||||
if ( $params['prop'] !== null ) {
|
||||
$prop = array_flip( $params['prop'] );
|
||||
|
||||
/* Set up internal members based upon params. */
|
||||
|
|
@ -347,7 +347,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $params['tag'] ) ) {
|
||||
if ( $params['tag'] !== null ) {
|
||||
$this->addTables( 'change_tag' );
|
||||
$this->addJoinConds( [ 'change_tag' => [ 'JOIN', [ 'rc_id=ct_rc_id' ] ] ] );
|
||||
$changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
|
||||
|
|
@ -360,7 +360,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
// Paranoia: avoid brute force searches (T19342)
|
||||
if ( !is_null( $params['user'] ) || !is_null( $params['excludeuser'] ) ) {
|
||||
if ( $params['user'] !== null || $params['excludeuser'] !== null ) {
|
||||
if ( !$this->getPermissionManager()->userHasRight( $user, 'deletedhistory' ) ) {
|
||||
$bitmask = RevisionRecord::DELETED_USER;
|
||||
} elseif ( !$this->getPermissionManager()
|
||||
|
|
@ -403,7 +403,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
$this->addJoinConds( $commentQuery['joins'] );
|
||||
}
|
||||
|
||||
if ( $this->fld_user || $this->fld_userid || !is_null( $this->token ) ) {
|
||||
if ( $this->fld_user || $this->fld_userid || $this->token !== null ) {
|
||||
// Token needs rc_user for RecentChange::newFromRow/User::newFromAnyId (T228425)
|
||||
$actorQuery = ActorMigration::newMigration()->getJoin( 'rc_user' );
|
||||
$this->addTables( $actorQuery['tables'] );
|
||||
|
|
@ -490,7 +490,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
break;
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
/* Extract the data from a single row. */
|
||||
$vals = $this->extractRowInfo( $row );
|
||||
|
||||
|
|
@ -511,7 +511,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
/* Format the result */
|
||||
$result->addIndexedTagName( [ 'query', $this->getModuleName() ], 'rc' );
|
||||
} elseif ( $params['generaterevisions'] ) {
|
||||
|
|
@ -673,7 +673,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( !is_null( $this->token ) ) {
|
||||
if ( $this->token !== null ) {
|
||||
$tokenFunctions = $this->getTokenFunctions();
|
||||
foreach ( $this->token as $t ) {
|
||||
$val = call_user_func( $tokenFunctions[$t], $row->rc_cur_id,
|
||||
|
|
@ -717,7 +717,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
if ( $this->userCanSeeRevDel() ) {
|
||||
return 'private';
|
||||
}
|
||||
if ( !is_null( $params['prop'] ) && in_array( 'parsedcomment', $params['prop'] ) ) {
|
||||
if ( $params['prop'] !== null && in_array( 'parsedcomment', $params['prop'] ) ) {
|
||||
// formatComment() calls wfMessage() among other things
|
||||
return 'anon-public-user-private';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,10 +124,10 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
|
|||
|
||||
$this->limit = $params['limit'];
|
||||
|
||||
if ( !is_null( $params['difftotext'] ) ) {
|
||||
if ( $params['difftotext'] !== null ) {
|
||||
$this->difftotext = $params['difftotext'];
|
||||
$this->difftotextpst = $params['difftotextpst'];
|
||||
} elseif ( !is_null( $params['diffto'] ) ) {
|
||||
} elseif ( $params['diffto'] !== null ) {
|
||||
if ( $params['diffto'] == 'cur' ) {
|
||||
$params['diffto'] = 0;
|
||||
}
|
||||
|
|
@ -155,8 +155,8 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
|
|||
$this->diffto = $params['diffto'];
|
||||
}
|
||||
|
||||
$this->fetchContent = $this->fld_content || !is_null( $this->diffto )
|
||||
|| !is_null( $this->difftotext ) || $this->fld_parsetree;
|
||||
$this->fetchContent = $this->fld_content || $this->diffto !== null
|
||||
|| $this->difftotext !== null || $this->fld_parsetree;
|
||||
|
||||
$smallLimit = false;
|
||||
if ( $this->fetchContent ) {
|
||||
|
|
@ -166,7 +166,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
|
|||
$this->parseContent = $params['parse'];
|
||||
if ( $this->parseContent ) {
|
||||
// Must manually initialize unset limit
|
||||
if ( is_null( $this->limit ) ) {
|
||||
if ( $this->limit === null ) {
|
||||
$this->limit = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -182,7 +182,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( is_null( $this->limit ) ) {
|
||||
if ( $this->limit === null ) {
|
||||
$this->limit = 10;
|
||||
}
|
||||
$this->validateLimit( 'limit', $this->limit, 1, $userMax, $botMax );
|
||||
|
|
@ -231,7 +231,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
|
|||
|
||||
if ( $this->fld_ids ) {
|
||||
$vals['revid'] = (int)$revision->getId();
|
||||
if ( !is_null( $revision->getParentId() ) ) {
|
||||
if ( $revision->getParentId() !== null ) {
|
||||
$vals['parentid'] = (int)$revision->getParentId();
|
||||
}
|
||||
}
|
||||
|
|
@ -590,7 +590,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
|
||||
if ( $content && ( !is_null( $this->diffto ) || !is_null( $this->difftotext ) ) ) {
|
||||
if ( $content && ( $this->diffto !== null || $this->difftotext !== null ) ) {
|
||||
static $n = 0; // Number of uncached diffs we've had
|
||||
|
||||
if ( $n < $this->getConfig()->get( 'APIMaxUncachedDiffs' ) ) {
|
||||
|
|
@ -599,7 +599,7 @@ abstract class ApiQueryRevisionsBase extends ApiQueryGeneratorBase {
|
|||
$context->setTitle( $title );
|
||||
$handler = $content->getContentHandler();
|
||||
|
||||
if ( !is_null( $this->difftotext ) ) {
|
||||
if ( $this->difftotext !== null ) {
|
||||
$model = $title->getContentModel();
|
||||
|
||||
if ( $this->contentFormat
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
|
|||
// for instance the Lucene-based engine we use on Wikipedia.
|
||||
// In this case, fall back to full-text search (which will
|
||||
// include titles in it!)
|
||||
if ( is_null( $matches ) ) {
|
||||
if ( $matches === null ) {
|
||||
$what = 'text';
|
||||
$matches = $search->searchText( $query );
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
|
|||
} else {
|
||||
$this->dieStatus( $status );
|
||||
}
|
||||
} elseif ( is_null( $matches ) ) {
|
||||
} elseif ( $matches === null ) {
|
||||
$this->dieWithError( [ 'apierror-searchdisabled', $what ], "search-{$what}-disabled" );
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
|
|||
if ( isset( $prop['categorysnippet'] ) ) {
|
||||
$vals['categorysnippet'] = $result->getCategorySnippet();
|
||||
}
|
||||
if ( !is_null( $result->getRedirectTitle() ) ) {
|
||||
if ( $result->getRedirectTitle() !== null ) {
|
||||
if ( isset( $prop['redirecttitle'] ) ) {
|
||||
$vals['redirecttitle'] = $result->getRedirectTitle()->getPrefixedText();
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
|
|||
$vals['redirectsnippet'] = $result->getRedirectSnippet();
|
||||
}
|
||||
}
|
||||
if ( !is_null( $result->getSectionTitle() ) ) {
|
||||
if ( $result->getSectionTitle() !== null ) {
|
||||
if ( isset( $prop['sectiontitle'] ) ) {
|
||||
$vals['sectiontitle'] = $result->getSectionTitle()->getFragment();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -874,7 +874,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
|
|||
// Messages for $wgExtraInterlanguageLinkPrefixes depend on user language
|
||||
if (
|
||||
count( $this->getConfig()->get( 'ExtraInterlanguageLinkPrefixes' ) ) &&
|
||||
!is_null( $params['prop'] ) &&
|
||||
$params['prop'] !== null &&
|
||||
in_array( 'interwikimap', $params['prop'] )
|
||||
) {
|
||||
return 'anon-public-user-private';
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
// generator with batched lookup and continuation.
|
||||
$userIter = call_user_func( function () use ( $dbSecondary, $sort, $op, $fname ) {
|
||||
$fromName = false;
|
||||
if ( !is_null( $this->params['continue'] ) ) {
|
||||
if ( $this->params['continue'] !== null ) {
|
||||
$continue = explode( '|', $this->params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $continue ) != 4 );
|
||||
$this->dieContinueUsageIf( $continue[0] !== 'name' );
|
||||
|
|
@ -133,7 +133,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
$this->multiUserMode = count( $ids ) > 1;
|
||||
|
||||
$from = $fromId = false;
|
||||
if ( $this->multiUserMode && !is_null( $this->params['continue'] ) ) {
|
||||
if ( $this->multiUserMode && $this->params['continue'] !== null ) {
|
||||
$continue = explode( '|', $this->params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $continue ) != 4 );
|
||||
$this->dieContinueUsageIf( $continue[0] !== 'id' && $continue[0] !== 'actor' );
|
||||
|
|
@ -185,7 +185,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
$this->multiUserMode = count( $names ) > 1;
|
||||
|
||||
$from = $fromName = false;
|
||||
if ( $this->multiUserMode && !is_null( $this->params['continue'] ) ) {
|
||||
if ( $this->multiUserMode && $this->params['continue'] !== null ) {
|
||||
$continue = explode( '|', $this->params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $continue ) != 4 );
|
||||
$this->dieContinueUsageIf( $continue[0] !== 'name' && $continue[0] !== 'actor' );
|
||||
|
|
@ -303,7 +303,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
$this->addWhere( $revWhere['conds'] );
|
||||
|
||||
// Handle continue parameter
|
||||
if ( !is_null( $this->params['continue'] ) ) {
|
||||
if ( $this->params['continue'] !== null ) {
|
||||
$continue = explode( '|', $this->params['continue'] );
|
||||
if ( $this->multiUserMode ) {
|
||||
$this->dieContinueUsageIf( count( $continue ) != 4 );
|
||||
|
|
@ -368,7 +368,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
if ( $this->params['toponly'] ) { // deprecated/old param
|
||||
$show[] = 'top';
|
||||
}
|
||||
if ( !is_null( $show ) ) {
|
||||
if ( $show !== null ) {
|
||||
$show = array_flip( $show );
|
||||
|
||||
if ( ( isset( $show['minor'] ) && isset( $show['!minor'] ) )
|
||||
|
|
@ -469,7 +469,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
$vals['pageid'] = (int)$row->rev_page;
|
||||
$vals['revid'] = (int)$row->rev_id;
|
||||
|
||||
if ( !is_null( $row->rev_parent_id ) ) {
|
||||
if ( $row->rev_parent_id !== null ) {
|
||||
$vals['parentid'] = (int)$row->rev_parent_id;
|
||||
}
|
||||
}
|
||||
|
|
@ -485,7 +485,7 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
}
|
||||
|
||||
if ( $this->fld_flags ) {
|
||||
$vals['new'] = $row->rev_parent_id == 0 && !is_null( $row->rev_parent_id );
|
||||
$vals['new'] = $row->rev_parent_id == 0 && $row->rev_parent_id !== null;
|
||||
$vals['minor'] = (bool)$row->rev_minor_edit;
|
||||
$vals['top'] = $row->page_latest == $row->rev_id;
|
||||
}
|
||||
|
|
@ -518,13 +518,13 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
$vals['autopatrolled'] = $row->rc_patrolled == RecentChange::PRC_AUTOPATROLLED;
|
||||
}
|
||||
|
||||
if ( $this->fld_size && !is_null( $row->rev_len ) ) {
|
||||
if ( $this->fld_size && $row->rev_len !== null ) {
|
||||
$vals['size'] = (int)$row->rev_len;
|
||||
}
|
||||
|
||||
if ( $this->fld_sizediff
|
||||
&& !is_null( $row->rev_len )
|
||||
&& !is_null( $row->rev_parent_id )
|
||||
&& $row->rev_len !== null
|
||||
&& $row->rev_parent_id !== null
|
||||
) {
|
||||
$parentLen = $this->parentLens[$row->rev_parent_id] ?? 0;
|
||||
$vals['sizediff'] = (int)$row->rev_len - $parentLen;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
|
|||
$this->params = $this->extractRequestParams();
|
||||
$result = $this->getResult();
|
||||
|
||||
if ( !is_null( $this->params['prop'] ) ) {
|
||||
if ( $this->params['prop'] !== null ) {
|
||||
$this->prop = array_flip( $this->params['prop'] );
|
||||
}
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ class ApiQueryUserInfo extends ApiQueryBase {
|
|||
// Now get the actual limits
|
||||
foreach ( $this->getConfig()->get( 'RateLimits' ) as $action => $limits ) {
|
||||
foreach ( $categories as $cat ) {
|
||||
if ( isset( $limits[$cat] ) && !is_null( $limits[$cat] ) ) {
|
||||
if ( isset( $limits[$cat] ) && $limits[$cat] !== null ) {
|
||||
$retval[$action][$cat]['hits'] = (int)$limits[$cat][0];
|
||||
$retval[$action][$cat]['seconds'] = (int)$limits[$cat][1];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,12 +103,12 @@ class ApiQueryUsers extends ApiQueryBase {
|
|||
$params = $this->extractRequestParams();
|
||||
$this->requireMaxOneParameter( $params, 'userids', 'users' );
|
||||
|
||||
if ( !is_null( $params['prop'] ) ) {
|
||||
if ( $params['prop'] !== null ) {
|
||||
$this->prop = array_flip( $params['prop'] );
|
||||
} else {
|
||||
$this->prop = [];
|
||||
}
|
||||
$useNames = !is_null( $params['users'] );
|
||||
$useNames = $params['users'] !== null;
|
||||
|
||||
$users = (array)$params['users'];
|
||||
$userids = (array)$params['userids'];
|
||||
|
|
@ -234,7 +234,7 @@ class ApiQueryUsers extends ApiQueryBase {
|
|||
if ( $row->ipb_deleted ) {
|
||||
$data[$key]['hidden'] = true;
|
||||
}
|
||||
if ( isset( $this->prop['blockinfo'] ) && !is_null( $row->ipb_by_text ) ) {
|
||||
if ( isset( $this->prop['blockinfo'] ) && $row->ipb_by_text !== null ) {
|
||||
$data[$key] += $this->getBlockDetails( DatabaseBlock::newFromRow( $row ) );
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ class ApiQueryUsers extends ApiQueryBase {
|
|||
);
|
||||
}
|
||||
|
||||
if ( !is_null( $params['token'] ) ) {
|
||||
if ( $params['token'] !== null ) {
|
||||
$tokenFunctions = $this->getTokenFunctions();
|
||||
foreach ( $params['token'] as $t ) {
|
||||
$val = call_user_func( $tokenFunctions[$t], $user );
|
||||
|
|
@ -284,7 +284,7 @@ class ApiQueryUsers extends ApiQueryBase {
|
|||
if ( $iwUser instanceof UserRightsProxy ) {
|
||||
$data[$u]['interwiki'] = true;
|
||||
|
||||
if ( !is_null( $params['token'] ) ) {
|
||||
if ( $params['token'] !== null ) {
|
||||
$tokenFunctions = $this->getTokenFunctions();
|
||||
|
||||
foreach ( $params['token'] as $t ) {
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
$user = $this->getUser();
|
||||
$wlowner = $this->getWatchlistUser( $params );
|
||||
|
||||
if ( !is_null( $params['prop'] ) && is_null( $resultPageSet ) ) {
|
||||
if ( $params['prop'] !== null && $resultPageSet === null ) {
|
||||
$prop = array_flip( $params['prop'] );
|
||||
|
||||
$this->fld_ids = isset( $prop['ids'] );
|
||||
|
|
@ -96,7 +96,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
: WatchedItemQueryService::DIR_NEWER,
|
||||
];
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$options['includeFields'] = $this->getFieldsToInclude();
|
||||
} else {
|
||||
$options['usedInGenerator'] = true;
|
||||
|
|
@ -110,7 +110,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
$startFrom = null;
|
||||
if ( !is_null( $params['continue'] ) ) {
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = explode( '|', $params['continue'] );
|
||||
$this->dieContinueUsageIf( count( $cont ) != 2 );
|
||||
$continueTimestamp = $cont[0];
|
||||
|
|
@ -124,7 +124,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
$options['watchlistOwnerToken'] = $params['token'];
|
||||
}
|
||||
|
||||
if ( !is_null( $params['namespace'] ) ) {
|
||||
if ( $params['namespace'] !== null ) {
|
||||
$options['namespaceIds'] = $params['namespace'];
|
||||
}
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
$options['allRevisions'] = true;
|
||||
}
|
||||
|
||||
if ( !is_null( $params['show'] ) ) {
|
||||
if ( $params['show'] !== null ) {
|
||||
$show = array_flip( $params['show'] );
|
||||
|
||||
/* Check for conflicting parameters. */
|
||||
|
|
@ -152,7 +152,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
$options['filters'] = array_keys( $show );
|
||||
}
|
||||
|
||||
if ( !is_null( $params['type'] ) ) {
|
||||
if ( $params['type'] !== null ) {
|
||||
try {
|
||||
$rcTypes = RecentChange::parseToRCType( $params['type'] );
|
||||
if ( $rcTypes ) {
|
||||
|
|
@ -164,10 +164,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
$this->requireMaxOneParameter( $params, 'user', 'excludeuser' );
|
||||
if ( !is_null( $params['user'] ) ) {
|
||||
if ( $params['user'] !== null ) {
|
||||
$options['onlyByUser'] = $params['user'];
|
||||
}
|
||||
if ( !is_null( $params['excludeuser'] ) ) {
|
||||
if ( $params['excludeuser'] !== null ) {
|
||||
$options['notByUser'] = $params['excludeuser'];
|
||||
}
|
||||
|
||||
|
|
@ -201,7 +201,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
|
||||
foreach ( $items as list( $watchedItem, $recentChangeInfo ) ) {
|
||||
/** @var WatchedItem $watchedItem */
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$vals = $this->extractOutputData( $watchedItem, $recentChangeInfo );
|
||||
$fit = $this->getResult()->addValue( [ 'query', $this->getModuleName() ], null, $vals );
|
||||
if ( !$fit ) {
|
||||
|
|
@ -219,7 +219,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
|
|||
$this->setContinueEnumParameter( 'continue', implode( '|', $startFrom ) );
|
||||
}
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->getResult()->addIndexedTagName(
|
||||
[ 'query', $this->getModuleName() ],
|
||||
'item'
|
||||
|
|
|
|||
|
|
@ -128,10 +128,10 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
|
|||
}
|
||||
$t = Title::makeTitle( $ns, $dbKey );
|
||||
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$vals = [];
|
||||
ApiQueryBase::addTitleInfo( $vals, $t );
|
||||
if ( isset( $prop['changed'] ) && !is_null( $item->getNotificationTimestamp() ) ) {
|
||||
if ( isset( $prop['changed'] ) && $item->getNotificationTimestamp() !== null ) {
|
||||
$vals['changed'] = wfTimestamp( TS_ISO_8601, $item->getNotificationTimestamp() );
|
||||
}
|
||||
$fit = $this->getResult()->addValue( $this->getModuleName(), null, $vals );
|
||||
|
|
@ -143,7 +143,7 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
|
|||
$titles[] = $t;
|
||||
}
|
||||
}
|
||||
if ( is_null( $resultPageSet ) ) {
|
||||
if ( $resultPageSet === null ) {
|
||||
$this->getResult()->addIndexedTagName( $this->getModuleName(), 'wr' );
|
||||
} else {
|
||||
$resultPageSet->populateFromTitles( $titles );
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ class ApiSetNotificationTimestamp extends ApiBase {
|
|||
// Entire watchlist mode: Just update the thing and return a success indicator
|
||||
$watchedItemStore->resetAllNotificationTimestampsForUser( $user, $timestamp );
|
||||
|
||||
$result['notificationtimestamp'] = is_null( $timestamp )
|
||||
$result['notificationtimestamp'] = $timestamp === null
|
||||
? ''
|
||||
: wfTimestamp( TS_ISO_8601, $timestamp );
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class ApiTag extends ApiBase {
|
|||
}
|
||||
} else {
|
||||
$idResult['status'] = 'success';
|
||||
if ( is_null( $status->value->logId ) ) {
|
||||
if ( $status->value->logId === null ) {
|
||||
$idResult['noop'] = true;
|
||||
} else {
|
||||
$idResult['actionlogid'] = $status->value->logId;
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class ApiUnblock extends ApiBase {
|
|||
}
|
||||
|
||||
// Check if user can add tags
|
||||
if ( !is_null( $params['tags'] ) ) {
|
||||
if ( $params['tags'] !== null ) {
|
||||
$ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user );
|
||||
if ( !$ableToTag->isOK() ) {
|
||||
$this->dieStatus( $ableToTag );
|
||||
|
|
@ -76,7 +76,7 @@ class ApiUnblock extends ApiBase {
|
|||
}
|
||||
|
||||
$data = [
|
||||
'Target' => is_null( $params['id'] ) ? $params['user'] : "#{$params['id']}",
|
||||
'Target' => $params['id'] === null ? $params['user'] : "#{$params['id']}",
|
||||
'Reason' => $params['reason'],
|
||||
'Tags' => $params['tags']
|
||||
];
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class ApiUndelete extends ApiBase {
|
|||
}
|
||||
|
||||
// Check if user can add tags
|
||||
if ( !is_null( $params['tags'] ) ) {
|
||||
if ( $params['tags'] !== null ) {
|
||||
$ableToTag = ChangeTags::canAddTagsAccompanyingChange( $params['tags'], $user );
|
||||
if ( !$ableToTag->isOK() ) {
|
||||
$this->dieStatus( $ableToTag );
|
||||
|
|
|
|||
|
|
@ -450,7 +450,7 @@ class ApiUpload extends ApiBase {
|
|||
}
|
||||
|
||||
// The following modules all require the filename parameter to be set
|
||||
if ( is_null( $this->mParams['filename'] ) ) {
|
||||
if ( $this->mParams['filename'] === null ) {
|
||||
$this->dieWithError( [ 'apierror-missingparam', 'filename' ] );
|
||||
}
|
||||
|
||||
|
|
@ -761,7 +761,7 @@ class ApiUpload extends ApiBase {
|
|||
*/
|
||||
protected function performUpload( $warnings ) {
|
||||
// Use comment as initial page text by default
|
||||
if ( is_null( $this->mParams['text'] ) ) {
|
||||
if ( $this->mParams['text'] === null ) {
|
||||
$this->mParams['text'] = $this->mParams['comment'];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -284,12 +284,12 @@ class BlockManager {
|
|||
WebRequest $request
|
||||
) {
|
||||
$cookieValue = $request->getCookie( 'BlockID' );
|
||||
if ( is_null( $cookieValue ) ) {
|
||||
if ( $cookieValue === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$blockCookieId = $this->getIdFromCookieValue( $cookieValue );
|
||||
if ( !is_null( $blockCookieId ) ) {
|
||||
if ( $blockCookieId !== null ) {
|
||||
// TODO: remove dependency on DatabaseBlock (T221075)
|
||||
$block = DatabaseBlock::newFromID( $blockCookieId );
|
||||
if (
|
||||
|
|
|
|||
14
includes/cache/CacheHelper.php
vendored
14
includes/cache/CacheHelper.php
vendored
|
|
@ -114,12 +114,12 @@ class CacheHelper implements ICacheHelper {
|
|||
* @param bool|null $cacheEnabled Sets if the cache should be enabled or not.
|
||||
*/
|
||||
public function startCache( $cacheExpiry = null, $cacheEnabled = null ) {
|
||||
if ( is_null( $this->hasCached ) ) {
|
||||
if ( !is_null( $cacheExpiry ) ) {
|
||||
if ( $this->hasCached === null ) {
|
||||
if ( $cacheExpiry !== null ) {
|
||||
$this->cacheExpiry = $cacheExpiry;
|
||||
}
|
||||
|
||||
if ( !is_null( $cacheEnabled ) ) {
|
||||
if ( $cacheEnabled !== null ) {
|
||||
$this->setCacheEnabled( $cacheEnabled );
|
||||
}
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ class CacheHelper implements ICacheHelper {
|
|||
* @since 1.20
|
||||
*/
|
||||
protected function initCaching() {
|
||||
if ( $this->cacheEnabled && is_null( $this->hasCached ) ) {
|
||||
if ( $this->cacheEnabled && $this->hasCached === null ) {
|
||||
$cachedChunks = wfGetCache( CACHE_ANYTHING )->get( $this->getCacheKeyString() );
|
||||
|
||||
$this->hasCached = is_array( $cachedChunks );
|
||||
|
|
@ -205,14 +205,14 @@ class CacheHelper implements ICacheHelper {
|
|||
if ( $this->cacheEnabled && $this->hasCached ) {
|
||||
$value = null;
|
||||
|
||||
if ( is_null( $key ) ) {
|
||||
if ( $key === null ) {
|
||||
reset( $this->cachedChunks );
|
||||
$itemKey = key( $this->cachedChunks );
|
||||
|
||||
if ( !is_int( $itemKey ) ) {
|
||||
wfWarn( "Attempted to get item with non-numeric key while " .
|
||||
"the next item in the queue has a key ($itemKey) in " . __METHOD__ );
|
||||
} elseif ( is_null( $itemKey ) ) {
|
||||
} elseif ( $itemKey === null ) {
|
||||
wfWarn( "Attempted to get an item while the queue is empty in " . __METHOD__ );
|
||||
} else {
|
||||
$value = array_shift( $this->cachedChunks );
|
||||
|
|
@ -231,7 +231,7 @@ class CacheHelper implements ICacheHelper {
|
|||
$value = $computeFunction( ...$args );
|
||||
|
||||
if ( $this->cacheEnabled ) {
|
||||
if ( is_null( $key ) ) {
|
||||
if ( $key === null ) {
|
||||
$this->cachedChunks[] = $value;
|
||||
} else {
|
||||
$this->cachedChunks[$key] = $value;
|
||||
|
|
|
|||
2
includes/cache/dependency/FileDependency.php
vendored
2
includes/cache/dependency/FileDependency.php
vendored
|
|
@ -55,7 +55,7 @@ class FileDependency extends CacheDependency {
|
|||
}
|
||||
|
||||
function loadDependencyValues() {
|
||||
if ( is_null( $this->timestamp ) ) {
|
||||
if ( $this->timestamp === null ) {
|
||||
Wikimedia\suppressWarnings();
|
||||
# Dependency on a non-existent file stores "false"
|
||||
# This is a valid concept!
|
||||
|
|
|
|||
2
includes/cache/localisation/LCStoreCDB.php
vendored
2
includes/cache/localisation/LCStoreCDB.php
vendored
|
|
@ -113,7 +113,7 @@ class LCStoreCDB implements LCStore {
|
|||
}
|
||||
|
||||
public function set( $key, $value ) {
|
||||
if ( is_null( $this->writer ) ) {
|
||||
if ( $this->writer === null ) {
|
||||
throw new MWException( __CLASS__ . ': must call startWrite() before calling set()' );
|
||||
}
|
||||
try {
|
||||
|
|
|
|||
4
includes/cache/localisation/LCStoreDB.php
vendored
4
includes/cache/localisation/LCStoreDB.php
vendored
|
|
@ -83,7 +83,7 @@ class LCStoreDB implements LCStore {
|
|||
public function finishWrite() {
|
||||
if ( $this->readOnly ) {
|
||||
return;
|
||||
} elseif ( is_null( $this->code ) ) {
|
||||
} elseif ( $this->code === null ) {
|
||||
throw new MWException( __CLASS__ . ': must call startWrite() before finishWrite()' );
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ class LCStoreDB implements LCStore {
|
|||
public function set( $key, $value ) {
|
||||
if ( $this->readOnly ) {
|
||||
return;
|
||||
} elseif ( is_null( $this->code ) ) {
|
||||
} elseif ( $this->code === null ) {
|
||||
throw new MWException( __CLASS__ . ': must call startWrite() before set()' );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -743,8 +743,8 @@ class LocalisationCache {
|
|||
* @param mixed $fallbackValue
|
||||
*/
|
||||
protected function mergeItem( $key, &$value, $fallbackValue ) {
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( !is_null( $fallbackValue ) ) {
|
||||
if ( $value !== null ) {
|
||||
if ( $fallbackValue !== null ) {
|
||||
if ( in_array( $key, self::$mergeableMapKeys ) ) {
|
||||
$value = $value + $fallbackValue;
|
||||
} elseif ( in_array( $key, self::$mergeableListKeys ) ) {
|
||||
|
|
@ -859,11 +859,11 @@ class LocalisationCache {
|
|||
}
|
||||
|
||||
# Fill in the fallback if it's not there already
|
||||
if ( ( is_null( $coreData['fallback'] ) || $coreData['fallback'] === false ) && $code === 'en' ) {
|
||||
if ( ( $coreData['fallback'] === null || $coreData['fallback'] === false ) && $code === 'en' ) {
|
||||
$coreData['fallback'] = false;
|
||||
$coreData['originalFallbackSequence'] = $coreData['fallbackSequence'] = [];
|
||||
} else {
|
||||
if ( !is_null( $coreData['fallback'] ) ) {
|
||||
if ( $coreData['fallback'] !== null ) {
|
||||
$coreData['fallbackSequence'] = array_map( 'trim', explode( ',', $coreData['fallback'] ) );
|
||||
} else {
|
||||
$coreData['fallbackSequence'] = [];
|
||||
|
|
@ -949,7 +949,7 @@ class LocalisationCache {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( is_null( $coreData[ $key ] ) || $this->isMergeableKey( $key ) ) {
|
||||
if ( ( $coreData[ $key ] ) === null || $this->isMergeableKey( $key ) ) {
|
||||
$this->mergeItem( $key, $csData[ $key ], $fbData[ $key ] );
|
||||
}
|
||||
}
|
||||
|
|
@ -968,7 +968,7 @@ class LocalisationCache {
|
|||
continue;
|
||||
}
|
||||
|
||||
if ( is_null( $allData[$key] ) || $this->isMergeableKey( $key ) ) {
|
||||
if ( $allData[$key] === null || $this->isMergeableKey( $key ) ) {
|
||||
$this->mergeItem( $key, $allData[$key], $csData[$key] );
|
||||
}
|
||||
}
|
||||
|
|
@ -1016,7 +1016,7 @@ class LocalisationCache {
|
|||
$unused = true; // Used to be $purgeBlobs, removed in 1.34
|
||||
Hooks::run( 'LocalisationCacheRecache', [ $this, $code, &$allData, &$unused ] );
|
||||
|
||||
if ( is_null( $allData['namespaceNames'] ) ) {
|
||||
if ( $allData['namespaceNames'] === null ) {
|
||||
throw new MWException( __METHOD__ . ': Localisation data failed sanity check! ' .
|
||||
'Check that your languages/messages/MessagesEn.php file is intact.' );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ class ChangesList extends ContextSource {
|
|||
static $map = [ 'minoredit' => 'minor', 'botedit' => 'bot' ];
|
||||
static $flagInfos = null;
|
||||
|
||||
if ( is_null( $flagInfos ) ) {
|
||||
if ( $flagInfos === null ) {
|
||||
global $wgRecentChangesFlags;
|
||||
$flagInfos = [];
|
||||
foreach ( $wgRecentChangesFlags as $key => $value ) {
|
||||
|
|
|
|||
|
|
@ -523,7 +523,7 @@ class ChangeTags {
|
|||
* @since 1.25
|
||||
*/
|
||||
public static function canAddTagsAccompanyingChange( array $tags, User $user = null ) {
|
||||
if ( !is_null( $user ) ) {
|
||||
if ( $user !== null ) {
|
||||
if ( !MediaWikiServices::getInstance()->getPermissionManager()
|
||||
->userHasRight( $user, 'applychangetags' )
|
||||
) {
|
||||
|
|
@ -598,7 +598,7 @@ class ChangeTags {
|
|||
public static function canUpdateTags( array $tagsToAdd, array $tagsToRemove,
|
||||
User $user = null
|
||||
) {
|
||||
if ( !is_null( $user ) ) {
|
||||
if ( $user !== null ) {
|
||||
if ( !MediaWikiServices::getInstance()->getPermissionManager()
|
||||
->userHasRight( $user, 'changetags' )
|
||||
) {
|
||||
|
|
@ -667,10 +667,10 @@ class ChangeTags {
|
|||
public static function updateTagsWithChecks( $tagsToAdd, $tagsToRemove,
|
||||
$rc_id, $rev_id, $log_id, $params, $reason, User $user
|
||||
) {
|
||||
if ( is_null( $tagsToAdd ) ) {
|
||||
if ( $tagsToAdd === null ) {
|
||||
$tagsToAdd = [];
|
||||
}
|
||||
if ( is_null( $tagsToRemove ) ) {
|
||||
if ( $tagsToRemove === null ) {
|
||||
$tagsToRemove = [];
|
||||
}
|
||||
if ( !$tagsToAdd && !$tagsToRemove ) {
|
||||
|
|
@ -996,7 +996,7 @@ class ChangeTags {
|
|||
$logEntry->setComment( $reason );
|
||||
|
||||
$params = [ '4::tag' => $tag ];
|
||||
if ( !is_null( $tagCount ) ) {
|
||||
if ( $tagCount !== null ) {
|
||||
$params['5:number:count'] = $tagCount;
|
||||
}
|
||||
$logEntry->setParameters( $params );
|
||||
|
|
@ -1018,7 +1018,7 @@ class ChangeTags {
|
|||
* @since 1.25
|
||||
*/
|
||||
public static function canActivateTag( $tag, User $user = null ) {
|
||||
if ( !is_null( $user ) ) {
|
||||
if ( $user !== null ) {
|
||||
if ( !MediaWikiServices::getInstance()->getPermissionManager()
|
||||
->userHasRight( $user, 'managechangetags' )
|
||||
) {
|
||||
|
|
@ -1092,7 +1092,7 @@ class ChangeTags {
|
|||
* @since 1.25
|
||||
*/
|
||||
public static function canDeactivateTag( $tag, User $user = null ) {
|
||||
if ( !is_null( $user ) ) {
|
||||
if ( $user !== null ) {
|
||||
if ( !MediaWikiServices::getInstance()->getPermissionManager()
|
||||
->userHasRight( $user, 'managechangetags' )
|
||||
) {
|
||||
|
|
@ -1171,7 +1171,7 @@ class ChangeTags {
|
|||
|
||||
// could the MediaWiki namespace description messages be created?
|
||||
$title = Title::makeTitleSafe( NS_MEDIAWIKI, "Tag-$tag-description" );
|
||||
if ( is_null( $title ) ) {
|
||||
if ( $title === null ) {
|
||||
return Status::newFatal( 'tags-create-invalid-title-chars' );
|
||||
}
|
||||
|
||||
|
|
@ -1191,7 +1191,7 @@ class ChangeTags {
|
|||
* @since 1.25
|
||||
*/
|
||||
public static function canCreateTag( $tag, User $user = null ) {
|
||||
if ( !is_null( $user ) ) {
|
||||
if ( $user !== null ) {
|
||||
if ( !MediaWikiServices::getInstance()->getPermissionManager()
|
||||
->userHasRight( $user, 'managechangetags' )
|
||||
) {
|
||||
|
|
@ -1314,7 +1314,7 @@ class ChangeTags {
|
|||
public static function canDeleteTag( $tag, User $user = null, int $flags = 0 ) {
|
||||
$tagUsage = self::tagUsageStatistics();
|
||||
|
||||
if ( !is_null( $user ) ) {
|
||||
if ( $user !== null ) {
|
||||
if ( !MediaWikiServices::getInstance()->getPermissionManager()
|
||||
->userHasRight( $user, 'deletechangetags' )
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ abstract class AbstractContent implements Content {
|
|||
* @see Content::equals
|
||||
*/
|
||||
public function equals( Content $that = null ) {
|
||||
if ( is_null( $that ) ) {
|
||||
if ( $that === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +291,7 @@ abstract class AbstractContent implements Content {
|
|||
public function getRedirectChain() {
|
||||
global $wgMaxRedirects;
|
||||
$title = $this->getRedirectTarget();
|
||||
if ( is_null( $title ) ) {
|
||||
if ( $title === null ) {
|
||||
return null;
|
||||
}
|
||||
// recursive check to follow double redirects
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ abstract class ContentHandler {
|
|||
public static function getContentText( Content $content = null ) {
|
||||
global $wgContentHandlerTextFallback;
|
||||
|
||||
if ( is_null( $content ) ) {
|
||||
if ( $content === null ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
@ -134,8 +134,8 @@ abstract class ContentHandler {
|
|||
*/
|
||||
public static function makeContent( $text, Title $title = null,
|
||||
$modelId = null, $format = null ) {
|
||||
if ( is_null( $modelId ) ) {
|
||||
if ( is_null( $title ) ) {
|
||||
if ( $modelId === null ) {
|
||||
if ( $title === null ) {
|
||||
throw new MWException( "Must provide a Title object or a content model ID." );
|
||||
}
|
||||
|
||||
|
|
@ -1025,7 +1025,7 @@ abstract class ContentHandler {
|
|||
// Get the last revision
|
||||
$rev = Revision::newFromTitle( $title );
|
||||
|
||||
if ( is_null( $rev ) ) {
|
||||
if ( $rev === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ class WikiTextStructure {
|
|||
* Extract parts of the text - opening, main and auxiliary.
|
||||
*/
|
||||
private function extractWikitextParts() {
|
||||
if ( !is_null( $this->allText ) ) {
|
||||
if ( $this->allText !== null ) {
|
||||
return;
|
||||
}
|
||||
$text = $this->parserOutput->getText( [
|
||||
|
|
|
|||
|
|
@ -127,7 +127,10 @@ class AvroFormatter implements FormatterInterface {
|
|||
if ( !isset( $this->schemas[$channel] ) ) {
|
||||
return null;
|
||||
}
|
||||
if ( !isset( $this->schemas[$channel]['revision'], $this->schemas[$channel]['schema'] ) ) {
|
||||
if (
|
||||
!isset( $this->schemas[$channel]['revision'] )
|
||||
&& !isset( $this->schemas[$channel]['schema'] )
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1936,7 +1936,7 @@ class DifferenceEngine extends ContextSource {
|
|||
}
|
||||
} /* elseif ( $this->mOldid === false ) leave mOldRev false; */
|
||||
|
||||
if ( is_null( $this->mOldRev ) ) {
|
||||
if ( $this->mOldRev === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ class TextSlotDiffRenderer extends SlotDiffRenderer {
|
|||
Assert::parameter( is_string( $executable ) && is_executable( $executable ), '$executable',
|
||||
'must be a path to a valid executable' );
|
||||
} else {
|
||||
Assert::parameter( is_null( $executable ), '$executable',
|
||||
Assert::parameter( $executable === null, '$executable',
|
||||
'must not be set unless $type is ENGINE_EXTERNAL' );
|
||||
}
|
||||
$this->engine = $type;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class DumpPipeOutput extends DumpFileOutput {
|
|||
* @param string|null $file
|
||||
*/
|
||||
public function __construct( $command, $file = null ) {
|
||||
if ( !is_null( $file ) ) {
|
||||
if ( $file !== null ) {
|
||||
$command .= " > " . Shell::escape( $file );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ class WikiExporter {
|
|||
*/
|
||||
public function pageByName( $name ) {
|
||||
$title = Title::newFromText( $name );
|
||||
if ( is_null( $title ) ) {
|
||||
if ( $title === null ) {
|
||||
throw new MWException( "Can't export invalid title" );
|
||||
} else {
|
||||
$this->pageByTitle( $title );
|
||||
|
|
|
|||
|
|
@ -786,18 +786,18 @@ class FileRepo {
|
|||
*/
|
||||
public function getDescriptionUrl( $name ) {
|
||||
$encName = wfUrlencode( $name );
|
||||
if ( !is_null( $this->descBaseUrl ) ) {
|
||||
if ( $this->descBaseUrl !== null ) {
|
||||
# "http://example.com/wiki/File:"
|
||||
return $this->descBaseUrl . $encName;
|
||||
}
|
||||
if ( !is_null( $this->articleUrl ) ) {
|
||||
if ( $this->articleUrl !== null ) {
|
||||
# "http://example.com/wiki/$1"
|
||||
# We use "Image:" as the canonical namespace for
|
||||
# compatibility across all MediaWiki versions.
|
||||
return str_replace( '$1',
|
||||
"Image:$encName", $this->articleUrl );
|
||||
}
|
||||
if ( !is_null( $this->scriptDirUrl ) ) {
|
||||
if ( $this->scriptDirUrl !== null ) {
|
||||
# "http://example.com/w"
|
||||
# We use "Image:" as the canonical namespace for
|
||||
# compatibility across all MediaWiki versions,
|
||||
|
|
@ -820,7 +820,7 @@ class FileRepo {
|
|||
*/
|
||||
public function getDescriptionRenderUrl( $name, $lang = null ) {
|
||||
$query = 'action=render';
|
||||
if ( !is_null( $lang ) ) {
|
||||
if ( $lang !== null ) {
|
||||
$query .= '&uselang=' . urlencode( $lang );
|
||||
}
|
||||
if ( isset( $this->scriptDirUrl ) ) {
|
||||
|
|
|
|||
|
|
@ -643,7 +643,7 @@ class LocalFile extends File {
|
|||
}
|
||||
|
||||
$upgrade = false;
|
||||
if ( is_null( $this->media_type ) || $this->mime == 'image/svg' ) {
|
||||
if ( $this->media_type === null || $this->mime == 'image/svg' ) {
|
||||
$upgrade = true;
|
||||
} else {
|
||||
$handler = $this->getHandler();
|
||||
|
|
@ -1276,7 +1276,7 @@ class LocalFile extends File {
|
|||
public function resetHistory() {
|
||||
$this->historyLine = 0;
|
||||
|
||||
if ( !is_null( $this->historyRes ) ) {
|
||||
if ( $this->historyRes !== null ) {
|
||||
$this->historyRes = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1441,7 +1441,7 @@ class LocalFile extends File {
|
|||
$oldver, $comment, $pageText, $props = false, $timestamp = false, $user = null, $tags = [],
|
||||
$createNullRevision = true, $revert = false
|
||||
) {
|
||||
if ( is_null( $user ) ) {
|
||||
if ( $user === null ) {
|
||||
global $wgUser;
|
||||
$user = $wgUser;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,10 +171,10 @@ class LocalFileRestoreBatch {
|
|||
$sha1 = substr( $sha1, 1 );
|
||||
}
|
||||
|
||||
if ( is_null( $row->fa_major_mime ) || $row->fa_major_mime == 'unknown'
|
||||
|| is_null( $row->fa_minor_mime ) || $row->fa_minor_mime == 'unknown'
|
||||
|| is_null( $row->fa_media_type ) || $row->fa_media_type == 'UNKNOWN'
|
||||
|| is_null( $row->fa_metadata )
|
||||
if ( $row->fa_major_mime === null || $row->fa_major_mime == 'unknown'
|
||||
|| $row->fa_minor_mime === null || $row->fa_minor_mime == 'unknown'
|
||||
|| $row->fa_media_type === null || $row->fa_media_type == 'UNKNOWN'
|
||||
|| $row->fa_metadata === null
|
||||
) {
|
||||
// Refresh our metadata
|
||||
// Required for a new current revision; nice for older ones too. :)
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ class OldLocalFile extends LocalFile {
|
|||
parent::__construct( $title, $repo );
|
||||
$this->requestedTime = $time;
|
||||
$this->archive_name = $archiveName;
|
||||
if ( is_null( $time ) && is_null( $archiveName ) ) {
|
||||
if ( $time === null && $archiveName === null ) {
|
||||
throw new MWException( __METHOD__ . ': must specify at least one of $time or $archiveName' );
|
||||
}
|
||||
}
|
||||
|
|
@ -207,7 +207,7 @@ class OldLocalFile extends LocalFile {
|
|||
: $this->repo->getReplicaDB();
|
||||
|
||||
$conds = [ 'oi_name' => $this->getName() ];
|
||||
if ( is_null( $this->requestedTime ) ) {
|
||||
if ( $this->requestedTime === null ) {
|
||||
$conds['oi_archive_name'] = $this->archive_name;
|
||||
} else {
|
||||
$conds['oi_timestamp'] = $dbr->timestamp( $this->requestedTime );
|
||||
|
|
@ -235,7 +235,7 @@ class OldLocalFile extends LocalFile {
|
|||
$this->extraDataLoaded = true;
|
||||
$dbr = $this->repo->getReplicaDB();
|
||||
$conds = [ 'oi_name' => $this->getName() ];
|
||||
if ( is_null( $this->requestedTime ) ) {
|
||||
if ( $this->requestedTime === null ) {
|
||||
$conds['oi_archive_name'] = $this->archive_name;
|
||||
} else {
|
||||
$conds['oi_timestamp'] = $dbr->timestamp( $this->requestedTime );
|
||||
|
|
|
|||
|
|
@ -757,7 +757,7 @@ abstract class HTMLFormField {
|
|||
* @return string
|
||||
*/
|
||||
public function getHelpTextHtmlTable( $helptext ) {
|
||||
if ( is_null( $helptext ) ) {
|
||||
if ( $helptext === null ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
@ -786,7 +786,7 @@ abstract class HTMLFormField {
|
|||
* @return string
|
||||
*/
|
||||
public function getHelpTextHtmlDiv( $helptext ) {
|
||||
if ( is_null( $helptext ) ) {
|
||||
if ( $helptext === null ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
|
@ -833,7 +833,7 @@ abstract class HTMLFormField {
|
|||
$msg = $this->getMessage( $msg );
|
||||
|
||||
if ( $msg->exists() ) {
|
||||
if ( is_null( $helptext ) ) {
|
||||
if ( $helptext === null ) {
|
||||
$helptext = '';
|
||||
} else {
|
||||
$helptext .= $this->msg( 'word-separator' )->escaped(); // some space
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ class OOUIHTMLForm extends HTMLForm {
|
|||
}
|
||||
|
||||
public function getHeaderText( $section = null ) {
|
||||
if ( is_null( $section ) ) {
|
||||
if ( $section === null ) {
|
||||
// We handle $this->mHeader elsewhere, in getBody()
|
||||
return '';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class HTMLNamespacesMultiselectField extends HTMLSelectNamespace {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( is_null( $value ) ) {
|
||||
if ( $value === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ class HTMLNamespacesMultiselectField extends HTMLSelectNamespace {
|
|||
$params['input'] = $this->mParams['input'];
|
||||
}
|
||||
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
// $value is a string, but the widget expects an array
|
||||
$params['default'] = $value === '' ? [] : explode( "\n", $value );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class HTMLTitlesMultiselectField extends HTMLTitleTextField {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( is_null( $value ) ) {
|
||||
if ( $value === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class HTMLTitlesMultiselectField extends HTMLTitleTextField {
|
|||
$params['input'] = $this->mParams['input'];
|
||||
}
|
||||
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
// $value is a string, but the widget expects an array
|
||||
$params['default'] = $value === '' ? [] : explode( "\n", $value );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class HTMLUsersMultiselectField extends HTMLUserTextField {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( is_null( $value ) ) {
|
||||
if ( $value === null ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ class HTMLUsersMultiselectField extends HTMLUserTextField {
|
|||
$params['ipRangeLimits'] = $this->mParams['iprangelimits'];
|
||||
}
|
||||
|
||||
if ( !is_null( $value ) ) {
|
||||
if ( $value !== null ) {
|
||||
// $value is a string, but the widget expects an array
|
||||
$params['default'] = $value === '' ? [] : explode( "\n", $value );
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue