3 * Updater for link tracking tables after a page edit.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 * See docs/deferred.txt
26 * @todo document (e.g. one-sentence top-level class description).
28 class LinksUpdate
extends SqlDataUpdate
{
29 // @todo make members protected, but make sure extensions don't break
31 public $mId, //!< Page ID of the article linked from
32 $mTitle, //!< Title object of the article linked from
33 $mParserOutput, //!< Parser output
34 $mLinks, //!< Map of title strings to IDs for the links in the document
35 $mImages, //!< DB keys of the images used, in the array key only
36 $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones
37 $mExternals, //!< URLs of external links, array key only
38 $mCategories, //!< Map of category names to sort keys
39 $mInterlangs, //!< Map of language codes to titles
40 $mProperties, //!< Map of arbitrary name to value
41 $mDb, //!< Database connection reference
42 $mOptions, //!< SELECT options to be used (array)
43 $mRecursive; //!< Whether to queue jobs for recursive updates
46 * @var null|array Added links if calculated.
48 private $linkInsertions = null;
51 * @var null|array Deleted links if calculated.
53 private $linkDeletions = null;
58 * @param $title Title of the page we're updating
59 * @param $parserOutput ParserOutput: output from a full parse of this page
60 * @param $recursive Boolean: queue jobs for recursive updates?
63 function __construct( $title, $parserOutput, $recursive = true ) {
64 parent
::__construct( false ); // no implicit transaction
66 if ( !( $title instanceof Title
) ) {
67 throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
68 "Please see Article::editUpdates() for an invocation example.\n" );
71 if ( !( $parserOutput instanceof ParserOutput
) ) {
72 throw new MWException( "The calling convention to LinksUpdate::__construct() has changed. " .
73 "Please see WikiPage::doEditUpdates() for an invocation example.\n" );
76 $this->mTitle
= $title;
77 $this->mId
= $title->getArticleID();
80 throw new MWException( "The Title object did not provide an article ID. Perhaps the page doesn't exist?" );
83 $this->mParserOutput
= $parserOutput;
85 $this->mLinks
= $parserOutput->getLinks();
86 $this->mImages
= $parserOutput->getImages();
87 $this->mTemplates
= $parserOutput->getTemplates();
88 $this->mExternals
= $parserOutput->getExternalLinks();
89 $this->mCategories
= $parserOutput->getCategories();
90 $this->mProperties
= $parserOutput->getProperties();
91 $this->mInterwikis
= $parserOutput->getInterwikiLinks();
93 # Convert the format of the interlanguage links
94 # I didn't want to change it in the ParserOutput, because that array is passed all
95 # the way back to the skin, so either a skin API break would be required, or an
96 # inefficient back-conversion.
97 $ill = $parserOutput->getLanguageLinks();
98 $this->mInterlangs
= array();
99 foreach ( $ill as $link ) {
100 list( $key, $title ) = explode( ':', $link, 2 );
101 $this->mInterlangs
[$key] = $title;
104 foreach ( $this->mCategories
as &$sortkey ) {
105 # If the sortkey is longer then 255 bytes,
106 # it truncated by DB, and then doesn't get
107 # matched when comparing existing vs current
108 # categories, causing bug 25254.
109 # Also. substr behaves weird when given "".
110 if ( $sortkey !== '' ) {
111 $sortkey = substr( $sortkey, 0, 255 );
115 $this->mRecursive
= $recursive;
117 wfRunHooks( 'LinksUpdateConstructed', array( &$this ) );
121 * Update link tables with outgoing links from an updated article
123 public function doUpdate() {
124 wfRunHooks( 'LinksUpdate', array( &$this ) );
125 $this->doIncrementalUpdate();
126 wfRunHooks( 'LinksUpdateComplete', array( &$this ) );
129 protected function doIncrementalUpdate() {
130 wfProfileIn( __METHOD__
);
133 $existing = $this->getExistingLinks();
134 $this->linkDeletions
= $this->getLinkDeletions( $existing );
135 $this->linkInsertions
= $this->getLinkInsertions( $existing );
136 $this->incrTableUpdate( 'pagelinks', 'pl', $this->linkDeletions
, $this->linkInsertions
);
139 $existing = $this->getExistingImages();
141 $imageDeletes = $this->getImageDeletions( $existing );
142 $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes,
143 $this->getImageInsertions( $existing ) );
145 # Invalidate all image description pages which had links added or removed
146 $imageUpdates = $imageDeletes +
array_diff_key( $this->mImages
, $existing );
147 $this->invalidateImageDescriptions( $imageUpdates );
150 $existing = $this->getExistingExternals();
151 $this->incrTableUpdate( 'externallinks', 'el', $this->getExternalDeletions( $existing ),
152 $this->getExternalInsertions( $existing ) );
155 $existing = $this->getExistingInterlangs();
156 $this->incrTableUpdate( 'langlinks', 'll', $this->getInterlangDeletions( $existing ),
157 $this->getInterlangInsertions( $existing ) );
159 # Inline interwiki links
160 $existing = $this->getExistingInterwikis();
161 $this->incrTableUpdate( 'iwlinks', 'iwl', $this->getInterwikiDeletions( $existing ),
162 $this->getInterwikiInsertions( $existing ) );
165 $existing = $this->getExistingTemplates();
166 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
167 $this->getTemplateInsertions( $existing ) );
170 $existing = $this->getExistingCategories();
172 $categoryDeletes = $this->getCategoryDeletions( $existing );
174 $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes,
175 $this->getCategoryInsertions( $existing ) );
177 # Invalidate all categories which were added, deleted or changed (set symmetric difference)
178 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
179 $categoryUpdates = $categoryInserts +
$categoryDeletes;
180 $this->invalidateCategories( $categoryUpdates );
181 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
184 $existing = $this->getExistingProperties();
186 $propertiesDeletes = $this->getPropertyDeletions( $existing );
188 $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
189 $this->getPropertyInsertions( $existing ) );
191 # Invalidate the necessary pages
192 $changed = $propertiesDeletes +
array_diff_assoc( $this->mProperties
, $existing );
193 $this->invalidateProperties( $changed );
195 # Refresh links of all pages including this page
196 # This will be in a separate transaction
197 if ( $this->mRecursive
) {
198 $this->queueRecursiveJobs();
201 wfProfileOut( __METHOD__
);
205 * Queue recursive jobs for this page
207 * Which means do LinksUpdate on all templates
208 * that include the current page, using the job queue.
210 function queueRecursiveJobs() {
211 self
::queueRecursiveJobsForTable( $this->mTitle
, 'templatelinks' );
215 * Queue a RefreshLinks job for any table.
217 * @param Title $title Title to do job for
218 * @param String $table Table to use (e.g. 'templatelinks')
220 public static function queueRecursiveJobsForTable( Title
$title, $table ) {
221 wfProfileIn( __METHOD__
);
222 if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
223 $job = new RefreshLinksJob2(
227 ) + Job
::newRootJobParams( // "overall" refresh links job info
228 "refreshlinks:{$table}:{$title->getPrefixedText()}"
231 JobQueueGroup
::singleton()->push( $job );
232 JobQueueGroup
::singleton()->deduplicateRootJob( $job );
234 wfProfileOut( __METHOD__
);
240 function invalidateCategories( $cats ) {
241 $this->invalidatePages( NS_CATEGORY
, array_keys( $cats ) );
245 * Update all the appropriate counts in the category table.
246 * @param array $added associative array of category name => sort key
247 * @param array $deleted associative array of category name => sort key
249 function updateCategoryCounts( $added, $deleted ) {
250 $a = WikiPage
::factory( $this->mTitle
);
251 $a->updateCategoryCounts(
252 array_keys( $added ), array_keys( $deleted )
259 function invalidateImageDescriptions( $images ) {
260 $this->invalidatePages( NS_FILE
, array_keys( $images ) );
264 * Update a table by doing a delete query then an insert query
270 function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
271 if ( $table == 'page_props' ) {
272 $fromField = 'pp_page';
274 $fromField = "{$prefix}_from";
276 $where = array( $fromField => $this->mId
);
277 if ( $table == 'pagelinks' ||
$table == 'templatelinks' ||
$table == 'iwlinks' ) {
278 if ( $table == 'iwlinks' ) {
279 $baseKey = 'iwl_prefix';
281 $baseKey = "{$prefix}_namespace";
283 $clause = $this->mDb
->makeWhereFrom2d( $deletions, $baseKey, "{$prefix}_title" );
290 if ( $table == 'langlinks' ) {
291 $toField = 'll_lang';
292 } elseif ( $table == 'page_props' ) {
293 $toField = 'pp_propname';
295 $toField = $prefix . '_to';
297 if ( count( $deletions ) ) {
298 $where[] = "$toField IN (" . $this->mDb
->makeList( array_keys( $deletions ) ) . ')';
304 $this->mDb
->delete( $table, $where, __METHOD__
);
306 if ( count( $insertions ) ) {
307 $this->mDb
->insert( $table, $insertions, __METHOD__
, 'IGNORE' );
308 wfRunHooks( 'LinksUpdateAfterInsert', array( $this, $table, $insertions ) );
313 * Get an array of pagelinks insertions for passing to the DB
314 * Skips the titles specified by the 2-D array $existing
315 * @param $existing array
318 private function getLinkInsertions( $existing = array() ) {
320 foreach ( $this->mLinks
as $ns => $dbkeys ) {
321 $diffs = isset( $existing[$ns] )
322 ?
array_diff_key( $dbkeys, $existing[$ns] )
324 foreach ( $diffs as $dbk => $id ) {
326 'pl_from' => $this->mId
,
327 'pl_namespace' => $ns,
337 * Get an array of template insertions. Like getLinkInsertions()
338 * @param $existing array
341 private function getTemplateInsertions( $existing = array() ) {
343 foreach ( $this->mTemplates
as $ns => $dbkeys ) {
344 $diffs = isset( $existing[$ns] ) ?
array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
345 foreach ( $diffs as $dbk => $id ) {
347 'tl_from' => $this->mId
,
348 'tl_namespace' => $ns,
358 * Get an array of image insertions
359 * Skips the names specified in $existing
360 * @param $existing array
363 private function getImageInsertions( $existing = array() ) {
365 $diffs = array_diff_key( $this->mImages
, $existing );
366 foreach ( $diffs as $iname => $dummy ) {
368 'il_from' => $this->mId
,
377 * Get an array of externallinks insertions. Skips the names specified in $existing
378 * @param $existing array
381 private function getExternalInsertions( $existing = array() ) {
383 $diffs = array_diff_key( $this->mExternals
, $existing );
384 foreach ( $diffs as $url => $dummy ) {
385 foreach ( wfMakeUrlIndexes( $url ) as $index ) {
387 'el_from' => $this->mId
,
389 'el_index' => $index,
398 * Get an array of category insertions
400 * @param array $existing mapping existing category names to sort keys. If both
401 * match a link in $this, the link will be omitted from the output
405 private function getCategoryInsertions( $existing = array() ) {
406 global $wgContLang, $wgCategoryCollation;
407 $diffs = array_diff_assoc( $this->mCategories
, $existing );
409 foreach ( $diffs as $name => $prefix ) {
410 $nt = Title
::makeTitleSafe( NS_CATEGORY
, $name );
411 $wgContLang->findVariantLink( $name, $nt, true );
413 if ( $this->mTitle
->getNamespace() == NS_CATEGORY
) {
415 } elseif ( $this->mTitle
->getNamespace() == NS_FILE
) {
421 # Treat custom sortkeys as a prefix, so that if multiple
422 # things are forced to sort as '*' or something, they'll
423 # sort properly in the category rather than in page_id
425 $sortkey = Collation
::singleton()->getSortKey(
426 $this->mTitle
->getCategorySortkey( $prefix ) );
429 'cl_from' => $this->mId
,
431 'cl_sortkey' => $sortkey,
432 'cl_timestamp' => $this->mDb
->timestamp(),
433 'cl_sortkey_prefix' => $prefix,
434 'cl_collation' => $wgCategoryCollation,
443 * Get an array of interlanguage link insertions
445 * @param array $existing mapping existing language codes to titles
449 private function getInterlangInsertions( $existing = array() ) {
450 $diffs = array_diff_assoc( $this->mInterlangs
, $existing );
452 foreach ( $diffs as $lang => $title ) {
454 'll_from' => $this->mId
,
464 * Get an array of page property insertions
465 * @param $existing array
468 function getPropertyInsertions( $existing = array() ) {
469 $diffs = array_diff_assoc( $this->mProperties
, $existing );
471 foreach ( $diffs as $name => $value ) {
473 'pp_page' => $this->mId
,
474 'pp_propname' => $name,
475 'pp_value' => $value,
483 * Get an array of interwiki insertions for passing to the DB
484 * Skips the titles specified by the 2-D array $existing
485 * @param $existing array
488 private function getInterwikiInsertions( $existing = array() ) {
490 foreach ( $this->mInterwikis
as $prefix => $dbkeys ) {
491 $diffs = isset( $existing[$prefix] ) ?
array_diff_key( $dbkeys, $existing[$prefix] ) : $dbkeys;
492 foreach ( $diffs as $dbk => $id ) {
494 'iwl_from' => $this->mId
,
495 'iwl_prefix' => $prefix,
505 * Given an array of existing links, returns those links which are not in $this
506 * and thus should be deleted.
507 * @param $existing array
510 private function getLinkDeletions( $existing ) {
512 foreach ( $existing as $ns => $dbkeys ) {
513 if ( isset( $this->mLinks
[$ns] ) ) {
514 $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks
[$ns] );
516 $del[$ns] = $existing[$ns];
524 * Given an array of existing templates, returns those templates which are not in $this
525 * and thus should be deleted.
526 * @param $existing array
529 private function getTemplateDeletions( $existing ) {
531 foreach ( $existing as $ns => $dbkeys ) {
532 if ( isset( $this->mTemplates
[$ns] ) ) {
533 $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates
[$ns] );
535 $del[$ns] = $existing[$ns];
543 * Given an array of existing images, returns those images which are not in $this
544 * and thus should be deleted.
545 * @param $existing array
548 private function getImageDeletions( $existing ) {
549 return array_diff_key( $existing, $this->mImages
);
553 * Given an array of existing external links, returns those links which are not
554 * in $this and thus should be deleted.
555 * @param $existing array
558 private function getExternalDeletions( $existing ) {
559 return array_diff_key( $existing, $this->mExternals
);
563 * Given an array of existing categories, returns those categories which are not in $this
564 * and thus should be deleted.
565 * @param $existing array
568 private function getCategoryDeletions( $existing ) {
569 return array_diff_assoc( $existing, $this->mCategories
);
573 * Given an array of existing interlanguage links, returns those links which are not
574 * in $this and thus should be deleted.
575 * @param $existing array
578 private function getInterlangDeletions( $existing ) {
579 return array_diff_assoc( $existing, $this->mInterlangs
);
583 * Get array of properties which should be deleted.
584 * @param $existing array
587 function getPropertyDeletions( $existing ) {
588 return array_diff_assoc( $existing, $this->mProperties
);
592 * Given an array of existing interwiki links, returns those links which are not in $this
593 * and thus should be deleted.
594 * @param $existing array
597 private function getInterwikiDeletions( $existing ) {
599 foreach ( $existing as $prefix => $dbkeys ) {
600 if ( isset( $this->mInterwikis
[$prefix] ) ) {
601 $del[$prefix] = array_diff_key( $existing[$prefix], $this->mInterwikis
[$prefix] );
603 $del[$prefix] = $existing[$prefix];
611 * Get an array of existing links, as a 2-D array
615 private function getExistingLinks() {
616 $res = $this->mDb
->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
617 array( 'pl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
619 foreach ( $res as $row ) {
620 if ( !isset( $arr[$row->pl_namespace
] ) ) {
621 $arr[$row->pl_namespace
] = array();
623 $arr[$row->pl_namespace
][$row->pl_title
] = 1;
630 * Get an array of existing templates, as a 2-D array
634 private function getExistingTemplates() {
635 $res = $this->mDb
->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
636 array( 'tl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
638 foreach ( $res as $row ) {
639 if ( !isset( $arr[$row->tl_namespace
] ) ) {
640 $arr[$row->tl_namespace
] = array();
642 $arr[$row->tl_namespace
][$row->tl_title
] = 1;
649 * Get an array of existing images, image names in the keys
653 private function getExistingImages() {
654 $res = $this->mDb
->select( 'imagelinks', array( 'il_to' ),
655 array( 'il_from' => $this->mId
), __METHOD__
, $this->mOptions
);
657 foreach ( $res as $row ) {
658 $arr[$row->il_to
] = 1;
665 * Get an array of existing external links, URLs in the keys
669 private function getExistingExternals() {
670 $res = $this->mDb
->select( 'externallinks', array( 'el_to' ),
671 array( 'el_from' => $this->mId
), __METHOD__
, $this->mOptions
);
673 foreach ( $res as $row ) {
674 $arr[$row->el_to
] = 1;
681 * Get an array of existing categories, with the name in the key and sort key in the value.
685 private function getExistingCategories() {
686 $res = $this->mDb
->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
687 array( 'cl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
689 foreach ( $res as $row ) {
690 $arr[$row->cl_to
] = $row->cl_sortkey_prefix
;
697 * Get an array of existing interlanguage links, with the language code in the key and the
698 * title in the value.
702 private function getExistingInterlangs() {
703 $res = $this->mDb
->select( 'langlinks', array( 'll_lang', 'll_title' ),
704 array( 'll_from' => $this->mId
), __METHOD__
, $this->mOptions
);
706 foreach ( $res as $row ) {
707 $arr[$row->ll_lang
] = $row->ll_title
;
714 * Get an array of existing inline interwiki links, as a 2-D array
715 * @return array (prefix => array(dbkey => 1))
717 protected function getExistingInterwikis() {
718 $res = $this->mDb
->select( 'iwlinks', array( 'iwl_prefix', 'iwl_title' ),
719 array( 'iwl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
721 foreach ( $res as $row ) {
722 if ( !isset( $arr[$row->iwl_prefix
] ) ) {
723 $arr[$row->iwl_prefix
] = array();
725 $arr[$row->iwl_prefix
][$row->iwl_title
] = 1;
732 * Get an array of existing categories, with the name in the key and sort key in the value.
736 private function getExistingProperties() {
737 $res = $this->mDb
->select( 'page_props', array( 'pp_propname', 'pp_value' ),
738 array( 'pp_page' => $this->mId
), __METHOD__
, $this->mOptions
);
740 foreach ( $res as $row ) {
741 $arr[$row->pp_propname
] = $row->pp_value
;
748 * Return the title object of the page being updated
751 public function getTitle() {
752 return $this->mTitle
;
756 * Returns parser output
758 * @return ParserOutput
760 public function getParserOutput() {
761 return $this->mParserOutput
;
765 * Return the list of images used as generated by the parser
768 public function getImages() {
769 return $this->mImages
;
773 * Invalidate any necessary link lists related to page property changes
776 private function invalidateProperties( $changed ) {
777 global $wgPagePropLinkInvalidations;
779 foreach ( $changed as $name => $value ) {
780 if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
781 $inv = $wgPagePropLinkInvalidations[$name];
782 if ( !is_array( $inv ) ) {
783 $inv = array( $inv );
785 foreach ( $inv as $table ) {
786 $update = new HTMLCacheUpdate( $this->mTitle
, $table );
794 * Fetch page links added by this LinksUpdate. Only available after the update is complete.
796 * @return null|array of Titles
798 public function getAddedLinks() {
799 if ( $this->linkInsertions
=== null ) {
803 foreach ( $this->linkInsertions
as $insertion ) {
804 $result[] = Title
::makeTitle( $insertion['pl_namespace'], $insertion['pl_title'] );
811 * Fetch page links removed by this LinksUpdate. Only available after the update is complete.
813 * @return null|array of Titles
815 public function getRemovedLinks() {
816 if ( $this->linkDeletions
=== null ) {
820 foreach ( $this->linkDeletions
as $ns => $titles ) {
821 foreach ( $titles as $title => $unused ) {
822 $result[] = Title
::makeTitle( $ns, $title );
831 * Update object handling the cleanup of links tables after a page was deleted.
833 class LinksDeletionUpdate
extends SqlDataUpdate
{
834 protected $mPage; //!< WikiPage the wikipage that was deleted
839 * @param $page WikiPage Page we are updating
840 * @throws MWException
842 function __construct( WikiPage
$page ) {
843 parent
::__construct( false ); // no implicit transaction
845 $this->mPage
= $page;
847 if ( !$page->exists() ) {
848 throw new MWException( "Page ID not known, perhaps the page doesn't exist?" );
853 * Do some database updates after deletion
855 public function doUpdate() {
856 $title = $this->mPage
->getTitle();
857 $id = $this->mPage
->getId();
859 # Delete restrictions for it
860 $this->mDb
->delete( 'page_restrictions', array( 'pr_page' => $id ), __METHOD__
);
862 # Fix category table counts
864 $res = $this->mDb
->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__
);
866 foreach ( $res as $row ) {
867 $cats[] = $row->cl_to
;
870 $this->mPage
->updateCategoryCounts( array(), $cats );
872 # If using cascading deletes, we can skip some explicit deletes
873 if ( !$this->mDb
->cascadingDeletes() ) {
874 # Delete outgoing links
875 $this->mDb
->delete( 'pagelinks', array( 'pl_from' => $id ), __METHOD__
);
876 $this->mDb
->delete( 'imagelinks', array( 'il_from' => $id ), __METHOD__
);
877 $this->mDb
->delete( 'categorylinks', array( 'cl_from' => $id ), __METHOD__
);
878 $this->mDb
->delete( 'templatelinks', array( 'tl_from' => $id ), __METHOD__
);
879 $this->mDb
->delete( 'externallinks', array( 'el_from' => $id ), __METHOD__
);
880 $this->mDb
->delete( 'langlinks', array( 'll_from' => $id ), __METHOD__
);
881 $this->mDb
->delete( 'iwlinks', array( 'iwl_from' => $id ), __METHOD__
);
882 $this->mDb
->delete( 'redirect', array( 'rd_from' => $id ), __METHOD__
);
883 $this->mDb
->delete( 'page_props', array( 'pp_page' => $id ), __METHOD__
);
886 # If using cleanup triggers, we can skip some manual deletes
887 if ( !$this->mDb
->cleanupTriggers() ) {
888 # Clean up recentchanges entries...
889 $this->mDb
->delete( 'recentchanges',
890 array( 'rc_type != ' . RC_LOG
,
891 'rc_namespace' => $title->getNamespace(),
892 'rc_title' => $title->getDBkey() ),
894 $this->mDb
->delete( 'recentchanges',
895 array( 'rc_type != ' . RC_LOG
, 'rc_cur_id' => $id ),
901 * Update all the appropriate counts in the category table.
902 * @param array $added associative array of category name => sort key
903 * @param array $deleted associative array of category name => sort key
905 function updateCategoryCounts( $added, $deleted ) {
906 $a = WikiPage
::factory( $this->mTitle
);
907 $a->updateCategoryCounts(
908 array_keys( $added ), array_keys( $deleted )