r104050 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104049‎ | r104050 | r104051 >
Date:16:49, 23 November 2011
Author:catrope
Status:ok
Tags:
Comment:
1.18wmf1: MFT r104049, which had already been tested on the live site prior to being committed
Modified paths:
  • /branches/wmf/1.18wmf1/extensions/GlobalUsage/GlobalUsageHooks.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/extensions/GlobalUsage/GlobalUsageHooks.php
@@ -17,7 +17,19 @@
1818
1919 // Create a list of locally existing images
2020 $images = array_keys( $linksUpdater->getImages() );
21 - $localFiles = array_keys( RepoGroup::singleton()->getLocalRepo()->findFiles( $images ) );
 21+
 22+ //$localFiles = array_keys( RepoGroup::singleton()->getLocalRepo()->findFiles( $images ) );
 23+ // Unrolling findFiles() here because pages with thousands of images trigger an OOM
 24+ // error while building an array with thousands of File objects (bug 32598)
 25+ $localFiles = array();
 26+ $repo = RepoGroup::singleton()->getLocalRepo();
 27+ foreach ( $images as $image ) {
 28+ $file = $repo->findFile( $image );
 29+ if ( $file ) {
 30+ $localFiles[] = $file->getTitle()->getDBkey();
 31+ }
 32+ }
 33+
2234 $missingFiles = array_diff( $images, $localFiles );
2335
2436 global $wgUseDumbLinkUpdate;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104049(bug 32598) Fix OOM errors in GlobalUsage caused by calling findFiles() on an...catrope16:37, 23 November 2011

Status & tagging log