From: Aaron Schulz Date: Wed, 6 Mar 2019 17:17:27 +0000 (-0800) Subject: Normalize use of "INNER JOIN" to "JOIN" in database queries X-Git-Tag: 1.34.0-rc.0~2629^2 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=cb15755e92513eb61dcea6d7a0c0930374efdb86 Normalize use of "INNER JOIN" to "JOIN" in database queries The ANSI SQL default join type is INNER and this might save some line breaks here and there. Change-Id: Ibd39976f46ca3f9b71190d3b60b76ca085787a00 --- diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index a07e1b4775..689624f62a 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -339,7 +339,7 @@ class CategoryViewer extends ContextSource { 'ORDER BY' => $this->flip[$type] ? 'cl_sortkey DESC' : 'cl_sortkey', ], [ - 'categorylinks' => [ 'INNER JOIN', 'cl_from = page_id' ], + 'categorylinks' => [ 'JOIN', 'cl_from = page_id' ], 'category' => [ 'LEFT JOIN', [ 'cat_title = page_title', 'page_namespace' => NS_CATEGORY diff --git a/includes/Revision.php b/includes/Revision.php index f2ca79ae15..cbaff90d69 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -330,7 +330,7 @@ class Revision implements IDBAccessObject { */ public static function pageJoinCond() { wfDeprecated( __METHOD__, '1.31' ); - return [ 'INNER JOIN', [ 'page_id = rev_page' ] ]; + return [ 'JOIN', [ 'page_id = rev_page' ] ]; } /** diff --git a/includes/Revision/RevisionStore.php b/includes/Revision/RevisionStore.php index cf19ffbc47..ee6bf67e66 100644 --- a/includes/Revision/RevisionStore.php +++ b/includes/Revision/RevisionStore.php @@ -2308,7 +2308,7 @@ class RevisionStore 'page_is_redirect', 'page_len', ] ); - $ret['joins']['page'] = [ 'INNER JOIN', [ 'page_id = rev_page' ] ]; + $ret['joins']['page'] = [ 'JOIN', [ 'page_id = rev_page' ] ]; } if ( in_array( 'user', $options, true ) ) { @@ -2337,7 +2337,7 @@ class RevisionStore 'old_text', 'old_flags' ] ); - $ret['joins']['text'] = [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ]; + $ret['joins']['text'] = [ 'JOIN', [ 'rev_text_id=old_id' ] ]; } return $ret; @@ -2413,7 +2413,7 @@ class RevisionStore 'content_address', 'content_model', ] ); - $ret['joins']['content'] = [ 'INNER JOIN', [ 'slot_content_id = content_id' ] ]; + $ret['joins']['content'] = [ 'JOIN', [ 'slot_content_id = content_id' ] ]; if ( in_array( 'model', $options, true ) ) { // Use left join to attach model name, so we still find the revision row even diff --git a/includes/api/ApiQueryAllDeletedRevisions.php b/includes/api/ApiQueryAllDeletedRevisions.php index 8855615755..bb50185444 100644 --- a/includes/api/ApiQueryAllDeletedRevisions.php +++ b/includes/api/ApiQueryAllDeletedRevisions.php @@ -131,7 +131,7 @@ class ApiQueryAllDeletedRevisions extends ApiQueryRevisionsBase { if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); $this->addJoinConds( - [ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ] + [ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ] ); $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); try { diff --git a/includes/api/ApiQueryAllRevisions.php b/includes/api/ApiQueryAllRevisions.php index 5343c33747..75d75ec8c0 100644 --- a/includes/api/ApiQueryAllRevisions.php +++ b/includes/api/ApiQueryAllRevisions.php @@ -105,7 +105,7 @@ class ApiQueryAllRevisions extends ApiQueryRevisionsBase { if ( $needPageTable ) { $revQuery['tables'][] = 'page'; - $revQuery['joins']['page'] = [ 'INNER JOIN', [ "$pageField = page_id" ] ]; + $revQuery['joins']['page'] = [ 'JOIN', [ "$pageField = page_id" ] ]; if ( (bool)$miser_ns ) { $revQuery['fields'][] = 'page_namespace'; } diff --git a/includes/api/ApiQueryAllUsers.php b/includes/api/ApiQueryAllUsers.php index a54066153d..d7adb9b0d9 100644 --- a/includes/api/ApiQueryAllUsers.php +++ b/includes/api/ApiQueryAllUsers.php @@ -117,7 +117,7 @@ class ApiQueryAllUsers extends ApiQueryBase { $this->addTables( 'user_groups', 'ug1' ); $this->addJoinConds( [ 'ug1' => [ - 'INNER JOIN', + 'JOIN', [ 'ug1.ug_user=user_id', 'ug1.ug_group' => $params['group'], @@ -172,7 +172,7 @@ class ApiQueryAllUsers extends ApiQueryBase { // There shouldn't be any duplicate rows in querycachetwo here. $this->addTables( 'querycachetwo' ); $this->addJoinConds( [ 'querycachetwo' => [ - 'INNER JOIN', [ + 'JOIN', [ 'qcc_type' => 'activeusers', 'qcc_namespace' => NS_USER, 'qcc_title=user_name', diff --git a/includes/api/ApiQueryContributors.php b/includes/api/ApiQueryContributors.php index a8f970e170..93cf016243 100644 --- a/includes/api/ApiQueryContributors.php +++ b/includes/api/ApiQueryContributors.php @@ -176,7 +176,7 @@ class ApiQueryContributors extends ApiQueryBase { $limitGroups = array_unique( $limitGroups ); $this->addTables( 'user_groups' ); $this->addJoinConds( [ 'user_groups' => [ - $excludeGroups ? 'LEFT OUTER JOIN' : 'INNER JOIN', + $excludeGroups ? 'LEFT OUTER JOIN' : 'JOIN', [ 'ug_user=' . $revQuery['fields']['rev_user'], 'ug_group' => $limitGroups, diff --git a/includes/api/ApiQueryDeletedRevisions.php b/includes/api/ApiQueryDeletedRevisions.php index c15634153d..b266ecfe2e 100644 --- a/includes/api/ApiQueryDeletedRevisions.php +++ b/includes/api/ApiQueryDeletedRevisions.php @@ -83,7 +83,7 @@ class ApiQueryDeletedRevisions extends ApiQueryRevisionsBase { if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); $this->addJoinConds( - [ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ] + [ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ] ); $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); try { diff --git a/includes/api/ApiQueryDeletedrevs.php b/includes/api/ApiQueryDeletedrevs.php index 3ee75f503c..370a3fb8d4 100644 --- a/includes/api/ApiQueryDeletedrevs.php +++ b/includes/api/ApiQueryDeletedrevs.php @@ -137,7 +137,7 @@ class ApiQueryDeletedrevs extends ApiQueryBase { if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); $this->addJoinConds( - [ 'change_tag' => [ 'INNER JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ] + [ 'change_tag' => [ 'JOIN', [ 'ar_rev_id=ct_rev_id' ] ] ] ); $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); try { diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index 0934ab391d..cc11c486c3 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -112,7 +112,7 @@ class ApiQueryLogEvents extends ApiQueryBase { if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); - $this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN', + $this->addJoinConds( [ 'change_tag' => [ 'JOIN', [ 'log_id=ct_log_id' ] ] ] ); $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); try { diff --git a/includes/api/ApiQueryRecentChanges.php b/includes/api/ApiQueryRecentChanges.php index 2d5c9870f2..4b1bf2e1b7 100644 --- a/includes/api/ApiQueryRecentChanges.php +++ b/includes/api/ApiQueryRecentChanges.php @@ -360,7 +360,7 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase { if ( !is_null( $params['tag'] ) ) { $this->addTables( 'change_tag' ); - $this->addJoinConds( [ 'change_tag' => [ 'INNER JOIN', [ 'rc_id=ct_rc_id' ] ] ] ); + $this->addJoinConds( [ 'change_tag' => [ 'JOIN', [ 'rc_id=ct_rc_id' ] ] ] ); $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); try { $this->addWhereFld( 'ct_tag_id', $changeTagDefStore->getId( $params['tag'] ) ); diff --git a/includes/api/ApiQueryRevisions.php b/includes/api/ApiQueryRevisions.php index 9301f81e9e..3781ab0f35 100644 --- a/includes/api/ApiQueryRevisions.php +++ b/includes/api/ApiQueryRevisions.php @@ -177,7 +177,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { // Always join 'page' so orphaned revisions are filtered out $this->addTables( [ 'revision', 'page' ] ); $this->addJoinConds( - [ 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ] ] + [ 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ] ] ); $this->addFields( [ 'rev_id' => $idField, 'rev_timestamp' => $tsField, 'rev_page' => $pageField @@ -191,7 +191,7 @@ class ApiQueryRevisions extends ApiQueryRevisionsBase { if ( $params['tag'] !== null ) { $this->addTables( 'change_tag' ); $this->addJoinConds( - [ 'change_tag' => [ 'INNER JOIN', [ 'rev_id=ct_rev_id' ] ] ] + [ 'change_tag' => [ 'JOIN', [ 'rev_id=ct_rev_id' ] ] ] ); $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); try { diff --git a/includes/api/ApiQueryUserContribs.php b/includes/api/ApiQueryUserContribs.php index 0ca0b20a2e..7e548abce5 100644 --- a/includes/api/ApiQueryUserContribs.php +++ b/includes/api/ApiQueryUserContribs.php @@ -488,7 +488,7 @@ class ApiQueryUserContribs extends ApiQueryBase { if ( isset( $this->params['tag'] ) ) { $this->addTables( 'change_tag' ); $this->addJoinConds( - [ 'change_tag' => [ 'INNER JOIN', [ $idField . ' = ct_rev_id' ] ] ] + [ 'change_tag' => [ 'JOIN', [ $idField . ' = ct_rev_id' ] ] ] ); $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); try { diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 824c4d5223..66d8db4987 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -168,7 +168,7 @@ class ApiQueryUsers extends ApiQueryBase { } $this->addTables( 'user_groups' ); - $this->addJoinConds( [ 'user_groups' => [ 'INNER JOIN', 'ug_user=user_id' ] ] ); + $this->addJoinConds( [ 'user_groups' => [ 'JOIN', 'ug_user=user_id' ] ] ); $this->addFields( [ 'user_name' ] ); $this->addFields( UserGroupMembership::selectFields() ); $this->addWhere( 'ug_expiry IS NULL OR ug_expiry >= ' . diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 91877f24f8..00eed14919 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -756,7 +756,7 @@ class ChangeTags { // Add an INNER JOIN on change_tag $tables[] = 'change_tag'; - $join_conds['change_tag'] = [ 'INNER JOIN', $join_cond ]; + $join_conds['change_tag'] = [ 'JOIN', $join_cond ]; $filterTagIds = []; $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore(); foreach ( (array)$filter_tag as $filterTagName ) { @@ -808,7 +808,7 @@ class ChangeTags { } $tagTables = [ 'change_tag', 'change_tag_def' ]; - $join_cond_ts_tags = [ 'change_tag_def' => [ 'INNER JOIN', 'ct_tag_id=ctd_id' ] ]; + $join_cond_ts_tags = [ 'change_tag_def' => [ 'JOIN', 'ct_tag_id=ctd_id' ] ]; $field = 'ctd_name'; return wfGetDB( DB_REPLICA )->buildGroupConcatField( diff --git a/includes/export/WikiExporter.php b/includes/export/WikiExporter.php index 88282bd78c..52e38a0e83 100644 --- a/includes/export/WikiExporter.php +++ b/includes/export/WikiExporter.php @@ -372,18 +372,18 @@ class WikiExporter { $opts[] = 'STRAIGHT_JOIN'; $opts['USE INDEX']['revision'] = 'rev_page_id'; unset( $join['revision'] ); - $join['page'] = [ 'INNER JOIN', 'rev_page=page_id' ]; + $join['page'] = [ 'JOIN', 'rev_page=page_id' ]; } } elseif ( $this->history & self::CURRENT ) { # Latest revision dumps... if ( $this->list_authors && $cond != '' ) { // List authors, if so desired $this->do_list_authors( $cond ); } - $join['revision'] = [ 'INNER JOIN', 'page_id=rev_page AND page_latest=rev_id' ]; + $join['revision'] = [ 'JOIN', 'page_id=rev_page AND page_latest=rev_id' ]; } elseif ( $this->history & self::STABLE ) { # "Stable" revision dumps... # Default JOIN, to be overridden... - $join['revision'] = [ 'INNER JOIN', 'page_id=rev_page AND page_latest=rev_id' ]; + $join['revision'] = [ 'JOIN', 'page_id=rev_page AND page_latest=rev_id' ]; # One, and only one hook should set this, and return false if ( Hooks::run( 'WikiExporter::dumpStableQuery', [ &$tables, &$opts, &$join ] ) ) { throw new MWException( __METHOD__ . " given invalid history dump type." ); diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index 32afa37301..801c4745c9 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -333,7 +333,7 @@ class LogPager extends ReverseChronologicalPager { } } # Don't show duplicate rows when using log_search - $joins['log_search'] = [ 'INNER JOIN', 'ls_log_id=log_id' ]; + $joins['log_search'] = [ 'JOIN', 'ls_log_id=log_id' ]; $info = [ 'tables' => $tables, diff --git a/includes/page/WikiFilePage.php b/includes/page/WikiFilePage.php index 4c2ebdc297..c457a34fe1 100644 --- a/includes/page/WikiFilePage.php +++ b/includes/page/WikiFilePage.php @@ -235,7 +235,7 @@ class WikiFilePage extends WikiPage { ], __METHOD__, [], - [ 'categorylinks' => [ 'INNER JOIN', 'page_id = cl_from' ] ] + [ 'categorylinks' => [ 'JOIN', 'page_id = cl_from' ] ] ); return TitleArray::newFromResult( $res ); diff --git a/includes/specials/SpecialAncientpages.php b/includes/specials/SpecialAncientpages.php index 4f691cb688..cea6d37506 100644 --- a/includes/specials/SpecialAncientpages.php +++ b/includes/specials/SpecialAncientpages.php @@ -50,7 +50,7 @@ class AncientPagesPage extends QueryPage { ]; $joinConds = [ 'revision' => [ - 'INNER JOIN', [ + 'JOIN', [ 'page_latest = rev_id' ] ], diff --git a/includes/specials/SpecialPagesWithProp.php b/includes/specials/SpecialPagesWithProp.php index 46ad31c4a8..3c009c3966 100644 --- a/includes/specials/SpecialPagesWithProp.php +++ b/includes/specials/SpecialPagesWithProp.php @@ -149,7 +149,7 @@ class SpecialPagesWithProp extends QueryPage { 'pp_propname' => $this->propName, ], 'join_conds' => [ - 'page' => [ 'INNER JOIN', 'page_id = pp_page' ] + 'page' => [ 'JOIN', 'page_id = pp_page' ] ], 'options' => [] ]; diff --git a/includes/specials/SpecialRandomInCategory.php b/includes/specials/SpecialRandomInCategory.php index d781e16b40..855f799e6c 100644 --- a/includes/specials/SpecialRandomInCategory.php +++ b/includes/specials/SpecialRandomInCategory.php @@ -219,7 +219,7 @@ class SpecialRandomInCategory extends FormSpecialPage { 'OFFSET' => $offset ], 'join_conds' => [ - 'page' => [ 'INNER JOIN', 'cl_from = page_id' ] + 'page' => [ 'JOIN', 'cl_from = page_id' ] ] ]; diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index e42cc70c51..62c867b44c 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -207,7 +207,7 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { $conds + $subconds, __METHOD__, $order + $query_options, - $join_conds + [ $link_table => [ 'INNER JOIN', $subjoin ] ] + $join_conds + [ $link_table => [ 'JOIN', $subjoin ] ] ); if ( $dbr->unionSupportsOrderAndLimit() ) { diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 7772ef73f4..d59b66b9ef 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -343,7 +343,7 @@ class SpecialWatchlist extends ChangesListSpecialPage { $join_conds = array_merge( [ 'watchlist' => [ - 'INNER JOIN', + 'JOIN', [ 'wl_user' => $user->getId(), 'wl_namespace=rc_namespace', diff --git a/includes/specials/SpecialWhatlinkshere.php b/includes/specials/SpecialWhatlinkshere.php index 766e190250..b48e858719 100644 --- a/includes/specials/SpecialWhatlinkshere.php +++ b/includes/specials/SpecialWhatlinkshere.php @@ -170,7 +170,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { // Force JOIN order per T106682 to avoid large filesorts [ 'ORDER BY' => $fromCol, 'LIMIT' => 2 * $queryLimit, 'STRAIGHT_JOIN' ], [ - 'page' => [ 'INNER JOIN', "$fromCol = page_id" ], + 'page' => [ 'JOIN', "$fromCol = page_id" ], 'redirect' => [ 'LEFT JOIN', $on ] ] ); @@ -180,7 +180,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { [], __CLASS__ . '::showIndirectLinks', [ 'ORDER BY' => 'page_id', 'LIMIT' => $queryLimit ], - [ 'page' => [ 'INNER JOIN', "$fromCol = page_id" ] ] + [ 'page' => [ 'JOIN', "$fromCol = page_id" ] ] ); }; diff --git a/includes/specials/pagers/NewFilesPager.php b/includes/specials/pagers/NewFilesPager.php index 8bac2c4493..d05ebf83af 100644 --- a/includes/specials/pagers/NewFilesPager.php +++ b/includes/specials/pagers/NewFilesPager.php @@ -122,7 +122,7 @@ class NewFilesPager extends RangeChronologicalPager { $jcond = $rcQuery['fields']['rc_user'] . ' = ' . $imgQuery['fields']['img_user']; } $jconds['recentchanges'] = [ - 'INNER JOIN', + 'JOIN', [ 'rc_title = img_name', $jcond, diff --git a/includes/specials/pagers/NewPagesPager.php b/includes/specials/pagers/NewPagesPager.php index d03401db63..5788bb2bac 100644 --- a/includes/specials/pagers/NewPagesPager.php +++ b/includes/specials/pagers/NewPagesPager.php @@ -102,7 +102,7 @@ class NewPagesPager extends ReverseChronologicalPager { $fields = array_merge( $rcQuery['fields'], [ 'length' => 'page_len', 'rev_id' => 'page_latest', 'page_namespace', 'page_title' ] ); - $join_conds = [ 'page' => [ 'INNER JOIN', 'page_id=rc_cur_id' ] ] + $rcQuery['joins']; + $join_conds = [ 'page' => [ 'JOIN', 'page_id=rc_cur_id' ] ] + $rcQuery['joins']; // Avoid PHP 7.1 warning from passing $this by reference $pager = $this; diff --git a/includes/watcheditem/WatchedItemQueryService.php b/includes/watcheditem/WatchedItemQueryService.php index a85e7e8f10..8b54a95c31 100644 --- a/includes/watcheditem/WatchedItemQueryService.php +++ b/includes/watcheditem/WatchedItemQueryService.php @@ -693,7 +693,7 @@ class WatchedItemQueryService { private function getWatchedItemsWithRCInfoQueryJoinConds( array $options ) { $joinConds = [ - 'watchlist' => [ 'INNER JOIN', + 'watchlist' => [ 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' diff --git a/maintenance/benchmarks/benchmarkParse.php b/maintenance/benchmarks/benchmarkParse.php index 3a79ad3e6b..c42fcd9c34 100644 --- a/maintenance/benchmarks/benchmarkParse.php +++ b/maintenance/benchmarks/benchmarkParse.php @@ -145,7 +145,7 @@ class BenchmarkParse extends Maintenance { ], __METHOD__, [ 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 1 ], - [ 'revision' => [ 'INNER JOIN', 'rev_page=page_id' ] ] + [ 'revision' => [ 'JOIN', 'rev_page=page_id' ] ] ); return $id; diff --git a/maintenance/categoryChangesAsRdf.php b/maintenance/categoryChangesAsRdf.php index 564f7ced1b..83241334f5 100644 --- a/maintenance/categoryChangesAsRdf.php +++ b/maintenance/categoryChangesAsRdf.php @@ -307,7 +307,7 @@ SPARQL; 'rc_type' => RC_LOG, ] ); $it->addJoinConditions( [ - 'page' => [ 'INNER JOIN', 'rc_cur_id = page_id' ], + 'page' => [ 'JOIN', 'rc_cur_id = page_id' ], ] ); $this->addIndex( $it ); return $it; diff --git a/maintenance/findMissingFiles.php b/maintenance/findMissingFiles.php index 4997cabb73..5c1d49e5ba 100644 --- a/maintenance/findMissingFiles.php +++ b/maintenance/findMissingFiles.php @@ -46,7 +46,7 @@ class FindMissingFiles extends Maintenance { $joinConds = []; if ( $mtime1 || $mtime2 ) { $joinTables[] = 'page'; - $joinConds['page'] = [ 'INNER JOIN', + $joinConds['page'] = [ 'JOIN', [ 'page_title = img_name', 'page_namespace' => NS_FILE ] ]; $joinTables[] = 'logging'; $on = [ 'log_page = page_id', 'log_type' => [ 'upload', 'move', 'delete' ] ]; @@ -56,7 +56,7 @@ class FindMissingFiles extends Maintenance { if ( $mtime2 ) { $on[] = "log_timestamp < {$dbr->addQuotes($mtime2)}"; } - $joinConds['logging'] = [ 'INNER JOIN', $on ]; + $joinConds['logging'] = [ 'JOIN', $on ]; } do { diff --git a/maintenance/populateContentModel.php b/maintenance/populateContentModel.php index 8d64dae3ab..e6f47d1aa1 100644 --- a/maintenance/populateContentModel.php +++ b/maintenance/populateContentModel.php @@ -160,7 +160,7 @@ class PopulateContentModel extends Maintenance { } else { // revision $selectTables = [ 'revision', 'page' ]; $fields = [ 'page_title', 'page_namespace' ]; - $join_conds = [ 'page' => [ 'INNER JOIN', 'rev_page=page_id' ] ]; + $join_conds = [ 'page' => [ 'JOIN', 'rev_page=page_id' ] ]; $where = $ns === 'all' ? [] : [ 'page_namespace' => $ns ]; $page_id_column = 'rev_page'; $rev_id_column = 'rev_id'; diff --git a/maintenance/purgeChangedPages.php b/maintenance/purgeChangedPages.php index feeac92b0e..0ef2a999f4 100644 --- a/maintenance/purgeChangedPages.php +++ b/maintenance/purgeChangedPages.php @@ -99,7 +99,7 @@ class PurgeChangedPages extends Maintenance { __METHOD__, [ 'ORDER BY' => 'rev_timestamp', 'LIMIT' => $bSize ], [ - 'page' => [ 'INNER JOIN', 'rev_page=page_id' ], + 'page' => [ 'JOIN', 'rev_page=page_id' ], ] ); diff --git a/tests/phpunit/includes/Revision/McrReadNewRevisionStoreDbTest.php b/tests/phpunit/includes/Revision/McrReadNewRevisionStoreDbTest.php index 3efd372e07..8bf8606788 100644 --- a/tests/phpunit/includes/Revision/McrReadNewRevisionStoreDbTest.php +++ b/tests/phpunit/includes/Revision/McrReadNewRevisionStoreDbTest.php @@ -55,7 +55,7 @@ class McrReadNewRevisionStoreDbTest extends RevisionStoreDbTestBase { [ 'rev_id' => $rev->getId(), 'rev_text_id > 0' ], [ [ 1 ] ], [], - [ 'text' => [ 'INNER JOIN', [ 'rev_text_id = old_id' ] ] ] + [ 'text' => [ 'JOIN', [ 'rev_text_id = old_id' ] ] ] ); parent::assertRevisionExistsInDatabase( $rev ); diff --git a/tests/phpunit/includes/Revision/McrWriteBothRevisionStoreDbTest.php b/tests/phpunit/includes/Revision/McrWriteBothRevisionStoreDbTest.php index 0385708802..68d30009a4 100644 --- a/tests/phpunit/includes/Revision/McrWriteBothRevisionStoreDbTest.php +++ b/tests/phpunit/includes/Revision/McrWriteBothRevisionStoreDbTest.php @@ -55,7 +55,7 @@ class McrWriteBothRevisionStoreDbTest extends RevisionStoreDbTestBase { [ 'rev_id' => $rev->getId(), 'rev_text_id > 0' ], [ [ 1 ] ], [], - [ 'text' => [ 'INNER JOIN', [ 'rev_text_id = old_id' ] ] ] + [ 'text' => [ 'JOIN', [ 'rev_text_id = old_id' ] ] ] ); parent::assertRevisionExistsInDatabase( $rev ); diff --git a/tests/phpunit/includes/Revision/NoContentModelRevisionStoreDbTest.php b/tests/phpunit/includes/Revision/NoContentModelRevisionStoreDbTest.php index 59481f087b..b9b7ad9270 100644 --- a/tests/phpunit/includes/Revision/NoContentModelRevisionStoreDbTest.php +++ b/tests/phpunit/includes/Revision/NoContentModelRevisionStoreDbTest.php @@ -80,7 +80,7 @@ class NoContentModelRevisionStoreDbTest extends RevisionStoreDbTestBase { ] ), 'joins' => [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ], + 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ], ], ] ]; @@ -115,7 +115,7 @@ class NoContentModelRevisionStoreDbTest extends RevisionStoreDbTestBase { ] ), 'joins' => [ - 'text' => [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ], + 'text' => [ 'JOIN', [ 'rev_text_id=old_id' ] ], ], ] ]; diff --git a/tests/phpunit/includes/Revision/PreMcrRevisionStoreDbTest.php b/tests/phpunit/includes/Revision/PreMcrRevisionStoreDbTest.php index 43453353bd..b3c34c8281 100644 --- a/tests/phpunit/includes/Revision/PreMcrRevisionStoreDbTest.php +++ b/tests/phpunit/includes/Revision/PreMcrRevisionStoreDbTest.php @@ -38,7 +38,7 @@ class PreMcrRevisionStoreDbTest extends RevisionStoreDbTestBase { [ 'rev_id' => $rev->getId(), 'rev_text_id > 0' ], [ [ 1 ] ], [], - [ 'text' => [ 'INNER JOIN', [ 'rev_text_id = old_id' ] ] ] + [ 'text' => [ 'JOIN', [ 'rev_text_id = old_id' ] ] ] ); parent::assertRevisionExistsInDatabase( $rev ); diff --git a/tests/phpunit/includes/Revision/RevisionQueryInfoTest.php b/tests/phpunit/includes/Revision/RevisionQueryInfoTest.php index 9f1c69ce97..3ee61f7494 100644 --- a/tests/phpunit/includes/Revision/RevisionQueryInfoTest.php +++ b/tests/phpunit/includes/Revision/RevisionQueryInfoTest.php @@ -244,7 +244,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { $this->getNewCommentQueryFields( 'rev' ) ), 'joins' => [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ], + 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ], 'user' => [ 'LEFT JOIN', [ 'actor_rev_user.actor_user != 0', 'user_id = actor_rev_user.actor_user' ], @@ -289,7 +289,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { ), 'joins' => array_merge( [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ], + 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ], 'user' => [ 'LEFT JOIN', [ @@ -332,7 +332,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { ), 'joins' => array_merge( [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ], + 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ], 'user' => [ 'LEFT JOIN', [ @@ -401,7 +401,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { ), 'joins' => array_merge( [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ], + 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ], 'user' => [ 'LEFT JOIN', [ @@ -464,7 +464,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { $this->getNewCommentQueryFields( 'rev' ) ), 'joins' => [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ] ], + 'page' => [ 'JOIN', [ 'page_id = rev_page' ] ], 'user' => [ 'LEFT JOIN', [ 'rev_user != 0', 'user_id = rev_user' ] ], 'temp_rev_comment' => [ 'JOIN', 'temp_rev_comment.revcomment_rev = rev_id' ], 'comment_rev_comment' @@ -517,7 +517,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { $this->getNewCommentQueryFields( 'rev' ) ), 'joins' => [ - 'page' => [ 'INNER JOIN', [ 'page_id = rev_page' ], ], + 'page' => [ 'JOIN', [ 'page_id = rev_page' ], ], 'temp_rev_comment' => [ 'JOIN', 'temp_rev_comment.revcomment_rev = rev_id' ], 'comment_rev_comment' => [ 'JOIN', 'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ], @@ -571,7 +571,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { $this->getNewCommentQueryFields( 'rev' ) ), 'joins' => [ - 'text' => [ 'INNER JOIN', [ 'rev_text_id=old_id' ] ], + 'text' => [ 'JOIN', [ 'rev_text_id=old_id' ] ], 'temp_rev_comment' => [ 'JOIN', 'temp_rev_comment.revcomment_rev = rev_id' ], 'comment_rev_comment' => [ 'JOIN', 'comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id' ], @@ -601,7 +601,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { ), 'joins' => [ 'page' => [ - 'INNER JOIN', + 'JOIN', [ 'page_id = rev_page' ], ], 'user' => [ @@ -612,7 +612,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { ], ], 'text' => [ - 'INNER JOIN', + 'JOIN', [ 'rev_text_id=old_id' ], ], 'temp_rev_comment' => [ 'JOIN', 'temp_rev_comment.revcomment_rev = rev_id' ], @@ -686,7 +686,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { 'content_model', ], 'joins' => [ - 'content' => [ 'INNER JOIN', [ 'slot_content_id = content_id' ] ], + 'content' => [ 'JOIN', [ 'slot_content_id = content_id' ] ], ], ] ]; @@ -714,7 +714,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { 'model_name', ], 'joins' => [ - 'content' => [ 'INNER JOIN', [ 'slot_content_id = content_id' ] ], + 'content' => [ 'JOIN', [ 'slot_content_id = content_id' ] ], 'content_models' => [ 'LEFT JOIN', [ 'content_model = model_id' ] ], ], ] @@ -993,7 +993,7 @@ class RevisionQueryInfoTest extends MediaWikiTestCase { public function testRevisionPageJoinCond() { $this->hideDeprecated( 'Revision::pageJoinCond' ); $this->assertEquals( - [ 'INNER JOIN', [ 'page_id = rev_page' ] ], + [ 'JOIN', [ 'page_id = rev_page' ] ], Revision::pageJoinCond() ); } diff --git a/tests/phpunit/includes/RevisionMcrReadNewDbTest.php b/tests/phpunit/includes/RevisionMcrReadNewDbTest.php index 64de85451f..228bcaa07d 100644 --- a/tests/phpunit/includes/RevisionMcrReadNewDbTest.php +++ b/tests/phpunit/includes/RevisionMcrReadNewDbTest.php @@ -51,7 +51,7 @@ class RevisionMcrReadNewDbTest extends RevisionDbTestBase { [ 'tables' => [ 'text' ], 'fields' => [ 'old_id', 'old_text', 'old_flags', 'rev_text_id' ], - 'joins' => [ 'text' => [ 'INNER JOIN', 'old_id=rev_text_id' ] ] + 'joins' => [ 'text' => [ 'JOIN', 'old_id=rev_text_id' ] ] ] ]; } diff --git a/tests/phpunit/includes/api/ApiBlockTest.php b/tests/phpunit/includes/api/ApiBlockTest.php index a26f8a8188..01455edcaf 100644 --- a/tests/phpunit/includes/api/ApiBlockTest.php +++ b/tests/phpunit/includes/api/ApiBlockTest.php @@ -131,8 +131,8 @@ class ApiBlockTest extends ApiTestCase { __METHOD__, [], [ - 'change_tag' => [ 'INNER JOIN', 'ct_log_id = log_id' ], - 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ], + 'change_tag' => [ 'JOIN', 'ct_log_id = log_id' ], + 'change_tag_def' => [ 'JOIN', 'ctd_id = ct_tag_id' ], ] ) ); } diff --git a/tests/phpunit/includes/api/ApiDeleteTest.php b/tests/phpunit/includes/api/ApiDeleteTest.php index 803eefb498..c68954c077 100644 --- a/tests/phpunit/includes/api/ApiDeleteTest.php +++ b/tests/phpunit/includes/api/ApiDeleteTest.php @@ -128,8 +128,8 @@ class ApiDeleteTest extends ApiTestCase { __METHOD__, [], [ - 'change_tag' => [ 'INNER JOIN', 'ct_log_id = log_id' ], - 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ] + 'change_tag' => [ 'JOIN', 'ct_log_id = log_id' ], + 'change_tag_def' => [ 'JOIN', 'ctd_id = ct_tag_id' ] ] ) ); } diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 1706ad1002..aeb829dd62 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -1349,7 +1349,7 @@ class ApiEditPageTest extends ApiTestCase { 'ctd_name', [ 'ct_rev_id' => $revId ], __METHOD__, - [ 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ] ] + [ 'change_tag_def' => [ 'JOIN', 'ctd_id = ct_tag_id' ] ] ) ); } diff --git a/tests/phpunit/includes/api/ApiUnblockTest.php b/tests/phpunit/includes/api/ApiUnblockTest.php index 6ebd835cf6..ea39da70b2 100644 --- a/tests/phpunit/includes/api/ApiUnblockTest.php +++ b/tests/phpunit/includes/api/ApiUnblockTest.php @@ -127,8 +127,8 @@ class ApiUnblockTest extends ApiTestCase { __METHOD__, [], [ - 'change_tag' => [ 'INNER JOIN', 'ct_log_id = log_id' ], - 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ], + 'change_tag' => [ 'JOIN', 'ct_log_id = log_id' ], + 'change_tag_def' => [ 'JOIN', 'ctd_id = ct_tag_id' ], ] ) ); } diff --git a/tests/phpunit/includes/api/ApiUserrightsTest.php b/tests/phpunit/includes/api/ApiUserrightsTest.php index 8cc021763b..5889f8265a 100644 --- a/tests/phpunit/includes/api/ApiUserrightsTest.php +++ b/tests/phpunit/includes/api/ApiUserrightsTest.php @@ -206,7 +206,7 @@ class ApiUserrightsTest extends ApiTestCase { 'log_title' => strtr( $user->getName(), ' ', '_' ) ], __METHOD__, - [ 'change_tag_def' => [ 'INNER JOIN', 'ctd_id = ct_tag_id' ] ] + [ 'change_tag_def' => [ 'JOIN', 'ctd_id = ct_tag_id' ] ] ) ); } diff --git a/tests/phpunit/includes/changetags/ChangeTagsTest.php b/tests/phpunit/includes/changetags/ChangeTagsTest.php index e9058b620d..0e209d533d 100644 --- a/tests/phpunit/includes/changetags/ChangeTagsTest.php +++ b/tests/phpunit/includes/changetags/ChangeTagsTest.php @@ -62,7 +62,7 @@ class ChangeTagsTest extends MediaWikiTestCase { // HACK if we call $dbr->buildGroupConcatField() now, it will return the wrong table names // We have to have the test runner call it instead $baseConcats = [ ',', [ 'change_tag', 'change_tag_def' ], 'ctd_name' ]; - $joinConds = [ 'change_tag_def' => [ 'INNER JOIN', 'ct_tag_id=ctd_id' ] ]; + $joinConds = [ 'change_tag_def' => [ 'JOIN', 'ct_tag_id=ctd_id' ] ]; $groupConcats = [ 'recentchanges' => array_merge( $baseConcats, [ 'ct_rc_id=rc_id', $joinConds ] ), 'logging' => array_merge( $baseConcats, [ 'ct_log_id=log_id', $joinConds ] ), @@ -121,7 +121,7 @@ class ChangeTagsTest extends MediaWikiTestCase { 'tables' => [ 'recentchanges', 'change_tag' ], 'fields' => [ 'rc_id', 'rc_timestamp', 'ts_tags' => $groupConcats['recentchanges'] ], 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ], - 'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ], + 'join_conds' => [ 'change_tag' => [ 'JOIN', 'ct_rc_id=rc_id' ] ], 'options' => [ 'ORDER BY' => 'rc_timestamp DESC' ], ] ], @@ -139,7 +139,7 @@ class ChangeTagsTest extends MediaWikiTestCase { 'tables' => [ 'logging', 'change_tag' ], 'fields' => [ 'log_id', 'ts_tags' => $groupConcats['logging'] ], 'conds' => [ "log_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ], - 'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_log_id=log_id' ] ], + 'join_conds' => [ 'change_tag' => [ 'JOIN', 'ct_log_id=log_id' ] ], 'options' => [ 'ORDER BY log_timestamp DESC' ], ] ], @@ -157,7 +157,7 @@ class ChangeTagsTest extends MediaWikiTestCase { 'tables' => [ 'revision', 'change_tag' ], 'fields' => [ 'rev_id', 'rev_timestamp', 'ts_tags' => $groupConcats['revision'] ], 'conds' => [ "rev_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ], - 'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rev_id=rev_id' ] ], + 'join_conds' => [ 'change_tag' => [ 'JOIN', 'ct_rev_id=rev_id' ] ], 'options' => [ 'ORDER BY' => 'rev_timestamp DESC' ], ] ], @@ -175,7 +175,7 @@ class ChangeTagsTest extends MediaWikiTestCase { 'tables' => [ 'archive', 'change_tag' ], 'fields' => [ 'ar_id', 'ar_timestamp', 'ts_tags' => $groupConcats['archive'] ], 'conds' => [ "ar_timestamp > '20170714183203'", 'ct_tag_id' => [ 1 ] ], - 'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rev_id=ar_rev_id' ] ], + 'join_conds' => [ 'change_tag' => [ 'JOIN', 'ct_rev_id=ar_rev_id' ] ], 'options' => [ 'ORDER BY' => 'ar_timestamp DESC' ], ] ], @@ -223,7 +223,7 @@ class ChangeTagsTest extends MediaWikiTestCase { 'tables' => [ 'recentchanges', 'change_tag' ], 'fields' => [ 'rc_id', 'rc_timestamp', 'ts_tags' => $groupConcats['recentchanges'] ], 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1, 2 ] ], - 'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ], + 'join_conds' => [ 'change_tag' => [ 'JOIN', 'ct_rc_id=rc_id' ] ], 'options' => [ 'ORDER BY' => 'rc_timestamp DESC', 'DISTINCT' ], ] ], @@ -241,7 +241,7 @@ class ChangeTagsTest extends MediaWikiTestCase { 'tables' => [ 'recentchanges', 'change_tag' ], 'fields' => [ 'rc_id', 'rc_timestamp', 'ts_tags' => $groupConcats['recentchanges'] ], 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1, 2 ] ], - 'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ], + 'join_conds' => [ 'change_tag' => [ 'JOIN', 'ct_rc_id=rc_id' ] ], 'options' => [ 'DISTINCT', 'ORDER BY' => 'rc_timestamp DESC' ], ] ], @@ -259,7 +259,7 @@ class ChangeTagsTest extends MediaWikiTestCase { 'tables' => [ 'recentchanges', 'change_tag' ], 'fields' => [ 'rc_id', 'ts_tags' => $groupConcats['recentchanges'] ], 'conds' => [ "rc_timestamp > '20170714183203'", 'ct_tag_id' => [ 1, 2 ] ], - 'join_conds' => [ 'change_tag' => [ 'INNER JOIN', 'ct_rc_id=rc_id' ] ], + 'join_conds' => [ 'change_tag' => [ 'JOIN', 'ct_rc_id=rc_id' ] ], 'options' => [ 'ORDER BY rc_timestamp DESC', 'DISTINCT' ], ] ], diff --git a/tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php b/tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php index 50e6c202f4..e814a577a1 100644 --- a/tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php +++ b/tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php @@ -263,7 +263,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase { ], [ 'watchlist' => [ - 'INNER JOIN', + 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' @@ -386,7 +386,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase { ], [ 'watchlist' => [ - 'INNER JOIN', + 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' @@ -888,7 +888,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase { $expectedJoinConds = array_merge( [ 'watchlist' => [ - 'INNER JOIN', + 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' @@ -1121,7 +1121,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase { $this->isType( 'string' ), $this->isType( 'array' ), array_merge( [ - 'watchlist' => [ 'INNER JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' ] ], + 'watchlist' => [ 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' ] ], 'page' => [ 'LEFT JOIN', 'rc_cur_id=page_id' ], ], $expectedExtraJoins ) ) @@ -1159,7 +1159,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase { [], [ 'watchlist' => [ - 'INNER JOIN', + 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' @@ -1282,7 +1282,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase { [], [ 'watchlist' => [ - 'INNER JOIN', + 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title' @@ -1328,7 +1328,7 @@ class WatchedItemQueryServiceUnitTest extends MediaWikiTestCase { [], [ 'watchlist' => [ - 'INNER JOIN', + 'JOIN', [ 'wl_namespace=rc_namespace', 'wl_title=rc_title'