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 /** @var int Page ID of the article linked from */
34 /** @var Title object of the article linked from */
37 /** @var ParserOutput */
38 public $mParserOutput;
40 /** @var array Map of title strings to IDs for the links in the document */
43 /** @var array DB keys of the images used, in the array key only */
46 /** @var array Map of title strings to IDs for the template references, including broken ones */
49 /** @var array URLs of external links, array key only */
52 /** @var array Map of category names to sort keys */
55 /** @var array ap of language codes to titles */
58 /** @var array Map of arbitrary name to value */
61 /** @var DatabaseBase Database connection reference */
64 /** @var array SELECT options to be used */
67 /** @var bool Whether to queue jobs for recursive updates */
71 * @var null|array Added links if calculated.
73 private $linkInsertions = null;
76 * @var null|array Deleted links if calculated.
78 private $linkDeletions = null;
83 * @param Title $title Title of the page we're updating
84 * @param ParserOutput $parserOutput Output from a full parse of this page
85 * @param bool $recursive Queue jobs for recursive updates?
88 function __construct( $title, $parserOutput, $recursive = true ) {
89 parent
::__construct( false ); // no implicit transaction
91 if ( !( $title instanceof Title
) ) {
92 throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
93 "Please see Article::editUpdates() for an invocation example.\n" );
96 if ( !( $parserOutput instanceof ParserOutput
) ) {
97 throw new MWException( "The calling convention to LinksUpdate::__construct() has changed. " .
98 "Please see WikiPage::doEditUpdates() for an invocation example.\n" );
101 $this->mTitle
= $title;
102 $this->mId
= $title->getArticleID();
105 throw new MWException( "The Title object did not provide an article " .
106 "ID. Perhaps the page doesn't exist?" );
109 $this->mParserOutput
= $parserOutput;
111 $this->mLinks
= $parserOutput->getLinks();
112 $this->mImages
= $parserOutput->getImages();
113 $this->mTemplates
= $parserOutput->getTemplates();
114 $this->mExternals
= $parserOutput->getExternalLinks();
115 $this->mCategories
= $parserOutput->getCategories();
116 $this->mProperties
= $parserOutput->getProperties();
117 $this->mInterwikis
= $parserOutput->getInterwikiLinks();
119 # Convert the format of the interlanguage links
120 # I didn't want to change it in the ParserOutput, because that array is passed all
121 # the way back to the skin, so either a skin API break would be required, or an
122 # inefficient back-conversion.
123 $ill = $parserOutput->getLanguageLinks();
124 $this->mInterlangs
= array();
125 foreach ( $ill as $link ) {
126 list( $key, $title ) = explode( ':', $link, 2 );
127 $this->mInterlangs
[$key] = $title;
130 foreach ( $this->mCategories
as &$sortkey ) {
131 # If the sortkey is longer then 255 bytes,
132 # it truncated by DB, and then doesn't get
133 # matched when comparing existing vs current
134 # categories, causing bug 25254.
135 # Also. substr behaves weird when given "".
136 if ( $sortkey !== '' ) {
137 $sortkey = substr( $sortkey, 0, 255 );
141 $this->mRecursive
= $recursive;
143 wfRunHooks( 'LinksUpdateConstructed', array( &$this ) );
147 * Update link tables with outgoing links from an updated article
149 public function doUpdate() {
150 wfRunHooks( 'LinksUpdate', array( &$this ) );
151 $this->doIncrementalUpdate();
152 wfRunHooks( 'LinksUpdateComplete', array( &$this ) );
155 protected function doIncrementalUpdate() {
156 wfProfileIn( __METHOD__
);
159 $existing = $this->getExistingLinks();
160 $this->linkDeletions
= $this->getLinkDeletions( $existing );
161 $this->linkInsertions
= $this->getLinkInsertions( $existing );
162 $this->incrTableUpdate( 'pagelinks', 'pl', $this->linkDeletions
, $this->linkInsertions
);
165 $existing = $this->getExistingImages();
167 $imageDeletes = $this->getImageDeletions( $existing );
168 $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes,
169 $this->getImageInsertions( $existing ) );
171 # Invalidate all image description pages which had links added or removed
172 $imageUpdates = $imageDeletes +
array_diff_key( $this->mImages
, $existing );
173 $this->invalidateImageDescriptions( $imageUpdates );
176 $existing = $this->getExistingExternals();
177 $this->incrTableUpdate( 'externallinks', 'el', $this->getExternalDeletions( $existing ),
178 $this->getExternalInsertions( $existing ) );
181 $existing = $this->getExistingInterlangs();
182 $this->incrTableUpdate( 'langlinks', 'll', $this->getInterlangDeletions( $existing ),
183 $this->getInterlangInsertions( $existing ) );
185 # Inline interwiki links
186 $existing = $this->getExistingInterwikis();
187 $this->incrTableUpdate( 'iwlinks', 'iwl', $this->getInterwikiDeletions( $existing ),
188 $this->getInterwikiInsertions( $existing ) );
191 $existing = $this->getExistingTemplates();
192 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
193 $this->getTemplateInsertions( $existing ) );
196 $existing = $this->getExistingCategories();
198 $categoryDeletes = $this->getCategoryDeletions( $existing );
200 $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes,
201 $this->getCategoryInsertions( $existing ) );
203 # Invalidate all categories which were added, deleted or changed (set symmetric difference)
204 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
205 $categoryUpdates = $categoryInserts +
$categoryDeletes;
206 $this->invalidateCategories( $categoryUpdates );
207 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
210 $existing = $this->getExistingProperties();
212 $propertiesDeletes = $this->getPropertyDeletions( $existing );
214 $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
215 $this->getPropertyInsertions( $existing ) );
217 # Invalidate the necessary pages
218 $changed = $propertiesDeletes +
array_diff_assoc( $this->mProperties
, $existing );
219 $this->invalidateProperties( $changed );
221 # Update the links table freshness for this title
222 $this->updateLinksTimestamp();
224 # Refresh links of all pages including this page
225 # This will be in a separate transaction
226 if ( $this->mRecursive
) {
227 $this->queueRecursiveJobs();
230 wfProfileOut( __METHOD__
);
234 * Queue recursive jobs for this page
236 * Which means do LinksUpdate on all templates
237 * that include the current page, using the job queue.
239 function queueRecursiveJobs() {
240 self
::queueRecursiveJobsForTable( $this->mTitle
, 'templatelinks' );
244 * Queue a RefreshLinks job for any table.
246 * @param Title $title Title to do job for
247 * @param string $table Table to use (e.g. 'templatelinks')
249 public static function queueRecursiveJobsForTable( Title
$title, $table ) {
250 wfProfileIn( __METHOD__
);
251 if ( $title->getBacklinkCache()->hasLinks( $table ) ) {
252 $job = new RefreshLinksJob(
257 ) + Job
::newRootJobParams( // "overall" refresh links job info
258 "refreshlinks:{$table}:{$title->getPrefixedText()}"
261 JobQueueGroup
::singleton()->push( $job );
262 JobQueueGroup
::singleton()->deduplicateRootJob( $job );
264 wfProfileOut( __METHOD__
);
270 function invalidateCategories( $cats ) {
271 $this->invalidatePages( NS_CATEGORY
, array_keys( $cats ) );
275 * Update all the appropriate counts in the category table.
276 * @param array $added Associative array of category name => sort key
277 * @param array $deleted Associative array of category name => sort key
279 function updateCategoryCounts( $added, $deleted ) {
280 $a = WikiPage
::factory( $this->mTitle
);
281 $a->updateCategoryCounts(
282 array_keys( $added ), array_keys( $deleted )
289 function invalidateImageDescriptions( $images ) {
290 $this->invalidatePages( NS_FILE
, array_keys( $images ) );
294 * Update a table by doing a delete query then an insert query
295 * @param string $table Table name
296 * @param string $prefix Field name prefix
297 * @param array $deletions
298 * @param array $insertions Rows to insert
300 function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
301 if ( $table == 'page_props' ) {
302 $fromField = 'pp_page';
304 $fromField = "{$prefix}_from";
306 $where = array( $fromField => $this->mId
);
307 if ( $table == 'pagelinks' ||
$table == 'templatelinks' ||
$table == 'iwlinks' ) {
308 if ( $table == 'iwlinks' ) {
309 $baseKey = 'iwl_prefix';
311 $baseKey = "{$prefix}_namespace";
313 $clause = $this->mDb
->makeWhereFrom2d( $deletions, $baseKey, "{$prefix}_title" );
320 if ( $table == 'langlinks' ) {
321 $toField = 'll_lang';
322 } elseif ( $table == 'page_props' ) {
323 $toField = 'pp_propname';
325 $toField = $prefix . '_to';
327 if ( count( $deletions ) ) {
328 $where[] = "$toField IN (" . $this->mDb
->makeList( array_keys( $deletions ) ) . ')';
334 $this->mDb
->delete( $table, $where, __METHOD__
);
336 if ( count( $insertions ) ) {
337 $this->mDb
->insert( $table, $insertions, __METHOD__
, 'IGNORE' );
338 wfRunHooks( 'LinksUpdateAfterInsert', array( $this, $table, $insertions ) );
343 * Get an array of pagelinks insertions for passing to the DB
344 * Skips the titles specified by the 2-D array $existing
345 * @param array $existing
348 private function getLinkInsertions( $existing = array() ) {
350 foreach ( $this->mLinks
as $ns => $dbkeys ) {
351 $diffs = isset( $existing[$ns] )
352 ?
array_diff_key( $dbkeys, $existing[$ns] )
354 foreach ( $diffs as $dbk => $id ) {
356 'pl_from' => $this->mId
,
357 'pl_namespace' => $ns,
367 * Get an array of template insertions. Like getLinkInsertions()
368 * @param array $existing
371 private function getTemplateInsertions( $existing = array() ) {
373 foreach ( $this->mTemplates
as $ns => $dbkeys ) {
374 $diffs = isset( $existing[$ns] ) ?
array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
375 foreach ( $diffs as $dbk => $id ) {
377 'tl_from' => $this->mId
,
378 'tl_namespace' => $ns,
388 * Get an array of image insertions
389 * Skips the names specified in $existing
390 * @param array $existing
393 private function getImageInsertions( $existing = array() ) {
395 $diffs = array_diff_key( $this->mImages
, $existing );
396 foreach ( $diffs as $iname => $dummy ) {
398 'il_from' => $this->mId
,
407 * Get an array of externallinks insertions. Skips the names specified in $existing
408 * @param array $existing
411 private function getExternalInsertions( $existing = array() ) {
413 $diffs = array_diff_key( $this->mExternals
, $existing );
414 foreach ( $diffs as $url => $dummy ) {
415 foreach ( wfMakeUrlIndexes( $url ) as $index ) {
417 'el_from' => $this->mId
,
419 'el_index' => $index,
428 * Get an array of category insertions
430 * @param array $existing mapping existing category names to sort keys. If both
431 * match a link in $this, the link will be omitted from the output
435 private function getCategoryInsertions( $existing = array() ) {
436 global $wgContLang, $wgCategoryCollation;
437 $diffs = array_diff_assoc( $this->mCategories
, $existing );
439 foreach ( $diffs as $name => $prefix ) {
440 $nt = Title
::makeTitleSafe( NS_CATEGORY
, $name );
441 $wgContLang->findVariantLink( $name, $nt, true );
443 if ( $this->mTitle
->getNamespace() == NS_CATEGORY
) {
445 } elseif ( $this->mTitle
->getNamespace() == NS_FILE
) {
451 # Treat custom sortkeys as a prefix, so that if multiple
452 # things are forced to sort as '*' or something, they'll
453 # sort properly in the category rather than in page_id
455 $sortkey = Collation
::singleton()->getSortKey(
456 $this->mTitle
->getCategorySortkey( $prefix ) );
459 'cl_from' => $this->mId
,
461 'cl_sortkey' => $sortkey,
462 'cl_timestamp' => $this->mDb
->timestamp(),
463 'cl_sortkey_prefix' => $prefix,
464 'cl_collation' => $wgCategoryCollation,
473 * Get an array of interlanguage link insertions
475 * @param array $existing mapping existing language codes to titles
479 private function getInterlangInsertions( $existing = array() ) {
480 $diffs = array_diff_assoc( $this->mInterlangs
, $existing );
482 foreach ( $diffs as $lang => $title ) {
484 'll_from' => $this->mId
,
494 * Get an array of page property insertions
495 * @param array $existing
498 function getPropertyInsertions( $existing = array() ) {
499 $diffs = array_diff_assoc( $this->mProperties
, $existing );
501 foreach ( $diffs as $name => $value ) {
503 'pp_page' => $this->mId
,
504 'pp_propname' => $name,
505 'pp_value' => $value,
513 * Get an array of interwiki insertions for passing to the DB
514 * Skips the titles specified by the 2-D array $existing
515 * @param array $existing
518 private function getInterwikiInsertions( $existing = array() ) {
520 foreach ( $this->mInterwikis
as $prefix => $dbkeys ) {
521 $diffs = isset( $existing[$prefix] )
522 ?
array_diff_key( $dbkeys, $existing[$prefix] )
525 foreach ( $diffs as $dbk => $id ) {
527 'iwl_from' => $this->mId
,
528 'iwl_prefix' => $prefix,
538 * Given an array of existing links, returns those links which are not in $this
539 * and thus should be deleted.
540 * @param array $existing
543 private function getLinkDeletions( $existing ) {
545 foreach ( $existing as $ns => $dbkeys ) {
546 if ( isset( $this->mLinks
[$ns] ) ) {
547 $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks
[$ns] );
549 $del[$ns] = $existing[$ns];
557 * Given an array of existing templates, returns those templates which are not in $this
558 * and thus should be deleted.
559 * @param array $existing
562 private function getTemplateDeletions( $existing ) {
564 foreach ( $existing as $ns => $dbkeys ) {
565 if ( isset( $this->mTemplates
[$ns] ) ) {
566 $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates
[$ns] );
568 $del[$ns] = $existing[$ns];
576 * Given an array of existing images, returns those images which are not in $this
577 * and thus should be deleted.
578 * @param array $existing
581 private function getImageDeletions( $existing ) {
582 return array_diff_key( $existing, $this->mImages
);
586 * Given an array of existing external links, returns those links which are not
587 * in $this and thus should be deleted.
588 * @param array $existing
591 private function getExternalDeletions( $existing ) {
592 return array_diff_key( $existing, $this->mExternals
);
596 * Given an array of existing categories, returns those categories which are not in $this
597 * and thus should be deleted.
598 * @param array $existing
601 private function getCategoryDeletions( $existing ) {
602 return array_diff_assoc( $existing, $this->mCategories
);
606 * Given an array of existing interlanguage links, returns those links which are not
607 * in $this and thus should be deleted.
608 * @param array $existing
611 private function getInterlangDeletions( $existing ) {
612 return array_diff_assoc( $existing, $this->mInterlangs
);
616 * Get array of properties which should be deleted.
617 * @param array $existing
620 function getPropertyDeletions( $existing ) {
621 return array_diff_assoc( $existing, $this->mProperties
);
625 * Given an array of existing interwiki links, returns those links which are not in $this
626 * and thus should be deleted.
627 * @param array $existing
630 private function getInterwikiDeletions( $existing ) {
632 foreach ( $existing as $prefix => $dbkeys ) {
633 if ( isset( $this->mInterwikis
[$prefix] ) ) {
634 $del[$prefix] = array_diff_key( $existing[$prefix], $this->mInterwikis
[$prefix] );
636 $del[$prefix] = $existing[$prefix];
644 * Get an array of existing links, as a 2-D array
648 private function getExistingLinks() {
649 $res = $this->mDb
->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
650 array( 'pl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
652 foreach ( $res as $row ) {
653 if ( !isset( $arr[$row->pl_namespace
] ) ) {
654 $arr[$row->pl_namespace
] = array();
656 $arr[$row->pl_namespace
][$row->pl_title
] = 1;
663 * Get an array of existing templates, as a 2-D array
667 private function getExistingTemplates() {
668 $res = $this->mDb
->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
669 array( 'tl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
671 foreach ( $res as $row ) {
672 if ( !isset( $arr[$row->tl_namespace
] ) ) {
673 $arr[$row->tl_namespace
] = array();
675 $arr[$row->tl_namespace
][$row->tl_title
] = 1;
682 * Get an array of existing images, image names in the keys
686 private function getExistingImages() {
687 $res = $this->mDb
->select( 'imagelinks', array( 'il_to' ),
688 array( 'il_from' => $this->mId
), __METHOD__
, $this->mOptions
);
690 foreach ( $res as $row ) {
691 $arr[$row->il_to
] = 1;
698 * Get an array of existing external links, URLs in the keys
702 private function getExistingExternals() {
703 $res = $this->mDb
->select( 'externallinks', array( 'el_to' ),
704 array( 'el_from' => $this->mId
), __METHOD__
, $this->mOptions
);
706 foreach ( $res as $row ) {
707 $arr[$row->el_to
] = 1;
714 * Get an array of existing categories, with the name in the key and sort key in the value.
718 private function getExistingCategories() {
719 $res = $this->mDb
->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
720 array( 'cl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
722 foreach ( $res as $row ) {
723 $arr[$row->cl_to
] = $row->cl_sortkey_prefix
;
730 * Get an array of existing interlanguage links, with the language code in the key and the
731 * title in the value.
735 private function getExistingInterlangs() {
736 $res = $this->mDb
->select( 'langlinks', array( 'll_lang', 'll_title' ),
737 array( 'll_from' => $this->mId
), __METHOD__
, $this->mOptions
);
739 foreach ( $res as $row ) {
740 $arr[$row->ll_lang
] = $row->ll_title
;
747 * Get an array of existing inline interwiki links, as a 2-D array
748 * @return array (prefix => array(dbkey => 1))
750 protected function getExistingInterwikis() {
751 $res = $this->mDb
->select( 'iwlinks', array( 'iwl_prefix', 'iwl_title' ),
752 array( 'iwl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
754 foreach ( $res as $row ) {
755 if ( !isset( $arr[$row->iwl_prefix
] ) ) {
756 $arr[$row->iwl_prefix
] = array();
758 $arr[$row->iwl_prefix
][$row->iwl_title
] = 1;
765 * Get an array of existing categories, with the name in the key and sort key in the value.
767 * @return array of property names and values
769 private function getExistingProperties() {
770 $res = $this->mDb
->select( 'page_props', array( 'pp_propname', 'pp_value' ),
771 array( 'pp_page' => $this->mId
), __METHOD__
, $this->mOptions
);
773 foreach ( $res as $row ) {
774 $arr[$row->pp_propname
] = $row->pp_value
;
781 * Return the title object of the page being updated
784 public function getTitle() {
785 return $this->mTitle
;
789 * Returns parser output
791 * @return ParserOutput
793 public function getParserOutput() {
794 return $this->mParserOutput
;
798 * Return the list of images used as generated by the parser
801 public function getImages() {
802 return $this->mImages
;
806 * Invalidate any necessary link lists related to page property changes
807 * @param array $changed
809 private function invalidateProperties( $changed ) {
810 global $wgPagePropLinkInvalidations;
812 foreach ( $changed as $name => $value ) {
813 if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
814 $inv = $wgPagePropLinkInvalidations[$name];
815 if ( !is_array( $inv ) ) {
816 $inv = array( $inv );
818 foreach ( $inv as $table ) {
819 $update = new HTMLCacheUpdate( $this->mTitle
, $table );
827 * Fetch page links added by this LinksUpdate. Only available after the update is complete.
829 * @return null|array of Titles
831 public function getAddedLinks() {
832 if ( $this->linkInsertions
=== null ) {
836 foreach ( $this->linkInsertions
as $insertion ) {
837 $result[] = Title
::makeTitle( $insertion['pl_namespace'], $insertion['pl_title'] );
844 * Fetch page links removed by this LinksUpdate. Only available after the update is complete.
846 * @return null|array of Titles
848 public function getRemovedLinks() {
849 if ( $this->linkDeletions
=== null ) {
853 foreach ( $this->linkDeletions
as $ns => $titles ) {
854 foreach ( $titles as $title => $unused ) {
855 $result[] = Title
::makeTitle( $ns, $title );
863 * Update links table freshness
865 protected function updateLinksTimestamp() {
867 $this->mDb
->update( 'page',
868 array( 'page_links_updated' => $this->mDb
->timestamp() ),
869 array( 'page_id' => $this->mId
),
877 * Update object handling the cleanup of links tables after a page was deleted.
879 class LinksDeletionUpdate
extends SqlDataUpdate
{
880 /** @var WikiPage The WikiPage that was deleted */
886 * @param WikiPage $page Page we are updating
887 * @throws MWException
889 function __construct( WikiPage
$page ) {
890 parent
::__construct( false ); // no implicit transaction
892 $this->mPage
= $page;
894 if ( !$page->exists() ) {
895 throw new MWException( "Page ID not known, perhaps the page doesn't exist?" );
900 * Do some database updates after deletion
902 public function doUpdate() {
903 $title = $this->mPage
->getTitle();
904 $id = $this->mPage
->getId();
906 # Delete restrictions for it
907 $this->mDb
->delete( 'page_restrictions', array( 'pr_page' => $id ), __METHOD__
);
909 # Fix category table counts
911 $res = $this->mDb
->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__
);
913 foreach ( $res as $row ) {
914 $cats[] = $row->cl_to
;
917 $this->mPage
->updateCategoryCounts( array(), $cats );
919 # If using cascading deletes, we can skip some explicit deletes
920 if ( !$this->mDb
->cascadingDeletes() ) {
921 # Delete outgoing links
922 $this->mDb
->delete( 'pagelinks', array( 'pl_from' => $id ), __METHOD__
);
923 $this->mDb
->delete( 'imagelinks', array( 'il_from' => $id ), __METHOD__
);
924 $this->mDb
->delete( 'categorylinks', array( 'cl_from' => $id ), __METHOD__
);
925 $this->mDb
->delete( 'templatelinks', array( 'tl_from' => $id ), __METHOD__
);
926 $this->mDb
->delete( 'externallinks', array( 'el_from' => $id ), __METHOD__
);
927 $this->mDb
->delete( 'langlinks', array( 'll_from' => $id ), __METHOD__
);
928 $this->mDb
->delete( 'iwlinks', array( 'iwl_from' => $id ), __METHOD__
);
929 $this->mDb
->delete( 'redirect', array( 'rd_from' => $id ), __METHOD__
);
930 $this->mDb
->delete( 'page_props', array( 'pp_page' => $id ), __METHOD__
);
933 # If using cleanup triggers, we can skip some manual deletes
934 if ( !$this->mDb
->cleanupTriggers() ) {
935 # Clean up recentchanges entries...
936 $this->mDb
->delete( 'recentchanges',
937 array( 'rc_type != ' . RC_LOG
,
938 'rc_namespace' => $title->getNamespace(),
939 'rc_title' => $title->getDBkey() ),
941 $this->mDb
->delete( 'recentchanges',
942 array( 'rc_type != ' . RC_LOG
, 'rc_cur_id' => $id ),
948 * Update all the appropriate counts in the category table.
949 * @param array $added Associative array of category name => sort key
950 * @param array $deleted Associative array of category name => sort key
952 function updateCategoryCounts( $added, $deleted ) {
953 $a = WikiPage
::factory( $this->mTitle
);
954 $a->updateCategoryCounts(
955 array_keys( $added ), array_keys( $deleted )