job-queue insert should no longer fail for highly used templates (bug 5527)
[lhc/web/wiklou.git] / includes / LinksUpdate.php
1 <?php
2 /**
3 * See docs/deferred.txt
4 *
5 * @todo document (e.g. one-sentence top-level class description).
6 */
7 class LinksUpdate {
8
9 /**@{{
10 * @private
11 */
12 var $mId, //!< Page ID of the article linked from
13 $mTitle, //!< Title object of the article linked from
14 $mLinks, //!< Map of title strings to IDs for the links in the document
15 $mImages, //!< DB keys of the images used, in the array key only
16 $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones
17 $mExternals, //!< URLs of external links, array key only
18 $mCategories, //!< Map of category names to sort keys
19 $mInterlangs, //!< Map of language codes to titles
20 $mProperties, //!< Map of arbitrary name to value
21 $mDb, //!< Database connection reference
22 $mOptions, //!< SELECT options to be used (array)
23 $mRecursive; //!< Whether to queue jobs for recursive updates
24 /**@}}*/
25
26 /**
27 * Constructor
28 *
29 * @param Title $title Title of the page we're updating
30 * @param ParserOutput $parserOutput Output from a full parse of this page
31 * @param bool $recursive Queue jobs for recursive updates?
32 */
33 function LinksUpdate( $title, $parserOutput, $recursive = true ) {
34 global $wgAntiLockFlags;
35
36 if ( $wgAntiLockFlags & ALF_NO_LINK_LOCK ) {
37 $this->mOptions = array();
38 } else {
39 $this->mOptions = array( 'FOR UPDATE' );
40 }
41 $this->mDb = wfGetDB( DB_MASTER );
42
43 if ( !is_object( $title ) ) {
44 throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
45 "Please see Article::editUpdates() for an invocation example.\n" );
46 }
47 $this->mTitle = $title;
48 $this->mId = $title->getArticleID();
49
50 $this->mParserOutput = $parserOutput;
51 $this->mLinks = $parserOutput->getLinks();
52 $this->mImages = $parserOutput->getImages();
53 $this->mTemplates = $parserOutput->getTemplates();
54 $this->mExternals = $parserOutput->getExternalLinks();
55 $this->mCategories = $parserOutput->getCategories();
56 $this->mProperties = $parserOutput->getProperties();
57
58 # Convert the format of the interlanguage links
59 # I didn't want to change it in the ParserOutput, because that array is passed all
60 # the way back to the skin, so either a skin API break would be required, or an
61 # inefficient back-conversion.
62 $ill = $parserOutput->getLanguageLinks();
63 $this->mInterlangs = array();
64 foreach ( $ill as $link ) {
65 list( $key, $title ) = explode( ':', $link, 2 );
66 $this->mInterlangs[$key] = $title;
67 }
68
69 $this->mRecursive = $recursive;
70
71 wfRunHooks( 'LinksUpdateConstructed', array( &$this ) );
72 }
73
74 /**
75 * Update link tables with outgoing links from an updated article
76 */
77 function doUpdate() {
78 global $wgUseDumbLinkUpdate;
79
80 wfRunHooks( 'LinksUpdate', array( &$this ) );
81 if ( $wgUseDumbLinkUpdate ) {
82 $this->doDumbUpdate();
83 } else {
84 $this->doIncrementalUpdate();
85 }
86 wfRunHooks( 'LinksUpdateComplete', array( &$this ) );
87
88 }
89
90 protected function doIncrementalUpdate() {
91 wfProfileIn( __METHOD__ );
92
93 # Page links
94 $existing = $this->getExistingLinks();
95 $this->incrTableUpdate( 'pagelinks', 'pl', $this->getLinkDeletions( $existing ),
96 $this->getLinkInsertions( $existing ) );
97
98 # Image links
99 $existing = $this->getExistingImages();
100
101 $imageDeletes = $this->getImageDeletions( $existing );
102 $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes, $this->getImageInsertions( $existing ) );
103
104 # Invalidate all image description pages which had links added or removed
105 $imageUpdates = $imageDeletes + array_diff_key( $this->mImages, $existing );
106 $this->invalidateImageDescriptions( $imageUpdates );
107
108 # External links
109 $existing = $this->getExistingExternals();
110 $this->incrTableUpdate( 'externallinks', 'el', $this->getExternalDeletions( $existing ),
111 $this->getExternalInsertions( $existing ) );
112
113 # Language links
114 $existing = $this->getExistingInterlangs();
115 $this->incrTableUpdate( 'langlinks', 'll', $this->getInterlangDeletions( $existing ),
116 $this->getInterlangInsertions( $existing ) );
117
118 # Template links
119 $existing = $this->getExistingTemplates();
120 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
121 $this->getTemplateInsertions( $existing ) );
122
123 # Category links
124 $existing = $this->getExistingCategories();
125
126 $categoryDeletes = $this->getCategoryDeletions( $existing );
127
128 $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes, $this->getCategoryInsertions( $existing ) );
129
130 # Invalidate all categories which were added, deleted or changed (set symmetric difference)
131 $categoryInserts = array_diff_assoc( $this->mCategories, $existing );
132 $categoryUpdates = $categoryInserts + $categoryDeletes;
133 $this->invalidateCategories( $categoryUpdates );
134 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
135
136 # Page properties
137 $existing = $this->getExistingProperties();
138
139 $propertiesDeletes = $this->getPropertyDeletions( $existing );
140
141 $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes, $this->getPropertyInsertions( $existing ) );
142
143 # Invalidate the necessary pages
144 $changed = $propertiesDeletes + array_diff_assoc( $this->mProperties, $existing );
145 $this->invalidateProperties( $changed );
146
147 # Refresh links of all pages including this page
148 # This will be in a separate transaction
149 if ( $this->mRecursive ) {
150 $this->queueRecursiveJobs();
151 }
152
153 wfProfileOut( __METHOD__ );
154 }
155
156 /**
157 * Link update which clears the previous entries and inserts new ones
158 * May be slower or faster depending on level of lock contention and write speed of DB
159 * Also useful where link table corruption needs to be repaired, e.g. in refreshLinks.php
160 */
161 protected function doDumbUpdate() {
162 wfProfileIn( __METHOD__ );
163
164 # Refresh category pages and image description pages
165 $existing = $this->getExistingCategories();
166 $categoryInserts = array_diff_assoc( $this->mCategories, $existing );
167 $categoryDeletes = array_diff_assoc( $existing, $this->mCategories );
168 $categoryUpdates = $categoryInserts + $categoryDeletes;
169 $existing = $this->getExistingImages();
170 $imageUpdates = array_diff_key( $existing, $this->mImages ) + array_diff_key( $this->mImages, $existing );
171
172 $this->dumbTableUpdate( 'pagelinks', $this->getLinkInsertions(), 'pl_from' );
173 $this->dumbTableUpdate( 'imagelinks', $this->getImageInsertions(), 'il_from' );
174 $this->dumbTableUpdate( 'categorylinks', $this->getCategoryInsertions(), 'cl_from' );
175 $this->dumbTableUpdate( 'templatelinks', $this->getTemplateInsertions(), 'tl_from' );
176 $this->dumbTableUpdate( 'externallinks', $this->getExternalInsertions(), 'el_from' );
177 $this->dumbTableUpdate( 'langlinks', $this->getInterlangInsertions(),'ll_from' );
178 $this->dumbTableUpdate( 'page_props', $this->getPropertyInsertions(), 'pp_page' );
179
180 # Update the cache of all the category pages and image description
181 # pages which were changed, and fix the category table count
182 $this->invalidateCategories( $categoryUpdates );
183 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
184 $this->invalidateImageDescriptions( $imageUpdates );
185
186 # Refresh links of all pages including this page
187 # This will be in a separate transaction
188 if ( $this->mRecursive ) {
189 $this->queueRecursiveJobs();
190 }
191
192 wfProfileOut( __METHOD__ );
193 }
194
195 function queueRecursiveJobs() {
196 global $wgUpdateRowsPerJob;
197 wfProfileIn( __METHOD__ );
198
199 $dbr = wfGetDB( DB_SLAVE );
200 $res = $dbr->select( 'templatelinks',
201 array( 'tl_from' ),
202 array(
203 'tl_namespace' => $this->mTitle->getNamespace(),
204 'tl_title' => $this->mTitle->getDBkey()
205 ), __METHOD__
206 );
207
208 $numRows = $res->numRows();
209 $numBatches = ceil( $numRows / $wgUpdateRowsPerJob );
210 $realBatchSize = $numRows / $numBatches;
211 $start = false;
212 $jobs = array();
213 do {
214 for( $i = 0; $i <= $realBatchSize - 1; $i++ ) {
215 $row = $res->fetchRow();
216 if( $row ) {
217 $id = $row[0];
218 } else {
219 $id = false;
220 break;
221 }
222 }
223 $params = array(
224 'start' => $start,
225 'end' => ( $id !== false ? $id - 1 : false ),
226 );
227 $jobs[] = new RefreshLinksJob2( $this->mTitle, $params );
228
229 $start = $id;
230 } while ( $start );
231
232 $dbr->freeResult( $res );
233
234 Job::batchInsert( $jobs );
235
236 wfProfileOut( __METHOD__ );
237 }
238
239 /**
240 * Invalidate the cache of a list of pages from a single namespace
241 *
242 * @param integer $namespace
243 * @param array $dbkeys
244 */
245 function invalidatePages( $namespace, $dbkeys ) {
246 if ( !count( $dbkeys ) ) {
247 return;
248 }
249
250 /**
251 * Determine which pages need to be updated
252 * This is necessary to prevent the job queue from smashing the DB with
253 * large numbers of concurrent invalidations of the same page
254 */
255 $now = $this->mDb->timestamp();
256 $ids = array();
257 $res = $this->mDb->select( 'page', array( 'page_id' ),
258 array(
259 'page_namespace' => $namespace,
260 'page_title IN (' . $this->mDb->makeList( $dbkeys ) . ')',
261 'page_touched < ' . $this->mDb->addQuotes( $now )
262 ), __METHOD__
263 );
264 while ( $row = $this->mDb->fetchObject( $res ) ) {
265 $ids[] = $row->page_id;
266 }
267 if ( !count( $ids ) ) {
268 return;
269 }
270
271 /**
272 * Do the update
273 * We still need the page_touched condition, in case the row has changed since
274 * the non-locking select above.
275 */
276 $this->mDb->update( 'page', array( 'page_touched' => $now ),
277 array(
278 'page_id IN (' . $this->mDb->makeList( $ids ) . ')',
279 'page_touched < ' . $this->mDb->addQuotes( $now )
280 ), __METHOD__
281 );
282 }
283
284 function invalidateCategories( $cats ) {
285 $this->invalidatePages( NS_CATEGORY, array_keys( $cats ) );
286 }
287
288 /**
289 * Update all the appropriate counts in the category table.
290 * @param $added associative array of category name => sort key
291 * @param $deleted associative array of category name => sort key
292 */
293 function updateCategoryCounts( $added, $deleted ) {
294 $a = new Article($this->mTitle);
295 $a->updateCategoryCounts(
296 array_keys( $added ), array_keys( $deleted )
297 );
298 }
299
300 function invalidateImageDescriptions( $images ) {
301 $this->invalidatePages( NS_IMAGE, array_keys( $images ) );
302 }
303
304 function dumbTableUpdate( $table, $insertions, $fromField ) {
305 $this->mDb->delete( $table, array( $fromField => $this->mId ), __METHOD__ );
306 if ( count( $insertions ) ) {
307 # The link array was constructed without FOR UPDATE, so there may
308 # be collisions. This may cause minor link table inconsistencies,
309 # which is better than crippling the site with lock contention.
310 $this->mDb->insert( $table, $insertions, __METHOD__, array( 'IGNORE' ) );
311 }
312 }
313
314 /**
315 * Make a WHERE clause from a 2-d NS/dbkey array
316 *
317 * @param array $arr 2-d array indexed by namespace and DB key
318 * @param string $prefix Field name prefix, without the underscore
319 */
320 function makeWhereFrom2d( &$arr, $prefix ) {
321 $lb = new LinkBatch;
322 $lb->setArray( $arr );
323 return $lb->constructSet( $prefix, $this->mDb );
324 }
325
326 /**
327 * Update a table by doing a delete query then an insert query
328 * @private
329 */
330 function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
331 if ( $table == 'page_props' ) {
332 $fromField = 'pp_page';
333 } else {
334 $fromField = "{$prefix}_from";
335 }
336 $where = array( $fromField => $this->mId );
337 if ( $table == 'pagelinks' || $table == 'templatelinks' ) {
338 $clause = $this->makeWhereFrom2d( $deletions, $prefix );
339 if ( $clause ) {
340 $where[] = $clause;
341 } else {
342 $where = false;
343 }
344 } else {
345 if ( $table == 'langlinks' ) {
346 $toField = 'll_lang';
347 } elseif ( $table == 'page_props' ) {
348 $toField = 'pp_propname';
349 } else {
350 $toField = $prefix . '_to';
351 }
352 if ( count( $deletions ) ) {
353 $where[] = "$toField IN (" . $this->mDb->makeList( array_keys( $deletions ) ) . ')';
354 } else {
355 $where = false;
356 }
357 }
358 if ( $where ) {
359 $this->mDb->delete( $table, $where, __METHOD__ );
360 }
361 if ( count( $insertions ) ) {
362 $this->mDb->insert( $table, $insertions, __METHOD__, 'IGNORE' );
363 }
364 }
365
366
367 /**
368 * Get an array of pagelinks insertions for passing to the DB
369 * Skips the titles specified by the 2-D array $existing
370 * @private
371 */
372 function getLinkInsertions( $existing = array() ) {
373 $arr = array();
374 foreach( $this->mLinks as $ns => $dbkeys ) {
375 # array_diff_key() was introduced in PHP 5.1, there is a compatibility function
376 # in GlobalFunctions.php
377 $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
378 foreach ( $diffs as $dbk => $id ) {
379 $arr[] = array(
380 'pl_from' => $this->mId,
381 'pl_namespace' => $ns,
382 'pl_title' => $dbk
383 );
384 }
385 }
386 return $arr;
387 }
388
389 /**
390 * Get an array of template insertions. Like getLinkInsertions()
391 * @private
392 */
393 function getTemplateInsertions( $existing = array() ) {
394 $arr = array();
395 foreach( $this->mTemplates as $ns => $dbkeys ) {
396 $diffs = isset( $existing[$ns] ) ? array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
397 foreach ( $diffs as $dbk => $id ) {
398 $arr[] = array(
399 'tl_from' => $this->mId,
400 'tl_namespace' => $ns,
401 'tl_title' => $dbk
402 );
403 }
404 }
405 return $arr;
406 }
407
408 /**
409 * Get an array of image insertions
410 * Skips the names specified in $existing
411 * @private
412 */
413 function getImageInsertions( $existing = array() ) {
414 $arr = array();
415 $diffs = array_diff_key( $this->mImages, $existing );
416 foreach( $diffs as $iname => $dummy ) {
417 $arr[] = array(
418 'il_from' => $this->mId,
419 'il_to' => $iname
420 );
421 }
422 return $arr;
423 }
424
425 /**
426 * Get an array of externallinks insertions. Skips the names specified in $existing
427 * @private
428 */
429 function getExternalInsertions( $existing = array() ) {
430 $arr = array();
431 $diffs = array_diff_key( $this->mExternals, $existing );
432 foreach( $diffs as $url => $dummy ) {
433 $arr[] = array(
434 'el_from' => $this->mId,
435 'el_to' => $url,
436 'el_index' => wfMakeUrlIndex( $url ),
437 );
438 }
439 return $arr;
440 }
441
442 /**
443 * Get an array of category insertions
444 * @param array $existing Array mapping existing category names to sort keys. If both
445 * match a link in $this, the link will be omitted from the output
446 * @private
447 */
448 function getCategoryInsertions( $existing = array() ) {
449 $diffs = array_diff_assoc( $this->mCategories, $existing );
450 $arr = array();
451 foreach ( $diffs as $name => $sortkey ) {
452 $arr[] = array(
453 'cl_from' => $this->mId,
454 'cl_to' => $name,
455 'cl_sortkey' => $sortkey,
456 'cl_timestamp' => $this->mDb->timestamp()
457 );
458 }
459 return $arr;
460 }
461
462 /**
463 * Get an array of interlanguage link insertions
464 * @param array $existing Array mapping existing language codes to titles
465 * @private
466 */
467 function getInterlangInsertions( $existing = array() ) {
468 $diffs = array_diff_assoc( $this->mInterlangs, $existing );
469 $arr = array();
470 foreach( $diffs as $lang => $title ) {
471 $arr[] = array(
472 'll_from' => $this->mId,
473 'll_lang' => $lang,
474 'll_title' => $title
475 );
476 }
477 return $arr;
478 }
479
480 /**
481 * Get an array of page property insertions
482 */
483 function getPropertyInsertions( $existing = array() ) {
484 $diffs = array_diff_assoc( $this->mProperties, $existing );
485 $arr = array();
486 foreach ( $diffs as $name => $value ) {
487 $arr[] = array(
488 'pp_page' => $this->mId,
489 'pp_propname' => $name,
490 'pp_value' => $value,
491 );
492 }
493 return $arr;
494 }
495
496
497 /**
498 * Given an array of existing links, returns those links which are not in $this
499 * and thus should be deleted.
500 * @private
501 */
502 function getLinkDeletions( $existing ) {
503 $del = array();
504 foreach ( $existing as $ns => $dbkeys ) {
505 if ( isset( $this->mLinks[$ns] ) ) {
506 $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks[$ns] );
507 } else {
508 $del[$ns] = $existing[$ns];
509 }
510 }
511 return $del;
512 }
513
514 /**
515 * Given an array of existing templates, returns those templates which are not in $this
516 * and thus should be deleted.
517 * @private
518 */
519 function getTemplateDeletions( $existing ) {
520 $del = array();
521 foreach ( $existing as $ns => $dbkeys ) {
522 if ( isset( $this->mTemplates[$ns] ) ) {
523 $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates[$ns] );
524 } else {
525 $del[$ns] = $existing[$ns];
526 }
527 }
528 return $del;
529 }
530
531 /**
532 * Given an array of existing images, returns those images which are not in $this
533 * and thus should be deleted.
534 * @private
535 */
536 function getImageDeletions( $existing ) {
537 return array_diff_key( $existing, $this->mImages );
538 }
539
540 /**
541 * Given an array of existing external links, returns those links which are not
542 * in $this and thus should be deleted.
543 * @private
544 */
545 function getExternalDeletions( $existing ) {
546 return array_diff_key( $existing, $this->mExternals );
547 }
548
549 /**
550 * Given an array of existing categories, returns those categories which are not in $this
551 * and thus should be deleted.
552 * @private
553 */
554 function getCategoryDeletions( $existing ) {
555 return array_diff_assoc( $existing, $this->mCategories );
556 }
557
558 /**
559 * Given an array of existing interlanguage links, returns those links which are not
560 * in $this and thus should be deleted.
561 * @private
562 */
563 function getInterlangDeletions( $existing ) {
564 return array_diff_assoc( $existing, $this->mInterlangs );
565 }
566
567 /**
568 * Get array of properties which should be deleted.
569 * @private
570 */
571 function getPropertyDeletions( $existing ) {
572 return array_diff_assoc( $existing, $this->mProperties );
573 }
574
575 /**
576 * Get an array of existing links, as a 2-D array
577 * @private
578 */
579 function getExistingLinks() {
580 $res = $this->mDb->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
581 array( 'pl_from' => $this->mId ), __METHOD__, $this->mOptions );
582 $arr = array();
583 while ( $row = $this->mDb->fetchObject( $res ) ) {
584 if ( !isset( $arr[$row->pl_namespace] ) ) {
585 $arr[$row->pl_namespace] = array();
586 }
587 $arr[$row->pl_namespace][$row->pl_title] = 1;
588 }
589 $this->mDb->freeResult( $res );
590 return $arr;
591 }
592
593 /**
594 * Get an array of existing templates, as a 2-D array
595 * @private
596 */
597 function getExistingTemplates() {
598 $res = $this->mDb->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
599 array( 'tl_from' => $this->mId ), __METHOD__, $this->mOptions );
600 $arr = array();
601 while ( $row = $this->mDb->fetchObject( $res ) ) {
602 if ( !isset( $arr[$row->tl_namespace] ) ) {
603 $arr[$row->tl_namespace] = array();
604 }
605 $arr[$row->tl_namespace][$row->tl_title] = 1;
606 }
607 $this->mDb->freeResult( $res );
608 return $arr;
609 }
610
611 /**
612 * Get an array of existing images, image names in the keys
613 * @private
614 */
615 function getExistingImages() {
616 $res = $this->mDb->select( 'imagelinks', array( 'il_to' ),
617 array( 'il_from' => $this->mId ), __METHOD__, $this->mOptions );
618 $arr = array();
619 while ( $row = $this->mDb->fetchObject( $res ) ) {
620 $arr[$row->il_to] = 1;
621 }
622 $this->mDb->freeResult( $res );
623 return $arr;
624 }
625
626 /**
627 * Get an array of existing external links, URLs in the keys
628 * @private
629 */
630 function getExistingExternals() {
631 $res = $this->mDb->select( 'externallinks', array( 'el_to' ),
632 array( 'el_from' => $this->mId ), __METHOD__, $this->mOptions );
633 $arr = array();
634 while ( $row = $this->mDb->fetchObject( $res ) ) {
635 $arr[$row->el_to] = 1;
636 }
637 $this->mDb->freeResult( $res );
638 return $arr;
639 }
640
641 /**
642 * Get an array of existing categories, with the name in the key and sort key in the value.
643 * @private
644 */
645 function getExistingCategories() {
646 $res = $this->mDb->select( 'categorylinks', array( 'cl_to', 'cl_sortkey' ),
647 array( 'cl_from' => $this->mId ), __METHOD__, $this->mOptions );
648 $arr = array();
649 while ( $row = $this->mDb->fetchObject( $res ) ) {
650 $arr[$row->cl_to] = $row->cl_sortkey;
651 }
652 $this->mDb->freeResult( $res );
653 return $arr;
654 }
655
656 /**
657 * Get an array of existing interlanguage links, with the language code in the key and the
658 * title in the value.
659 * @private
660 */
661 function getExistingInterlangs() {
662 $res = $this->mDb->select( 'langlinks', array( 'll_lang', 'll_title' ),
663 array( 'll_from' => $this->mId ), __METHOD__, $this->mOptions );
664 $arr = array();
665 while ( $row = $this->mDb->fetchObject( $res ) ) {
666 $arr[$row->ll_lang] = $row->ll_title;
667 }
668 return $arr;
669 }
670
671 /**
672 * Get an array of existing categories, with the name in the key and sort key in the value.
673 * @private
674 */
675 function getExistingProperties() {
676 $res = $this->mDb->select( 'page_props', array( 'pp_propname', 'pp_value' ),
677 array( 'pp_page' => $this->mId ), __METHOD__, $this->mOptions );
678 $arr = array();
679 while ( $row = $this->mDb->fetchObject( $res ) ) {
680 $arr[$row->pp_propname] = $row->pp_value;
681 }
682 $this->mDb->freeResult( $res );
683 return $arr;
684 }
685
686
687 /**
688 * Return the title object of the page being updated
689 */
690 function getTitle() {
691 return $this->mTitle;
692 }
693
694 /**
695 * Invalidate any necessary link lists related to page property changes
696 */
697 function invalidateProperties( $changed ) {
698 global $wgPagePropLinkInvalidations;
699
700 foreach ( $changed as $name => $value ) {
701 if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
702 $inv = $wgPagePropLinkInvalidations[$name];
703 if ( !is_array( $inv ) ) {
704 $inv = array( $inv );
705 }
706 foreach ( $inv as $table ) {
707 $update = new HTMLCacheUpdate( $this->mTitle, $table );
708 $update->doUpdate();
709 }
710 }
711 }
712 }
713 }