diff options
author | Ammarpad <ammarpad@yahoo.com> | 2021-03-25 10:31:12 +0100 |
---|---|---|
committer | Ammarpad <ammarpad@yahoo.com> | 2021-04-30 05:22:13 +0000 |
commit | 7ad7610571fea8b0cf563550a5ce0ec49cb2cd23 (patch) | |
tree | e1231e4086a884e6ab25e29f0dfde8a5dbd35080 /includes | |
parent | b92d5e0e0eef9af3fcb93df216eb7e131f57cf15 (diff) | |
download | mediawikicore-7ad7610571fea8b0cf563550a5ce0ec49cb2cd23.tar.gz mediawikicore-7ad7610571fea8b0cf563550a5ce0ec49cb2cd23.zip |
Check forcing of 'name_title' index to prepare for renaming
Bug: T270033
Change-Id: Ib93b6bc42b9b74611b8fde9bfd2dd0e4d1cea10d
Diffstat (limited to 'includes')
-rw-r--r-- | includes/api/ApiQueryAllPages.php | 5 | ||||
-rw-r--r-- | includes/specials/SpecialAllPages.php | 5 | ||||
-rw-r--r-- | includes/specials/SpecialPrefixindex.php | 6 | ||||
-rw-r--r-- | includes/specials/pagers/AllMessagesTablePager.php | 5 |
4 files changed, 17 insertions, 4 deletions
diff --git a/includes/api/ApiQueryAllPages.php b/includes/api/ApiQueryAllPages.php index 9cff65e37efc..4cf421eaa96a 100644 --- a/includes/api/ApiQueryAllPages.php +++ b/includes/api/ApiQueryAllPages.php @@ -207,7 +207,10 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase { } if ( $forceNameTitleIndex ) { - $this->addOption( 'USE INDEX', 'name_title' ); + // T270033 Index renaming + $pageIndex = $db->indexExists( 'page', 'name_title', __METHOD__ ) + ? 'name_title' : 'page_name_title'; + $this->addOption( 'USE INDEX', $pageIndex ); } $limit = $params['limit']; diff --git a/includes/specials/SpecialAllPages.php b/includes/specials/SpecialAllPages.php index 132797a09904..64f8087c875c 100644 --- a/includes/specials/SpecialAllPages.php +++ b/includes/specials/SpecialAllPages.php @@ -224,6 +224,9 @@ class SpecialAllPages extends IncludableSpecialPage { if ( $toKey !== "" ) { $conds[] = 'page_title <= ' . $dbr->addQuotes( $toKey ); } + // T270033 Index renaming + $pageIndex = $dbr->indexExists( 'page', 'name_title', __METHOD__ ) + ? 'name_title' : 'page_name_title'; $res = $dbr->select( 'page', [ 'page_namespace', 'page_title', 'page_is_redirect', 'page_id' ], @@ -232,7 +235,7 @@ class SpecialAllPages extends IncludableSpecialPage { [ 'ORDER BY' => 'page_title', 'LIMIT' => $this->maxPerPage + 1, - 'USE INDEX' => 'name_title', + 'USE INDEX' => $pageIndex, ] ); diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index d8a9f7591a93..2460830a86c6 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -192,6 +192,10 @@ class SpecialPrefixindex extends SpecialAllPages { $conds['page_is_redirect'] = 0; } + // T270033 Index renaming + $pageIndex = $dbr->indexExists( 'page', 'name_title', __METHOD__ ) + ? 'name_title' : 'page_name_title'; + $res = $dbr->select( 'page', array_merge( [ 'page_namespace', 'page_title' ], @@ -202,7 +206,7 @@ class SpecialPrefixindex extends SpecialAllPages { [ 'ORDER BY' => 'page_title', 'LIMIT' => $this->maxPerPage + 1, - 'USE INDEX' => 'name_title', + 'USE INDEX' => $pageIndex, ] ); diff --git a/includes/specials/pagers/AllMessagesTablePager.php b/includes/specials/pagers/AllMessagesTablePager.php index 70dae5d9780f..2fe3587e9388 100644 --- a/includes/specials/pagers/AllMessagesTablePager.php +++ b/includes/specials/pagers/AllMessagesTablePager.php @@ -162,12 +162,15 @@ class AllMessagesTablePager extends TablePager { // FIXME: This function should be moved to Language:: or something. // Fallback to global state, if not provided $dbr = $dbr ?? wfGetDB( DB_REPLICA ); + // T270033 Index renaming + $pageIndex = $dbr->indexExists( 'page', 'name_title', __METHOD__ ) + ? 'name_title' : 'page_name_title'; $res = $dbr->select( 'page', [ 'page_namespace', 'page_title' ], [ 'page_namespace' => [ NS_MEDIAWIKI, NS_MEDIAWIKI_TALK ] ], __METHOD__, - [ 'USE INDEX' => 'name_title' ] + [ 'USE INDEX' => $pageIndex ] ); $xNames = array_flip( $messageNames ); |