jenkins-bot has submitted this change and it was merged.
Change subject: Special:PageTranslation: Slightly improve performance of
listPages
......................................................................
Special:PageTranslation: Slightly improve performance of listPages
* Use LinkBatch to perform one batch query for link cache
instead of a separate query for each page.
* Use Linker::linkKnown() instead of link() - saves a call to Title::isKnown()
- for links to this special page
Change-Id: I62cb78420cec73d80c7a0c49efd128ad8269dacb
---
M tag/SpecialPageTranslation.php
1 file changed, 15 insertions(+), 7 deletions(-)
Approvals:
Nikerabbit: Checked; Looks good to me, approved
jenkins-bot: Verified
diff --git a/tag/SpecialPageTranslation.php b/tag/SpecialPageTranslation.php
index a0c1896..7cdaa81 100644
--- a/tag/SpecialPageTranslation.php
+++ b/tag/SpecialPageTranslation.php
@@ -411,13 +411,21 @@
$out = $this->getOutput();
$res = $this->loadPagesFromDB();
- $allpages = $this->buildPageArray( $res );
- if ( !count( $allpages ) ) {
+ $allPages = $this->buildPageArray( $res );
+ if ( !count( $allPages ) ) {
$out->addWikiMsg( 'tpt-list-nopages' );
return;
}
- $types = $this->classifyPages( $allpages );
+
+ $lb = new LinkBatch();
+ $lb->setCaller( __METHOD__ );
+ foreach ( $allPages as $page ) {
+ $lb->addObj( $page['title'] );
+ }
+ $lb->execute();
+
+ $types = $this->classifyPages( $allPages );
$pages = $types['proposed'];
if ( count( $pages ) ) {
@@ -499,7 +507,7 @@
if ( $user->isAllowed( 'pagetranslation' ) ) {
$pending = $type === 'active' && $page['latest'] !==
$page['tp:mark'];
if ( $type === 'proposed' || $pending ) {
- $actions[] = Linker::link(
+ $actions[] = Linker::linkKnown(
$this->getPageTitle(),
$this->msg( 'tpt-rev-mark' )->escaped(),
array( 'title' => $this->msg(
'tpt-rev-mark-tooltip' )->text() ),
@@ -512,7 +520,7 @@
}
if ( $type === 'active' ) {
- $actions[] = Linker::link(
+ $actions[] = Linker::linkKnown(
$this->getPageTitle(),
$this->msg( 'tpt-rev-discourage'
)->escaped(),
array( 'title' => $this->msg(
'tpt-rev-discourage-tooltip' )->text() ) + $js,
@@ -523,7 +531,7 @@
)
);
} elseif ( $type === 'discouraged' ) {
- $actions[] = Linker::link(
+ $actions[] = Linker::linkKnown(
$this->getPageTitle(),
$this->msg( 'tpt-rev-encourage'
)->escaped(),
array( 'title' => $this->msg(
'tpt-rev-encourage-tooltip' )->text() ) + $js,
@@ -536,7 +544,7 @@
}
if ( $type !== 'proposed' ) {
- $actions[] = Linker::link(
+ $actions[] = Linker::linkKnown(
$this->getPageTitle(),
$this->msg( 'tpt-rev-unmark'
)->escaped(),
array( 'title' => $this->msg(
'tpt-rev-unmark-tooltip' )->text() ),
--
To view, visit https://gerrit.wikimedia.org/r/288010
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I62cb78420cec73d80c7a0c49efd128ad8269dacb
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits