Simplify WHERE conditions with field IS NULL
Reduce raw sql fragments on simple compares Change-Id: I3f2340dfdbf5197cc22546911e6c5653dc5a6269
This commit is contained in:
parent
994e7b145e
commit
6e0065ad20
41 changed files with 73 additions and 74 deletions
|
|
@ -444,9 +444,9 @@ class PageHistoryCountHandler extends SimpleHandler {
|
|||
->join( 'actor', null, 'rev_actor = actor_id' )
|
||||
->where( [
|
||||
'rev_page' => $pageId,
|
||||
'actor_user IS NULL',
|
||||
'actor_user' => null,
|
||||
$dbr->bitAnd( 'rev_deleted',
|
||||
RevisionRecord::DELETED_TEXT | RevisionRecord::DELETED_USER ) . " = 0"
|
||||
RevisionRecord::DELETED_TEXT | RevisionRecord::DELETED_USER ) => 0,
|
||||
] )
|
||||
->limit( self::COUNT_LIMITS['anonymous'] + 1 ); // extra to detect truncation
|
||||
|
||||
|
|
@ -471,9 +471,9 @@ class PageHistoryCountHandler extends SimpleHandler {
|
|||
$revQuery = $this->actorMigration->getJoin( 'rev_user' );
|
||||
|
||||
$cond = [
|
||||
'rev_page=' . intval( $pageId ),
|
||||
'rev_page' => intval( $pageId ),
|
||||
$dbr->bitAnd( 'rev_deleted',
|
||||
RevisionRecord::DELETED_TEXT | RevisionRecord::DELETED_USER ) . " = 0",
|
||||
RevisionRecord::DELETED_TEXT | RevisionRecord::DELETED_USER ) => 0,
|
||||
'EXISTS(' .
|
||||
$dbr->selectSQLText(
|
||||
'user_groups',
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ class PageHistoryHandler extends SimpleHandler {
|
|||
break;
|
||||
|
||||
case 'anonymous':
|
||||
$cond[] = "actor_user IS NULL";
|
||||
$cond['actor_user'] = null;
|
||||
$bitmask = $this->getBitmask();
|
||||
if ( $bitmask ) {
|
||||
$cond[] = $dbr->bitAnd( 'rev_deleted', $bitmask ) . " != $bitmask";
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
|
|||
if ( $params['filterlanglinks'] == 'withoutlanglinks' ) {
|
||||
$this->addTables( 'langlinks' );
|
||||
$this->addJoinConds( [ 'langlinks' => [ 'LEFT JOIN', 'page_id=ll_from' ] ] );
|
||||
$this->addWhere( 'll_from IS NULL' );
|
||||
$this->addWhere( [ 'll_from' => null ] );
|
||||
$forceNameTitleIndex = false;
|
||||
} elseif ( $params['filterlanglinks'] == 'withlanglinks' ) {
|
||||
$this->addTables( 'langlinks' );
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ class ApiQueryAllUsers extends ApiQueryBase {
|
|||
'ug1.ug_expiry IS NULL OR ug1.ug_expiry >= ' . $db->addQuotes( $db->timestamp() )
|
||||
], $exclude )
|
||||
] ] );
|
||||
$this->addWhere( 'ug1.ug_user IS NULL' );
|
||||
$this->addWhere( [ 'ug1.ug_user' => null ] );
|
||||
}
|
||||
|
||||
if ( $params['witheditsonly'] ) {
|
||||
|
|
|
|||
|
|
@ -187,12 +187,11 @@ class ApiQueryBlocks extends ApiQueryBase {
|
|||
$this->dieWithError( 'apierror-show' );
|
||||
}
|
||||
|
||||
$this->addWhereIf( 'ipb_user = 0', isset( $show['!account'] ) );
|
||||
$this->addWhereIf( [ 'ipb_user' => 0 ], isset( $show['!account'] ) );
|
||||
$this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) );
|
||||
$this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) );
|
||||
$this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) );
|
||||
$this->addWhereIf( 'ipb_expiry = ' .
|
||||
$db->addQuotes( $db->getInfinity() ), isset( $show['!temp'] ) );
|
||||
$this->addWhereIf( [ 'ipb_expiry' => $db->getInfinity() ], isset( $show['!temp'] ) );
|
||||
$this->addWhereIf( 'ipb_expiry != ' .
|
||||
$db->addQuotes( $db->getInfinity() ), isset( $show['temp'] ) );
|
||||
$this->addWhereIf( 'ipb_range_end = ipb_range_start', isset( $show['!range'] ) );
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
|
|||
if ( isset( $show['hidden'] ) ) {
|
||||
$this->addWhere( [ 'pp_propname IS NOT NULL' ] );
|
||||
} elseif ( isset( $show['!hidden'] ) ) {
|
||||
$this->addWhere( [ 'pp_propname IS NULL' ] );
|
||||
$this->addWhere( [ 'pp_propname' => null ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class ApiQueryContributors extends ApiQueryBase {
|
|||
] );
|
||||
$this->addWhereFld( $pageField, $pages );
|
||||
$this->addWhere( $this->actorMigration->isAnon( $revQuery['fields']['rev_user'] ) );
|
||||
$this->addWhere( $db->bitAnd( 'rev_deleted', RevisionRecord::DELETED_USER ) . ' = 0' );
|
||||
$this->addWhere( [ $db->bitAnd( 'rev_deleted', RevisionRecord::DELETED_USER ) => 0 ] );
|
||||
$this->addOption( 'GROUP BY', $pageField );
|
||||
$res = $this->select( __METHOD__ );
|
||||
foreach ( $res as $row ) {
|
||||
|
|
@ -157,7 +157,7 @@ class ApiQueryContributors extends ApiQueryBase {
|
|||
] );
|
||||
$this->addWhereFld( $pageField, $pages );
|
||||
$this->addWhere( $this->actorMigration->isNotAnon( $revQuery['fields']['rev_user'] ) );
|
||||
$this->addWhere( $db->bitAnd( 'rev_deleted', RevisionRecord::DELETED_USER ) . ' = 0' );
|
||||
$this->addWhere( [ $db->bitAnd( 'rev_deleted', RevisionRecord::DELETED_USER ) => 0 ] );
|
||||
$this->addOption( 'GROUP BY', [ $pageField, $idField ] );
|
||||
$this->addOption( 'LIMIT', $params['limit'] + 1 );
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ class ApiQueryContributors extends ApiQueryBase {
|
|||
] ] );
|
||||
// @phan-suppress-next-next-line PhanTypeMismatchArgumentNullable,PhanPossiblyUndeclaredVariable
|
||||
// excludeGroups declared when limitGroups set
|
||||
$this->addWhereIf( 'ug_user IS NULL', $excludeGroups );
|
||||
$this->addWhereIf( [ 'ug_user' => null ], $excludeGroups );
|
||||
}
|
||||
|
||||
if ( $params['continue'] !== null ) {
|
||||
|
|
|
|||
|
|
@ -55,8 +55,9 @@ class ApiQueryMyStashedFiles extends ApiQueryBase {
|
|||
|
||||
if ( $params['continue'] !== null ) {
|
||||
$cont = $this->parseContinueParamOrDie( $params['continue'], [ 'int' ] );
|
||||
$cont_from = (int)$cont[0];
|
||||
$this->addWhere( "us_id >= $cont_from" );
|
||||
$this->addWhere( $this->getDB()->buildComparison( '>=', [
|
||||
'us_id' => (int)$cont[0],
|
||||
] ) );
|
||||
}
|
||||
|
||||
$this->addOption( 'LIMIT', $params['limit'] + 1 );
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
|
|||
}
|
||||
}
|
||||
if ( $end !== null ) {
|
||||
$this->addWhere( 'page_random < ' . $this->getDB()->addQuotes( $end ) );
|
||||
$this->addWhere( $this->getDB()->buildComparison( '<', [ 'page_random' => $end ] ) );
|
||||
}
|
||||
$this->addOption( 'ORDER BY', [ 'page_random', 'page_id' ] );
|
||||
|
||||
|
|
|
|||
|
|
@ -197,30 +197,30 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
}
|
||||
|
||||
/* Add additional conditions to query depending upon parameters. */
|
||||
$this->addWhereIf( 'rc_minor = 0', isset( $show['!minor'] ) );
|
||||
$this->addWhereIf( [ 'rc_minor' => 0 ], isset( $show['!minor'] ) );
|
||||
$this->addWhereIf( 'rc_minor != 0', isset( $show['minor'] ) );
|
||||
$this->addWhereIf( 'rc_bot = 0', isset( $show['!bot'] ) );
|
||||
$this->addWhereIf( [ 'rc_bot' => 0 ], isset( $show['!bot'] ) );
|
||||
$this->addWhereIf( 'rc_bot != 0', isset( $show['bot'] ) );
|
||||
if ( isset( $show['anon'] ) || isset( $show['!anon'] ) ) {
|
||||
$this->addTables( 'actor', 'actor' );
|
||||
$this->addJoinConds( [ 'actor' => [ 'JOIN', 'actor_id=rc_actor' ] ] );
|
||||
$this->addWhereIf(
|
||||
'actor_user IS NULL', isset( $show['anon'] )
|
||||
[ 'actor_user' => null ], isset( $show['anon'] )
|
||||
);
|
||||
$this->addWhereIf(
|
||||
'actor_user IS NOT NULL', isset( $show['!anon'] )
|
||||
);
|
||||
}
|
||||
$this->addWhereIf( 'rc_patrolled = 0', isset( $show['!patrolled'] ) );
|
||||
$this->addWhereIf( [ 'rc_patrolled' => 0 ], isset( $show['!patrolled'] ) );
|
||||
$this->addWhereIf( 'rc_patrolled != 0', isset( $show['patrolled'] ) );
|
||||
$this->addWhereIf( 'page_is_redirect = 1', isset( $show['redirect'] ) );
|
||||
$this->addWhereIf( [ 'page_is_redirect' => 1 ], isset( $show['redirect'] ) );
|
||||
|
||||
if ( isset( $show['unpatrolled'] ) ) {
|
||||
// See ChangesList::isUnpatrolled
|
||||
if ( $user->useRCPatrol() ) {
|
||||
$this->addWhere( 'rc_patrolled = ' . RecentChange::PRC_UNPATROLLED );
|
||||
$this->addWhereFld( 'rc_patrolled', RecentChange::PRC_UNPATROLLED );
|
||||
} elseif ( $user->useNPPatrol() ) {
|
||||
$this->addWhere( 'rc_patrolled = ' . RecentChange::PRC_UNPATROLLED );
|
||||
$this->addWhereFld( 'rc_patrolled', RecentChange::PRC_UNPATROLLED );
|
||||
$this->addWhereFld( 'rc_type', RC_NEW );
|
||||
}
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
isset( $show['!autopatrolled'] )
|
||||
);
|
||||
$this->addWhereIf(
|
||||
'rc_patrolled = ' . RecentChange::PRC_AUTOPATROLLED,
|
||||
[ 'rc_patrolled' => RecentChange::PRC_AUTOPATROLLED ],
|
||||
isset( $show['autopatrolled'] )
|
||||
);
|
||||
|
||||
|
|
@ -412,7 +412,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
|
|||
} else {
|
||||
// Calling $this->addWhere() with an empty array does nothing, so explicitly
|
||||
// add an unsatisfiable condition
|
||||
$this->addWhere( 'rc_type IS NULL' );
|
||||
$this->addWhere( [ 'rc_type' => null ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -366,7 +366,9 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase {
|
|||
$this->addWhereFld( 'rev_id', array_keys( $revs ) );
|
||||
|
||||
if ( $params['continue'] !== null ) {
|
||||
$this->addWhere( 'rev_id >= ' . (int)$params['continue'] );
|
||||
$this->addWhere( $db->buildComparison( '>=', [
|
||||
'rev_id' => (int)$params['continue']
|
||||
] ) );
|
||||
}
|
||||
$this->addOption( 'ORDER BY', 'rev_id' );
|
||||
} elseif ( $pageCount > 0 ) {
|
||||
|
|
|
|||
|
|
@ -476,10 +476,10 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
$this->dieWithError( 'apierror-show' );
|
||||
}
|
||||
|
||||
$this->addWhereIf( 'rev_minor_edit = 0', isset( $show['!minor'] ) );
|
||||
$this->addWhereIf( [ 'rev_minor_edit' => 0 ], isset( $show['!minor'] ) );
|
||||
$this->addWhereIf( 'rev_minor_edit != 0', isset( $show['minor'] ) );
|
||||
$this->addWhereIf(
|
||||
'rc_patrolled = ' . RecentChange::PRC_UNPATROLLED,
|
||||
[ 'rc_patrolled' => RecentChange::PRC_UNPATROLLED ],
|
||||
isset( $show['!patrolled'] )
|
||||
);
|
||||
$this->addWhereIf(
|
||||
|
|
@ -491,13 +491,13 @@ class ApiQueryUserContribs extends ApiQueryBase {
|
|||
isset( $show['!autopatrolled'] )
|
||||
);
|
||||
$this->addWhereIf(
|
||||
'rc_patrolled = ' . RecentChange::PRC_AUTOPATROLLED,
|
||||
[ 'rc_patrolled' => RecentChange::PRC_AUTOPATROLLED ],
|
||||
isset( $show['autopatrolled'] )
|
||||
);
|
||||
$this->addWhereIf( $idField . ' != page_latest', isset( $show['!top'] ) );
|
||||
$this->addWhereIf( $idField . ' = page_latest', isset( $show['top'] ) );
|
||||
$this->addWhereIf( 'rev_parent_id != 0', isset( $show['!new'] ) );
|
||||
$this->addWhereIf( 'rev_parent_id = 0', isset( $show['new'] ) );
|
||||
$this->addWhereIf( [ 'rev_parent_id' => 0 ], isset( $show['new'] ) );
|
||||
}
|
||||
$this->addOption( 'LIMIT', $limit + 1 );
|
||||
|
||||
|
|
|
|||
5
includes/cache/BacklinkCache.php
vendored
5
includes/cache/BacklinkCache.php
vendored
|
|
@ -305,10 +305,7 @@ class BacklinkCache {
|
|||
$queryBuilder->where( [
|
||||
"{$prefix}_namespace" => $this->page->getNamespace(),
|
||||
"{$prefix}_title" => $this->page->getDBkey(),
|
||||
$this->getDB()->makeList( [
|
||||
"{$prefix}_interwiki" => '',
|
||||
"{$prefix}_interwiki IS NULL",
|
||||
], LIST_OR ),
|
||||
"{$prefix}_interwiki" => [ '', null ],
|
||||
] );
|
||||
break;
|
||||
case 'imagelinks':
|
||||
|
|
|
|||
|
|
@ -836,7 +836,7 @@ class ChangeTagsStore {
|
|||
'LEFT JOIN',
|
||||
[ $join_cond, self::DISPLAY_TABLE_ALIAS . '.ct_tag_id' => $filterTagIds ]
|
||||
];
|
||||
$conds[] = self::DISPLAY_TABLE_ALIAS . ".ct_tag_id IS NULL";
|
||||
$conds[self::DISPLAY_TABLE_ALIAS . '.ct_tag_id'] = null;
|
||||
}
|
||||
} else {
|
||||
$tables[self::DISPLAY_TABLE_ALIAS] = self::CHANGE_TAG;
|
||||
|
|
|
|||
|
|
@ -1818,7 +1818,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
[
|
||||
'user_editcount >= ' . intval( $config->get( MainConfigNames::LearnerEdits ) ),
|
||||
$dbr->makeList( [
|
||||
'user_registration IS NULL',
|
||||
'user_registration' => null,
|
||||
'user_registration <= ' . $dbr->addQuotes( $dbr->timestamp( $learnerCutoff ) ),
|
||||
], IReadableDatabase::LIST_OR ),
|
||||
],
|
||||
|
|
@ -1829,7 +1829,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
|
|||
[
|
||||
'user_editcount >= ' . intval( $config->get( MainConfigNames::ExperiencedUserEdits ) ),
|
||||
$dbr->makeList( [
|
||||
'user_registration IS NULL',
|
||||
'user_registration' => null,
|
||||
'user_registration <= ' .
|
||||
$dbr->addQuotes( $dbr->timestamp( $experiencedUserCutoff ) ),
|
||||
], IReadableDatabase::LIST_OR ),
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class SpecialBrokenRedirects extends QueryPage {
|
|||
// Special pages and interwiki links
|
||||
'rd_namespace >= 0',
|
||||
'rd_interwiki' => [ null, '' ],
|
||||
'p2.page_namespace IS NULL',
|
||||
'p2.page_namespace' => null,
|
||||
],
|
||||
'join_conds' => [
|
||||
'p1' => [ 'JOIN', [
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class SpecialDeadendPages extends PageQueryPage {
|
|||
'title' => 'page_title',
|
||||
],
|
||||
'conds' => [
|
||||
'pl_from IS NULL',
|
||||
'pl_from' => null,
|
||||
'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
|
||||
'page_is_redirect' => 0
|
||||
],
|
||||
|
|
|
|||
|
|
@ -91,10 +91,10 @@ class SpecialLonelyPages extends PageQueryPage {
|
|||
[ $ns, $title ] = $this->linksMigration->getTitleFields( 'templatelinks' );
|
||||
$tables = array_merge( [ 'page', 'pagelinks' ], $queryInfo['tables'] );
|
||||
$conds = [
|
||||
'pl_namespace IS NULL',
|
||||
'pl_namespace' => null,
|
||||
'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
|
||||
'page_is_redirect' => 0,
|
||||
'tl_from IS NULL'
|
||||
'tl_from' => null,
|
||||
];
|
||||
$joinConds = [
|
||||
'pagelinks' => [
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class SpecialUncategorizedImages extends ImageQueryPage {
|
|||
'title' => 'page_title',
|
||||
],
|
||||
'conds' => [
|
||||
'cl_from IS NULL',
|
||||
'cl_from' => null,
|
||||
'page_namespace' => NS_FILE,
|
||||
'page_is_redirect' => 0,
|
||||
],
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class SpecialUncategorizedPages extends PageQueryPage {
|
|||
// default for page_namespace is all content namespaces (if requestedNamespace is false)
|
||||
// otherwise, page_namespace is requestedNamespace
|
||||
'conds' => [
|
||||
'cl_from IS NULL',
|
||||
'cl_from' => null,
|
||||
'page_namespace' => $this->requestedNamespace !== false
|
||||
? $this->requestedNamespace
|
||||
: $this->namespaceInfo->getContentNamespaces(),
|
||||
|
|
|
|||
|
|
@ -63,10 +63,10 @@ class SpecialUnusedCategories extends QueryPage {
|
|||
'title' => 'page_title',
|
||||
],
|
||||
'conds' => [
|
||||
'cl_from IS NULL',
|
||||
'cl_from' => null,
|
||||
'page_namespace' => NS_CATEGORY,
|
||||
'page_is_redirect' => 0,
|
||||
'pp_page IS NULL'
|
||||
'pp_page' => null,
|
||||
],
|
||||
'join_conds' => [
|
||||
'categorylinks' => [ 'LEFT JOIN', 'cl_to = page_title' ],
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class SpecialUnusedImages extends ImageQueryPage {
|
|||
'title' => 'img_name',
|
||||
'value' => 'img_timestamp',
|
||||
],
|
||||
'conds' => [ 'il_to IS NULL' ],
|
||||
'conds' => [ 'il_to' => null ],
|
||||
'join_conds' => [ 'imagelinks' => [ 'LEFT JOIN', 'il_to = img_name' ] ]
|
||||
];
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ class SpecialUnusedImages extends ImageQueryPage {
|
|||
$retval['tables'] = [ 'image', 'page', 'categorylinks',
|
||||
'imagelinks' ];
|
||||
$retval['conds']['page_namespace'] = NS_FILE;
|
||||
$retval['conds'][] = 'cl_from IS NULL';
|
||||
$retval['conds']['cl_from'] = null;
|
||||
$retval['conds'][] = 'img_name = page_title';
|
||||
$retval['join_conds']['categorylinks'] = [
|
||||
'LEFT JOIN', 'cl_from = page_id' ];
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ class SpecialUnusedTemplates extends QueryPage {
|
|||
],
|
||||
'conds' => [
|
||||
'page_namespace' => NS_TEMPLATE,
|
||||
'tl_from IS NULL',
|
||||
'tl_from' => null,
|
||||
'page_is_redirect' => 0
|
||||
],
|
||||
'join_conds' => array_merge( $joinConds, $queryInfo['joins'] )
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class SpecialUnwatchedPages extends QueryPage {
|
|||
'value' => 'page_namespace'
|
||||
],
|
||||
'conds' => [
|
||||
'wl_title IS NULL',
|
||||
'wl_title' => null,
|
||||
'page_is_redirect' => 0,
|
||||
'page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class SpecialWantedCategories extends WantedQueryPage {
|
|||
'title' => 'cl_to',
|
||||
'value' => 'COUNT(*)'
|
||||
],
|
||||
'conds' => [ 'page_title IS NULL' ],
|
||||
'conds' => [ 'page_title' => null ],
|
||||
'options' => [ 'GROUP BY' => 'cl_to' ],
|
||||
'join_conds' => [ 'page' => [ 'LEFT JOIN',
|
||||
[ 'page_title = cl_to',
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class SpecialWantedPages extends WantedQueryPage {
|
|||
'value' => 'COUNT(*)'
|
||||
],
|
||||
'conds' => [
|
||||
'pg1.page_namespace IS NULL',
|
||||
'pg1.page_namespace' => null,
|
||||
'pl_namespace NOT IN (' . $dbr->makeList( [ NS_USER, NS_USER_TALK ] ) . ')',
|
||||
'pg2.page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ class SpecialWantedTemplates extends WantedQueryPage {
|
|||
'value' => 'COUNT(*)'
|
||||
],
|
||||
'conds' => [
|
||||
'page_title IS NULL',
|
||||
'page_title' => null,
|
||||
$ns => NS_TEMPLATE
|
||||
],
|
||||
'options' => [ 'GROUP BY' => [ $ns, $title ] ],
|
||||
|
|
|
|||
|
|
@ -261,7 +261,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
|
|||
) {
|
||||
if ( $selectedValues === [ 'seen' ] ) {
|
||||
$conds[] = $dbr->makeList( [
|
||||
'wl_notificationtimestamp IS NULL',
|
||||
'wl_notificationtimestamp' => null,
|
||||
'rc_timestamp < wl_notificationtimestamp'
|
||||
], LIST_OR );
|
||||
} elseif ( $selectedValues === [ 'unseen' ] ) {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class SpecialWithoutInterwiki extends PageQueryPage {
|
|||
'title' => 'page_title',
|
||||
],
|
||||
'conds' => [
|
||||
'll_title IS NULL',
|
||||
'll_title' => null,
|
||||
'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
|
||||
'page_is_redirect' => 0
|
||||
],
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class NewFilesPager extends RangeChronologicalPager {
|
|||
|
||||
if ( count( $groupsWithBotPermission ) ) {
|
||||
$tables[] = 'user_groups';
|
||||
$conds[] = 'ug_group IS NULL';
|
||||
$conds['ug_group'] = null;
|
||||
$jconds['user_groups'] = [
|
||||
'LEFT JOIN',
|
||||
[
|
||||
|
|
|
|||
|
|
@ -3031,7 +3031,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
|
|||
->select( [ 'pl_namespace', 'pl_title' ] )
|
||||
->from( 'pagelinks' )
|
||||
->leftJoin( 'page', null, [ 'pl_namespace=page_namespace', 'pl_title=page_title' ] )
|
||||
->where( [ 'pl_from' => $this->getArticleID(), 'page_namespace IS NULL' ] )
|
||||
->where( [ 'pl_from' => $this->getArticleID(), 'page_namespace' => null ] )
|
||||
->caller( __METHOD__ )->fetchResultSet();
|
||||
|
||||
$retVal = [];
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class FixUserRegistration extends Maintenance {
|
|||
'user_id',
|
||||
[
|
||||
'user_id > ' . $dbw->addQuotes( $lastId ),
|
||||
'user_registration IS NULL'
|
||||
'user_registration' => null,
|
||||
],
|
||||
__METHOD__,
|
||||
[
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class PopulatePPSortKey extends LoggedUpdateMaintenance {
|
|||
|
||||
$this->output( "Populating page_props.pp_sortkey...\n" );
|
||||
while ( true ) {
|
||||
$conditions = [ 'pp_sortkey IS NULL' ];
|
||||
$conditions = [ 'pp_sortkey' => null ];
|
||||
if ( $lastPageValue !== 0 ) {
|
||||
$conditions[] = $dbw->buildComparison( '>', [
|
||||
'pp_page' => $lastPageValue,
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ class PopulateRevisionLength extends LoggedUpdateMaintenance {
|
|||
"$idCol >= $blockStart",
|
||||
"$idCol <= $blockEnd",
|
||||
$dbr->makeList( [
|
||||
"{$prefix}_len IS NULL",
|
||||
"{$prefix}_len" => null,
|
||||
$dbr->makeList( [
|
||||
"{$prefix}_len = 0",
|
||||
"{$prefix}_len" => 0,
|
||||
// sha1( "" )
|
||||
"{$prefix}_sha1 != " . $dbr->addQuotes( 'phoiac9h4m842xq45sp7s6u21eteeq1' ),
|
||||
], IDatabase::LIST_AND )
|
||||
|
|
|
|||
|
|
@ -134,8 +134,8 @@ class RefreshLinks extends Maintenance {
|
|||
# This entire code path is cut-and-pasted from below. Hurrah.
|
||||
|
||||
$conds = [
|
||||
"page_is_redirect=1",
|
||||
"rd_from IS NULL",
|
||||
'page_is_redirect' => 1,
|
||||
'rd_from' => null,
|
||||
self::intervalCond( $dbr, 'page_id', $start, $end ),
|
||||
] + $this->namespaceCond();
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class RemoveInvalidEmails extends Maintenance {
|
|||
->where( [
|
||||
'user_id > ' . $dbr->addQuotes( $lastId ),
|
||||
'user_email != ' . $dbr->addQuotes( '' ),
|
||||
'user_email_authenticated IS NULL'
|
||||
'user_email_authenticated' => null,
|
||||
] )
|
||||
->limit( $this->getBatchSize() )
|
||||
->caller( __METHOD__ )->fetchResultSet();
|
||||
|
|
|
|||
|
|
@ -514,7 +514,7 @@ class RecompressTracked {
|
|||
'bt_page' => $pageId,
|
||||
'bt_text_id > ' . $dbr->addQuotes( $startId ),
|
||||
'bt_moved' => 0,
|
||||
'bt_new_url IS NULL',
|
||||
'bt_new_url' => null,
|
||||
] )
|
||||
->orderBy( 'bt_text_id' )
|
||||
->limit( $this->batchSize )
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ class TrackBlobs extends Maintenance {
|
|||
'old_id>' . $dbr->addQuotes( $startId ),
|
||||
$textClause,
|
||||
'old_flags ' . $dbr->buildLike( $dbr->anyString(), 'external', $dbr->anyString() ),
|
||||
'bt_text_id IS NULL'
|
||||
'bt_text_id' => null,
|
||||
] )
|
||||
->orderBy( 'old_id' )
|
||||
->limit( $this->batchSize )
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ class ChangeTagsTest extends MediaWikiIntegrationTestCase {
|
|||
[
|
||||
'tables' => [ 'recentchanges', 'changetagdisplay' => 'change_tag' ],
|
||||
'fields' => [ 'rc_id', 'rc_timestamp', 'ts_tags' => $groupConcats['recentchanges'] ],
|
||||
'conds' => [ "rc_timestamp > '20170714183203'", 'changetagdisplay.ct_tag_id IS NULL' ],
|
||||
'conds' => [ "rc_timestamp > '20170714183203'", 'changetagdisplay.ct_tag_id' => null ],
|
||||
'join_conds' => [ 'changetagdisplay' => [ 'LEFT JOIN', [ 'changetagdisplay.ct_rc_id=rc_id', 'changetagdisplay.ct_tag_id' => [ 1, 2 ] ] ] ],
|
||||
'options' => [ 'ORDER BY' => 'rc_timestamp DESC' ],
|
||||
],
|
||||
|
|
|
|||
|
|
@ -579,7 +579,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase
|
|||
|
||||
$this->assertMatchesRegularExpression(
|
||||
'/actor_user IS NULL OR '
|
||||
. '\(\(user_editcount >= 500\) AND \(\(user_registration IS NULL\) OR '
|
||||
. '\(\(user_editcount >= 500\) AND \(user_registration IS NULL OR '
|
||||
. '\(user_registration <= \'[^\']+\'\)\)\)/',
|
||||
reset( $conds ),
|
||||
"rc conditions: userExpLevel=unregistered;experienced"
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class SpecialUncategorizedCategoriesTest extends MediaWikiIntegrationTestCase {
|
|||
'title' => 'page_title',
|
||||
],
|
||||
'conds' => [
|
||||
0 => 'cl_from IS NULL',
|
||||
'cl_from' => null,
|
||||
'page_namespace' => 14,
|
||||
'page_is_redirect' => 0,
|
||||
] + $expected,
|
||||
|
|
@ -49,22 +49,22 @@ class SpecialUncategorizedCategoriesTest extends MediaWikiIntegrationTestCase {
|
|||
return [
|
||||
[
|
||||
"* Stubs\n* Test\n* *\n* * test123",
|
||||
[ 1 => "page_title not in ( 'Stubs','Test','*','*_test123' )" ]
|
||||
[ 0 => "page_title not in ( 'Stubs','Test','*','*_test123' )" ]
|
||||
],
|
||||
[
|
||||
"Stubs\n* Test\n* *\n* * test123",
|
||||
[ 1 => "page_title not in ( 'Test','*','*_test123' )" ]
|
||||
[ 0 => "page_title not in ( 'Test','*','*_test123' )" ]
|
||||
],
|
||||
[
|
||||
"* StubsTest\n* *\n* * test123",
|
||||
[ 1 => "page_title not in ( 'StubsTest','*','*_test123' )" ]
|
||||
[ 0 => "page_title not in ( 'StubsTest','*','*_test123' )" ]
|
||||
],
|
||||
[ "", [] ],
|
||||
[ "\n\n\n", [] ],
|
||||
[ "\n", [] ],
|
||||
[ "Test\n*Test2", [ 1 => "page_title not in ( 'Test2' )" ] ],
|
||||
[ "Test\n*Test2", [ 0 => "page_title not in ( 'Test2' )" ] ],
|
||||
[ "Test", [] ],
|
||||
[ "*Test\nTest2", [ 1 => "page_title not in ( 'Test' )" ] ],
|
||||
[ "*Test\nTest2", [ 0 => "page_title not in ( 'Test' )" ] ],
|
||||
[ "Test\nTest2", [] ],
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue