Adamw has uploaded a new change for review.
https://gerrit.wikimedia.org/r/91824
Change subject: Save a ton of memory in GlobalAllocation
......................................................................
Save a ton of memory in GlobalAllocation
Untold savings. Render Messages to text and discard along with parameters.
Change-Id: I75bc647a966e5f36a34e84402f629f0ff3d2d776
---
M special/SpecialGlobalAllocation.php
1 file changed, 22 insertions(+), 9 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice
refs/changes/24/91824/1
diff --git a/special/SpecialGlobalAllocation.php
b/special/SpecialGlobalAllocation.php
index 693e4db..71f0585 100644
--- a/special/SpecialGlobalAllocation.php
+++ b/special/SpecialGlobalAllocation.php
@@ -294,15 +294,15 @@
$htmlOut .= Html::openElement( 'tr', array(
'class'=>'mw-sp-centralnotice-allocationrow' ) );
$htmlOut .= Html::openElement( 'td' );
- $htmlOut .= $this->listProjects(
$row['projects'] );
+ $htmlOut .= $row['projects_label'];
$htmlOut .= Html::closeElement( 'td' );
$htmlOut .= Html::openElement( 'td' );
- $htmlOut .= $this->listLanguages(
$row['languages'] );
+ $htmlOut .= $row['languages_label'];
$htmlOut .= Html::closeElement( 'td' );
$htmlOut .= Html::openElement( 'td' );
- $htmlOut .= $this->listCountries(
$row['countries'] );
+ $htmlOut .= $row['countries_label'];
$htmlOut .= Html::closeElement( 'td' );
$htmlOut .= Html::closeElement( 'tr' );
@@ -310,10 +310,10 @@
$htmlOut .= Html::closeElement( 'table' );
$htmlOut .= $this->getBannerAllocationsTable(
- end( $grouping['rows'][0]['projects'] ),
- end( $grouping['rows'][0]['countries'] ),
- end( $grouping['rows'][0]['languages'] ),
- $grouping['rows'][0]['buckets']
+ $grouping['a_project'],
+ $grouping['a_country'],
+ $grouping['a_language'],
+ $grouping['a_num_buckets'] //XXX
);
}
@@ -382,14 +382,27 @@
$label = $this->msg(
'centralnotice-excluding-list',
$this->getLanguage()->commaList( $contributing ),
$this->getLanguage()->listToText( $excluding )
- );
+ )->text();
} else {
$label =
$this->getLanguage()->commaList( $contributing );
}
+ // Optimization: compact by rendering
as text
+ $rows = array();
+ foreach ( $result as $row ) {
+ $rows[] = array(
+ 'countries_label' =>
$this->listCountries( $row['countries'] ),
+ 'projects_label' =>
$this->listProjects( $row['projects'] ),
+ 'languages_label' =>
$this->listLanguages( $row['languages'] ),
+ );
+ }
$groupings[] = array(
'label' => $label,
- 'rows' => $result,
+ 'a_country' => end(
$result[0]['countries'] ),
+ 'a_project' => end(
$result[0]['projects'] ),
+ 'a_language' => end(
$result[0]['languages'] ),
+ 'a_num_buckets' =>
$result[0]['buckets'],
+ 'rows' => $rows,
);
}
}
--
To view, visit https://gerrit.wikimedia.org/r/91824
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I75bc647a966e5f36a34e84402f629f0ff3d2d776
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Adamw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits