r67614 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67613‎ | r67614 | r67615 >
Date:12:36, 8 June 2010
Author:jojo
Status:ok
Tags:
Comment:
use LinkBatch & LinkCache to speed up purge() method
Modified paths:
  • /trunk/extensions/Collection/Collection.session.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.session.php
@@ -114,10 +114,19 @@
115115 $coll = $_SESSION['wsCollection'];
116116 $newitems = array();
117117 if ( isset( $coll['items'] ) ) {
 118+ $batch = new LinkBatch;
 119+ $lc = LinkCache::singleton();
118120 foreach ( $coll['items'] as $index => $item ) {
119121 if ( $item['type'] == 'article' ) {
120122 $t = Title::newFromText( $item['title'] );
121 - if ( $t->exists() ) {
 123+ $batch->addObj( $t );
 124+ }
 125+ }
 126+ $batch->execute();
 127+ foreach ( $coll['items'] as $index => $item ) {
 128+ if ( $item['type'] == 'article' ) {
 129+ $t = Title::newFromText( $item['title'] );
 130+ if ( !$lc->isBadLink( $t->getPrefixedDbKey() ) ) {
122131 $newitems[] = $item;
123132 }
124133 } else {

Status & tagging log