Umherirrender has uploaded a new change for review.
https://gerrit.wikimedia.org/r/224227
Change subject: Add LinkBatch to Special:ListFiles
......................................................................
Add LinkBatch to Special:ListFiles
To prepare the delete link, the state of the page is needed, which
result in a database query for each row.
Added a LinkBatch to get the state of the pages at ones. Combine it
which the already existing LinkBatch for the user pages (inside
UserCache), which are linked from each table row to save one more query.
Change-Id: I2d1e0e66f1d7d8e3502621ef711bb06d2627373f
---
M includes/specials/SpecialListfiles.php
1 file changed, 17 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/27/224227/1
diff --git a/includes/specials/SpecialListfiles.php
b/includes/specials/SpecialListfiles.php
index 2d79aaf..2937b83 100644
--- a/includes/specials/SpecialListfiles.php
+++ b/includes/specials/SpecialListfiles.php
@@ -413,11 +413,26 @@
function doBatchLookups() {
$userIds = array();
$this->mResult->seek( 0 );
+ $linkBatch = new LinkBatch();
foreach ( $this->mResult as $row ) {
$userIds[] = $row->img_user;
+ $linkBatch->add( NS_FILE, $row->img_name );
}
- # Do a link batch query for names and userpages
- UserCache::singleton()->doQuery( $userIds, array( 'userpage' ),
__METHOD__ );
+
+ // fill LinkBatch with user page
+ if ( count( $userIds ) ) {
+ $userIds = array_unique( $userIds );
+ $userCache = UserCache::singleton();
+ $userCache->doQuery( $userIds, array(), __METHOD__ );
+ foreach ( $userIds as $userId ) {
+ $name = $userCache->getProp( $userId, 'name' );
+ if ( $name !== false ) {
+ $linkBatch->add( NS_USER, $name );
+ }
+ }
+ }
+
+ $linkBatch->execute();
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/224227
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2d1e0e66f1d7d8e3502621ef711bb06d2627373f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits