Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F585423
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
17 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php
index 26ed0ed06f9..411283ca41d 100644
--- a/includes/actions/InfoAction.php
+++ b/includes/actions/InfoAction.php
@@ -623,7 +623,8 @@ class InfoAction extends FormlessAction {
$firstRev = $this->revisionLookup->getFirstRevision( $this->getTitle() );
$lastRev = $this->getWikiPage()->getRevisionRecord();
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()
+ ->setCaller( __METHOD__ );
if ( $firstRev ) {
$firstRevUser = $firstRev->getUser( RevisionRecord::FOR_THIS_USER, $user );
if ( $firstRevUser ) {
diff --git a/includes/actions/pagers/HistoryPager.php b/includes/actions/pagers/HistoryPager.php
index 02b87bc696f..d73990ac0cf 100644
--- a/includes/actions/pagers/HistoryPager.php
+++ b/includes/actions/pagers/HistoryPager.php
@@ -198,7 +198,8 @@ class HistoryPager extends ReverseChronologicalPager {
}
# Do a link batch query
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()
+ ->setCaller( __METHOD__ );
$revIds = [];
$title = $this->getTitle();
foreach ( $this->mResult as $row ) {
diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php
index d8b43c0a605..5f667784f6d 100644
--- a/includes/cache/LinkBatch.php
+++ b/includes/cache/LinkBatch.php
@@ -141,14 +141,14 @@ class LinkBatch {
}
/**
- * Use ->setCaller( __METHOD__ ) to indicate which code is using this
- * class. Only used in debugging output.
- * @since 1.17
+ * Set the function name to attribute database queries to, in debug logs.
*
+ * @see Wikimedia\Rdbms\SelectQueryBuilder::caller
+ * @since 1.17
* @param string $caller
* @return self (since 1.32)
*/
- public function setCaller( $caller ) {
+ public function setCaller( $caller ): self {
$this->caller = $caller;
return $this;
@@ -160,9 +160,6 @@ class LinkBatch {
* added this way, which is needed for the efficient rendering of user links via UserLinkRenderer.
*
* @since 1.44
- *
- * @param UserIdentity $user
- * @return void
*/
public function addUser( UserIdentity $user ): void {
$this->users[$user->getName()] = $user;
@@ -362,19 +359,19 @@ class LinkBatch {
return false;
}
- // This is similar to LinkHolderArray::replaceInternal
- $dbr = $this->dbProvider->getReplicaDatabase();
- $queryBuilder = $dbr->newSelectQueryBuilder()
- ->select( LinkCache::getSelectFields() )
- ->from( 'page' )
- ->where( $this->constructSet( 'page', $dbr ) );
-
$caller = __METHOD__;
if ( strval( $this->caller ) !== '' ) {
$caller .= " (for {$this->caller})";
}
- return $queryBuilder->caller( $caller )->fetchResultSet();
+ // This is similar to LinkHolderArray::replaceInternal
+ $dbr = $this->dbProvider->getReplicaDatabase();
+ return $dbr->newSelectQueryBuilder()
+ ->select( LinkCache::getSelectFields() )
+ ->from( 'page' )
+ ->where( $this->constructSet( 'page', $dbr ) )
+ ->caller( $caller )
+ ->fetchResultSet();
}
/**
diff --git a/includes/cache/UserCache.php b/includes/cache/UserCache.php
index fb29d87ca8a..6ba8a516010 100644
--- a/includes/cache/UserCache.php
+++ b/includes/cache/UserCache.php
@@ -155,7 +155,8 @@ class UserCache {
}
}
- $lb = $this->linkBatchFactory->newLinkBatch();
+ $lb = $this->linkBatchFactory->newLinkBatch()
+ ->setCaller( __METHOD__ );
foreach ( $usersToCheck as $userId => $name ) {
if ( $this->queryNeeded( $userId, 'userpage', $options ) ) {
$lb->add( NS_USER, $name );
diff --git a/includes/deferred/CdnCacheUpdate.php b/includes/deferred/CdnCacheUpdate.php
index eb9e9abee32..d2f3a47347c 100644
--- a/includes/deferred/CdnCacheUpdate.php
+++ b/includes/deferred/CdnCacheUpdate.php
@@ -160,7 +160,8 @@ class CdnCacheUpdate implements DeferrableUpdate, MergeableUpdate {
/** @var PageReference $page */
// Avoid multiple queries for HTMLCacheUpdater::getUrls() call
- $lb = $services->getLinkBatchFactory()->newLinkBatch();
+ $lb = $services->getLinkBatchFactory()->newLinkBatch()
+ ->setCaller( __METHOD__ );
foreach ( $this->pageTuples as [ $page, ] ) {
$lb->addObj( $page );
}
diff --git a/includes/gallery/TraditionalImageGallery.php b/includes/gallery/TraditionalImageGallery.php
index b45cf206381..3c6cbda3b5b 100644
--- a/includes/gallery/TraditionalImageGallery.php
+++ b/includes/gallery/TraditionalImageGallery.php
@@ -80,7 +80,7 @@ class TraditionalImageGallery extends ImageGalleryBase {
// Preload LinkCache info for when generating links
// of the filename below
$linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
- $lb = $linkBatchFactory->newLinkBatch();
+ $lb = $linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $this->mImages as [ $title, /* see below */ ] ) {
$lb->addObj( $title );
}
diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php
index ca935732173..1dc775b83a4 100644
--- a/includes/logging/LogPager.php
+++ b/includes/logging/LogPager.php
@@ -444,7 +444,7 @@ class LogPager extends ReverseChronologicalPager {
}
protected function doBatchLookups() {
- $lb = $this->linkBatchFactory->newLinkBatch();
+ $lb = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $this->mResult as $row ) {
$lb->add( $row->log_namespace, $row->log_title );
$lb->addUser( new UserIdentityValue( (int)$row->log_user, $row->log_user_text ) );
diff --git a/includes/page/ImageHistoryPseudoPager.php b/includes/page/ImageHistoryPseudoPager.php
index 58ed1a03a4b..6ad6b132c4d 100644
--- a/includes/page/ImageHistoryPseudoPager.php
+++ b/includes/page/ImageHistoryPseudoPager.php
@@ -124,7 +124,7 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
if ( count( $this->mHist ) ) {
if ( $this->mImg->isLocal() ) {
// Do a batch existence check for user pages and talkpages.
- $linkBatch = $this->linkBatchFactory->newLinkBatch();
+ $linkBatch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
for ( $i = $this->mRange[0]; $i <= $this->mRange[1]; $i++ ) {
$file = $this->mHist[$i];
$uploader = $file->getUploader( File::FOR_THIS_USER, $this->getAuthority() );
diff --git a/includes/parser/Parsoid/Config/DataAccess.php b/includes/parser/Parsoid/Config/DataAccess.php
index 758c7550e74..149e61b3605 100644
--- a/includes/parser/Parsoid/Config/DataAccess.php
+++ b/includes/parser/Parsoid/Config/DataAccess.php
@@ -198,9 +198,9 @@ class DataAccess extends IDataAccess {
$titleObjs[$name] = $t;
}
}
- $linkBatch = $this->linkBatchFactory->newLinkBatch( $titleObjs );
- $linkBatch->setCaller( __METHOD__ );
- $linkBatch->execute();
+ $this->linkBatchFactory->newLinkBatch( $titleObjs )
+ ->setCaller( __METHOD__ )
+ ->execute();
foreach ( $titleObjs as $obj ) {
$pdbk = $obj->getPrefixedDBkey();
diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php
index 14809f48614..eda9fa5e957 100644
--- a/includes/search/SearchEngine.php
+++ b/includes/search/SearchEngine.php
@@ -674,12 +674,13 @@ abstract class SearchEngine {
$search = trim( $search );
// preload the titles with LinkBatch
- $linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
- $lb = $linkBatchFactory->newLinkBatch( $suggestions->map( static function ( SearchSuggestion $sugg ) {
+ $suggestedTitles = $suggestions->map( static function ( SearchSuggestion $sugg ) {
return $sugg->getSuggestedTitle();
- } ) );
- $lb->setCaller( __METHOD__ );
- $lb->execute();
+ } );
+ $linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
+ $linkBatchFactory->newLinkBatch( $suggestedTitles )
+ ->setCaller( __METHOD__ )
+ ->execute();
$diff = $suggestions->filter( static function ( SearchSuggestion $sugg ) {
return $sugg->getSuggestedTitle()->isKnown();
diff --git a/includes/search/TitlePrefixSearch.php b/includes/search/TitlePrefixSearch.php
index ccecbf053bf..1929b14d628 100644
--- a/includes/search/TitlePrefixSearch.php
+++ b/includes/search/TitlePrefixSearch.php
@@ -45,9 +45,9 @@ class TitlePrefixSearch extends PrefixSearch {
protected function strings( array $strings ) {
$titles = array_map( [ Title::class, 'newFromText' ], $strings );
$linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
- $lb = $linkBatchFactory->newLinkBatch( $titles );
- $lb->setCaller( __METHOD__ );
- $lb->execute();
+ $linkBatchFactory->newLinkBatch( $titles )
+ ->setCaller( __METHOD__ )
+ ->execute();
return $titles;
}
}
diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php
index 069667df720..7058c341b52 100644
--- a/includes/skins/Skin.php
+++ b/includes/skins/Skin.php
@@ -592,9 +592,9 @@ abstract class Skin extends ContextSource {
if ( $titles ) {
$linkBatchFactory = MediaWikiServices::getInstance()->getLinkBatchFactory();
- $lb = $linkBatchFactory->newLinkBatch( $titles );
- $lb->setCaller( __METHOD__ );
- $lb->execute();
+ $linkBatchFactory->newLinkBatch( $titles )
+ ->setCaller( __METHOD__ )
+ ->execute();
}
}
diff --git a/includes/specials/SpecialDoubleRedirects.php b/includes/specials/SpecialDoubleRedirects.php
index 0cbbfb371be..d9582cdb1be 100644
--- a/includes/specials/SpecialDoubleRedirects.php
+++ b/includes/specials/SpecialDoubleRedirects.php
@@ -231,7 +231,7 @@ class SpecialDoubleRedirects extends QueryPage {
return;
}
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $res as $row ) {
$batch->add( $row->namespace, $row->title );
if ( isset( $row->b_namespace ) ) {
diff --git a/includes/specials/SpecialFileDuplicateSearch.php b/includes/specials/SpecialFileDuplicateSearch.php
index 4da9ed49c80..c2a706560b7 100644
--- a/includes/specials/SpecialFileDuplicateSearch.php
+++ b/includes/specials/SpecialFileDuplicateSearch.php
@@ -183,7 +183,7 @@ class SpecialFileDuplicateSearch extends SpecialPage {
* @param File[] $list
*/
private function doBatchLookups( $list ) {
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $list as $file ) {
$batch->addObj( $file->getTitle() );
if ( $file->isLocal() ) {
diff --git a/includes/specials/SpecialListRedirects.php b/includes/specials/SpecialListRedirects.php
index 2f82304532b..fcaeef6185c 100644
--- a/includes/specials/SpecialListRedirects.php
+++ b/includes/specials/SpecialListRedirects.php
@@ -103,7 +103,7 @@ class SpecialListRedirects extends QueryPage {
return;
}
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $res as $row ) {
$batch->add( $row->namespace, $row->title );
$redirTarget = $this->getRedirectTarget( $row );
diff --git a/includes/specials/SpecialMovePage.php b/includes/specials/SpecialMovePage.php
index 751947b5b92..057363b0e7d 100644
--- a/includes/specials/SpecialMovePage.php
+++ b/includes/specials/SpecialMovePage.php
@@ -1030,9 +1030,9 @@ class SpecialMovePage extends UnlistedSpecialPage {
}
$out->addHTML( "<ul>\n" );
- $linkBatch = $this->linkBatchFactory->newLinkBatch( $subpages );
- $linkBatch->setCaller( __METHOD__ );
- $linkBatch->execute();
+ $this->linkBatchFactory->newLinkBatch( $subpages )
+ ->setCaller( __METHOD__ )
+ ->execute();
$linkRenderer = $this->getLinkRenderer();
foreach ( $subpages as $subpage ) {
diff --git a/includes/specials/SpecialTrackingCategories.php b/includes/specials/SpecialTrackingCategories.php
index c0e05ce6d62..74abed7fd3e 100644
--- a/includes/specials/SpecialTrackingCategories.php
+++ b/includes/specials/SpecialTrackingCategories.php
@@ -71,7 +71,7 @@ class SpecialTrackingCategories extends SpecialPage {
$categoryList = $this->trackingCategories->getTrackingCategories();
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $categoryList as $data ) {
$batch->addObj( $data['msg'] );
foreach ( $data['cats'] as $catTitle ) {
diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php
index 380cda7b7dc..921a7765747 100644
--- a/includes/specials/SpecialUndelete.php
+++ b/includes/specials/SpecialUndelete.php
@@ -981,7 +981,7 @@ class SpecialUndelete extends SpecialPage {
$extraConds,
self::REVISION_HISTORY_LIMIT + 1
);
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
$this->addRevisionsToBatch( $batch, $revisions );
$batch->execute();
$out->addHTML( $this->formatRevisionHistory( $revisions ) );
@@ -1059,7 +1059,7 @@ class SpecialUndelete extends SpecialPage {
# Batch existence check on user and talk pages
if ( $haveRevisions || $haveFiles ) {
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
$this->addRevisionsToBatch( $batch, $revisions );
if ( $haveFiles ) {
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable -- $files is non-null
diff --git a/includes/specials/SpecialUnwatchedPages.php b/includes/specials/SpecialUnwatchedPages.php
index c062a33a7cb..cbf0a4e5ee8 100644
--- a/includes/specials/SpecialUnwatchedPages.php
+++ b/includes/specials/SpecialUnwatchedPages.php
@@ -77,7 +77,7 @@ class SpecialUnwatchedPages extends QueryPage {
return;
}
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $res as $row ) {
$batch->add( $row->namespace, $row->title );
}
diff --git a/includes/specials/SpecialWhatLinksHere.php b/includes/specials/SpecialWhatLinksHere.php
index 4c9110f7370..356e58fc3d3 100644
--- a/includes/specials/SpecialWhatLinksHere.php
+++ b/includes/specials/SpecialWhatLinksHere.php
@@ -434,9 +434,8 @@ class SpecialWhatLinksHere extends FormSpecialPage {
}
}
- // use LinkBatch to make sure, that all required data (associated with Titles)
- // is loaded in one query
- $lb = $this->linkBatchFactory->newLinkBatch();
+ // Optimization: Batch preload all Title data in one query
+ $lb = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $rows as $row ) {
$lb->add( $row->page_namespace, $row->page_title );
}
diff --git a/includes/specials/pagers/ImageListPager.php b/includes/specials/pagers/ImageListPager.php
index fccf4e3221b..40f7c41c917 100644
--- a/includes/specials/pagers/ImageListPager.php
+++ b/includes/specials/pagers/ImageListPager.php
@@ -505,7 +505,7 @@ class ImageListPager extends TablePager {
protected function doBatchLookups() {
$this->mResult->seek( 0 );
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
$rowsWithComments = [ 'img_description' => [], 'oi_description' => [], 'fr_description' => [] ];
foreach ( $this->mResult as $i => $row ) {
$batch->addUser( new UserIdentityValue( $row->actor_user ?? 0, $row->actor_name ) );
diff --git a/includes/specials/pagers/MergeHistoryPager.php b/includes/specials/pagers/MergeHistoryPager.php
index b344aa664ae..f3f49cbdad8 100644
--- a/includes/specials/pagers/MergeHistoryPager.php
+++ b/includes/specials/pagers/MergeHistoryPager.php
@@ -101,7 +101,7 @@ class MergeHistoryPager extends ReverseChronologicalPager {
protected function doBatchLookups() {
# Do a link batch query
$this->mResult->seek( 0 );
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
# Give some pointers to make (last) links
$this->prevId = [];
$rev_id = null;
diff --git a/includes/specials/pagers/NewFilesPager.php b/includes/specials/pagers/NewFilesPager.php
index 0f23f3e3c5f..0f21d9728d8 100644
--- a/includes/specials/pagers/NewFilesPager.php
+++ b/includes/specials/pagers/NewFilesPager.php
@@ -195,7 +195,7 @@ class NewFilesPager extends RangeChronologicalPager {
protected function doBatchLookups() {
$this->mResult->seek( 0 );
- $lb = $this->linkBatchFactory->newLinkBatch();
+ $lb = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $this->mResult as $row ) {
if ( $row->actor_user ) {
$lb->add( NS_USER, $row->actor_name );
diff --git a/includes/specials/pagers/ProtectedTitlesPager.php b/includes/specials/pagers/ProtectedTitlesPager.php
index 52cf5ae9071..91c950f3fda 100644
--- a/includes/specials/pagers/ProtectedTitlesPager.php
+++ b/includes/specials/pagers/ProtectedTitlesPager.php
@@ -57,12 +57,11 @@ class ProtectedTitlesPager extends AlphabeticPager {
protected function doBatchLookups() {
$this->mResult->seek( 0 );
- $lb = $this->linkBatchFactory->newLinkBatch();
+ $lb = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
foreach ( $this->mResult as $row ) {
$lb->add( $row->pt_namespace, $row->pt_title );
}
-
$lb->execute();
}
diff --git a/includes/specials/pagers/UsersPager.php b/includes/specials/pagers/UsersPager.php
index 072455d89a3..306d6137421 100644
--- a/includes/specials/pagers/UsersPager.php
+++ b/includes/specials/pagers/UsersPager.php
@@ -319,7 +319,7 @@ class UsersPager extends AlphabeticPager {
}
protected function doBatchLookups() {
- $batch = $this->linkBatchFactory->newLinkBatch();
+ $batch = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
$userIds = [];
# Give some pointers to make user links
foreach ( $this->mResult as $row ) {
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:33 AM (1 d, 7 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227826
Default Alt Text
(17 KB)
Attached To
Mode
rMW mediawiki
Attached
Detach File
Event Timeline
Log In to Comment