56595cacc5f91096336ef9b7cae1d16b3ec411d6
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
{
30 // @todo: make members protected, but make sure extensions don't break
32 public $mId, //!< Page ID of the article linked from
33 $mTitle, //!< Title object of the article linked from
34 $mParserOutput, //!< Parser output
35 $mLinks, //!< Map of title strings to IDs for the links in the document
36 $mImages, //!< DB keys of the images used, in the array key only
37 $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones
38 $mExternals, //!< URLs of external links, array key only
39 $mCategories, //!< Map of category names to sort keys
40 $mInterlangs, //!< Map of language codes to titles
41 $mProperties, //!< Map of arbitrary name to value
42 $mRecursive; //!< Whether to queue jobs for recursive updates
47 * @param $title Title of the page we're updating
48 * @param $parserOutput ParserOutput: output from a full parse of this page
49 * @param $recursive Boolean: queue jobs for recursive updates?
51 function __construct( $title, $parserOutput, $recursive = true ) {
52 parent
::__construct( );
54 if ( !( $title instanceof Title
) ) {
55 throw new MWException( "The calling convention to LinksUpdate::LinksUpdate() has changed. " .
56 "Please see Article::editUpdates() for an invocation example.\n" );
59 if ( !( $parserOutput instanceof ParserOutput
) ) {
60 throw new MWException( "The calling convention to LinksUpdate::__construct() has changed. " .
61 "Please see WikiPage::doEditUpdates() for an invocation example.\n" );
64 $this->mTitle
= $title;
65 $this->mId
= $title->getArticleID();
67 $this->mParserOutput
= $parserOutput;
69 $this->mLinks
= $parserOutput->getLinks();
70 $this->mImages
= $parserOutput->getImages();
71 $this->mTemplates
= $parserOutput->getTemplates();
72 $this->mExternals
= $parserOutput->getExternalLinks();
73 $this->mCategories
= $parserOutput->getCategories();
74 $this->mProperties
= $parserOutput->getProperties();
75 $this->mInterwikis
= $parserOutput->getInterwikiLinks();
77 # Convert the format of the interlanguage links
78 # I didn't want to change it in the ParserOutput, because that array is passed all
79 # the way back to the skin, so either a skin API break would be required, or an
80 # inefficient back-conversion.
81 $ill = $parserOutput->getLanguageLinks();
82 $this->mInterlangs
= array();
83 foreach ( $ill as $link ) {
84 list( $key, $title ) = explode( ':', $link, 2 );
85 $this->mInterlangs
[$key] = $title;
88 foreach ( $this->mCategories
as &$sortkey ) {
89 # If the sortkey is longer then 255 bytes,
90 # it truncated by DB, and then doesn't get
91 # matched when comparing existing vs current
92 # categories, causing bug 25254.
93 # Also. substr behaves weird when given "".
94 if ( $sortkey !== '' ) {
95 $sortkey = substr( $sortkey, 0, 255 );
99 $this->mRecursive
= $recursive;
101 wfRunHooks( 'LinksUpdateConstructed', array( &$this ) );
105 * Update link tables with outgoing links from an updated article
107 public function doUpdate() {
108 global $wgUseDumbLinkUpdate;
110 wfRunHooks( 'LinksUpdate', array( &$this ) );
111 if ( $wgUseDumbLinkUpdate ) {
112 $this->doDumbUpdate();
114 $this->doIncrementalUpdate();
116 wfRunHooks( 'LinksUpdateComplete', array( &$this ) );
119 protected function doIncrementalUpdate() {
120 wfProfileIn( __METHOD__
);
123 $existing = $this->getExistingLinks();
124 $this->incrTableUpdate( 'pagelinks', 'pl', $this->getLinkDeletions( $existing ),
125 $this->getLinkInsertions( $existing ) );
128 $existing = $this->getExistingImages();
130 $imageDeletes = $this->getImageDeletions( $existing );
131 $this->incrTableUpdate( 'imagelinks', 'il', $imageDeletes,
132 $this->getImageInsertions( $existing ) );
134 # Invalidate all image description pages which had links added or removed
135 $imageUpdates = $imageDeletes +
array_diff_key( $this->mImages
, $existing );
136 $this->invalidateImageDescriptions( $imageUpdates );
139 $existing = $this->getExistingExternals();
140 $this->incrTableUpdate( 'externallinks', 'el', $this->getExternalDeletions( $existing ),
141 $this->getExternalInsertions( $existing ) );
144 $existing = $this->getExistingInterlangs();
145 $this->incrTableUpdate( 'langlinks', 'll', $this->getInterlangDeletions( $existing ),
146 $this->getInterlangInsertions( $existing ) );
148 # Inline interwiki links
149 $existing = $this->getExistingInterwikis();
150 $this->incrTableUpdate( 'iwlinks', 'iwl', $this->getInterwikiDeletions( $existing ),
151 $this->getInterwikiInsertions( $existing ) );
154 $existing = $this->getExistingTemplates();
155 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
156 $this->getTemplateInsertions( $existing ) );
159 $existing = $this->getExistingCategories();
161 $categoryDeletes = $this->getCategoryDeletions( $existing );
163 $this->incrTableUpdate( 'categorylinks', 'cl', $categoryDeletes,
164 $this->getCategoryInsertions( $existing ) );
166 # Invalidate all categories which were added, deleted or changed (set symmetric difference)
167 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
168 $categoryUpdates = $categoryInserts +
$categoryDeletes;
169 $this->invalidateCategories( $categoryUpdates );
170 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
173 $existing = $this->getExistingProperties();
175 $propertiesDeletes = $this->getPropertyDeletions( $existing );
177 $this->incrTableUpdate( 'page_props', 'pp', $propertiesDeletes,
178 $this->getPropertyInsertions( $existing ) );
180 # Invalidate the necessary pages
181 $changed = $propertiesDeletes +
array_diff_assoc( $this->mProperties
, $existing );
182 $this->invalidateProperties( $changed );
184 # Refresh links of all pages including this page
185 # This will be in a separate transaction
186 if ( $this->mRecursive
) {
187 $this->queueRecursiveJobs();
190 wfProfileOut( __METHOD__
);
194 * Link update which clears the previous entries and inserts new ones
195 * May be slower or faster depending on level of lock contention and write speed of DB
196 * Also useful where link table corruption needs to be repaired, e.g. in refreshLinks.php
198 protected function doDumbUpdate() {
199 wfProfileIn( __METHOD__
);
201 # Refresh category pages and image description pages
202 $existing = $this->getExistingCategories();
203 $categoryInserts = array_diff_assoc( $this->mCategories
, $existing );
204 $categoryDeletes = array_diff_assoc( $existing, $this->mCategories
);
205 $categoryUpdates = $categoryInserts +
$categoryDeletes;
206 $existing = $this->getExistingImages();
207 $imageUpdates = array_diff_key( $existing, $this->mImages
) +
array_diff_key( $this->mImages
, $existing );
209 $this->dumbTableUpdate( 'pagelinks', $this->getLinkInsertions(), 'pl_from' );
210 $this->dumbTableUpdate( 'imagelinks', $this->getImageInsertions(), 'il_from' );
211 $this->dumbTableUpdate( 'categorylinks', $this->getCategoryInsertions(), 'cl_from' );
212 $this->dumbTableUpdate( 'templatelinks', $this->getTemplateInsertions(), 'tl_from' );
213 $this->dumbTableUpdate( 'externallinks', $this->getExternalInsertions(), 'el_from' );
214 $this->dumbTableUpdate( 'langlinks', $this->getInterlangInsertions(),'ll_from' );
215 $this->dumbTableUpdate( 'iwlinks', $this->getInterwikiInsertions(),'iwl_from' );
216 $this->dumbTableUpdate( 'page_props', $this->getPropertyInsertions(), 'pp_page' );
218 # Update the cache of all the category pages and image description
219 # pages which were changed, and fix the category table count
220 $this->invalidateCategories( $categoryUpdates );
221 $this->updateCategoryCounts( $categoryInserts, $categoryDeletes );
222 $this->invalidateImageDescriptions( $imageUpdates );
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__
);
233 function queueRecursiveJobs() {
234 global $wgUpdateRowsPerJob;
235 wfProfileIn( __METHOD__
);
237 $cache = $this->mTitle
->getBacklinkCache();
238 $batches = $cache->partition( 'templatelinks', $wgUpdateRowsPerJob );
240 wfProfileOut( __METHOD__
);
244 foreach ( $batches as $batch ) {
245 list( $start, $end ) = $batch;
247 'table' => 'templatelinks',
251 $jobs[] = new RefreshLinksJob2( $this->mTitle
, $params );
253 Job
::batchInsert( $jobs );
255 wfProfileOut( __METHOD__
);
261 function invalidateCategories( $cats ) {
262 $this->invalidatePages( NS_CATEGORY
, array_keys( $cats ) );
266 * Update all the appropriate counts in the category table.
267 * @param $added array associative array of category name => sort key
268 * @param $deleted array associative array of category name => sort key
270 function updateCategoryCounts( $added, $deleted ) {
271 $a = WikiPage
::factory( $this->mTitle
);
272 $a->updateCategoryCounts(
273 array_keys( $added ), array_keys( $deleted )
280 function invalidateImageDescriptions( $images ) {
281 $this->invalidatePages( NS_FILE
, array_keys( $images ) );
289 private function dumbTableUpdate( $table, $insertions, $fromField ) {
290 $this->mDb
->delete( $table, array( $fromField => $this->mId
), __METHOD__
);
291 if ( count( $insertions ) ) {
292 # The link array was constructed without FOR UPDATE, so there may
293 # be collisions. This may cause minor link table inconsistencies,
294 # which is better than crippling the site with lock contention.
295 $this->mDb
->insert( $table, $insertions, __METHOD__
, array( 'IGNORE' ) );
300 * Update a table by doing a delete query then an insert query
306 function incrTableUpdate( $table, $prefix, $deletions, $insertions ) {
307 if ( $table == 'page_props' ) {
308 $fromField = 'pp_page';
310 $fromField = "{$prefix}_from";
312 $where = array( $fromField => $this->mId
);
313 if ( $table == 'pagelinks' ||
$table == 'templatelinks' ||
$table == 'iwlinks' ) {
314 if ( $table == 'iwlinks' ) {
315 $baseKey = 'iwl_prefix';
317 $baseKey = "{$prefix}_namespace";
319 $clause = $this->mDb
->makeWhereFrom2d( $deletions, $baseKey, "{$prefix}_title" );
326 if ( $table == 'langlinks' ) {
327 $toField = 'll_lang';
328 } elseif ( $table == 'page_props' ) {
329 $toField = 'pp_propname';
331 $toField = $prefix . '_to';
333 if ( count( $deletions ) ) {
334 $where[] = "$toField IN (" . $this->mDb
->makeList( array_keys( $deletions ) ) . ')';
340 $this->mDb
->delete( $table, $where, __METHOD__
);
342 if ( count( $insertions ) ) {
343 $this->mDb
->insert( $table, $insertions, __METHOD__
, 'IGNORE' );
348 * Get an array of pagelinks insertions for passing to the DB
349 * Skips the titles specified by the 2-D array $existing
350 * @param $existing array
353 private function getLinkInsertions( $existing = array() ) {
355 foreach( $this->mLinks
as $ns => $dbkeys ) {
356 $diffs = isset( $existing[$ns] )
357 ?
array_diff_key( $dbkeys, $existing[$ns] )
359 foreach ( $diffs as $dbk => $id ) {
361 'pl_from' => $this->mId
,
362 'pl_namespace' => $ns,
371 * Get an array of template insertions. Like getLinkInsertions()
372 * @param $existing array
375 private function getTemplateInsertions( $existing = array() ) {
377 foreach( $this->mTemplates
as $ns => $dbkeys ) {
378 $diffs = isset( $existing[$ns] ) ?
array_diff_key( $dbkeys, $existing[$ns] ) : $dbkeys;
379 foreach ( $diffs as $dbk => $id ) {
381 'tl_from' => $this->mId
,
382 'tl_namespace' => $ns,
391 * Get an array of image insertions
392 * Skips the names specified in $existing
393 * @param $existing array
396 private function getImageInsertions( $existing = array() ) {
398 $diffs = array_diff_key( $this->mImages
, $existing );
399 foreach( $diffs as $iname => $dummy ) {
401 'il_from' => $this->mId
,
409 * Get an array of externallinks insertions. Skips the names specified in $existing
410 * @param $existing array
413 private function getExternalInsertions( $existing = array() ) {
415 $diffs = array_diff_key( $this->mExternals
, $existing );
416 foreach( $diffs as $url => $dummy ) {
417 foreach( wfMakeUrlIndexes( $url ) as $index ) {
419 'el_from' => $this->mId
,
421 'el_index' => $index,
429 * Get an array of category insertions
431 * @param $existing array mapping existing category names to sort keys. If both
432 * match a link in $this, the link will be omitted from the output
436 private function getCategoryInsertions( $existing = array() ) {
437 global $wgContLang, $wgCategoryCollation;
438 $diffs = array_diff_assoc( $this->mCategories
, $existing );
440 foreach ( $diffs as $name => $prefix ) {
441 $nt = Title
::makeTitleSafe( NS_CATEGORY
, $name );
442 $wgContLang->findVariantLink( $name, $nt, true );
444 if ( $this->mTitle
->getNamespace() == NS_CATEGORY
) {
446 } elseif ( $this->mTitle
->getNamespace() == NS_FILE
) {
452 # Treat custom sortkeys as a prefix, so that if multiple
453 # things are forced to sort as '*' or something, they'll
454 # sort properly in the category rather than in page_id
456 $sortkey = Collation
::singleton()->getSortKey(
457 $this->mTitle
->getCategorySortkey( $prefix ) );
460 'cl_from' => $this->mId
,
462 'cl_sortkey' => $sortkey,
463 'cl_timestamp' => $this->mDb
->timestamp(),
464 'cl_sortkey_prefix' => $prefix,
465 'cl_collation' => $wgCategoryCollation,
473 * Get an array of interlanguage link insertions
475 * @param $existing Array 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
,
493 * Get an array of page property insertions
494 * @param $existing array
497 function getPropertyInsertions( $existing = array() ) {
498 $diffs = array_diff_assoc( $this->mProperties
, $existing );
500 foreach ( $diffs as $name => $value ) {
502 'pp_page' => $this->mId
,
503 'pp_propname' => $name,
504 'pp_value' => $value,
511 * Get an array of interwiki insertions for passing to the DB
512 * Skips the titles specified by the 2-D array $existing
513 * @param $existing array
516 private function getInterwikiInsertions( $existing = array() ) {
518 foreach( $this->mInterwikis
as $prefix => $dbkeys ) {
519 $diffs = isset( $existing[$prefix] ) ?
array_diff_key( $dbkeys, $existing[$prefix] ) : $dbkeys;
520 foreach ( $diffs as $dbk => $id ) {
522 'iwl_from' => $this->mId
,
523 'iwl_prefix' => $prefix,
532 * Given an array of existing links, returns those links which are not in $this
533 * and thus should be deleted.
534 * @param $existing array
537 private function getLinkDeletions( $existing ) {
539 foreach ( $existing as $ns => $dbkeys ) {
540 if ( isset( $this->mLinks
[$ns] ) ) {
541 $del[$ns] = array_diff_key( $existing[$ns], $this->mLinks
[$ns] );
543 $del[$ns] = $existing[$ns];
550 * Given an array of existing templates, returns those templates which are not in $this
551 * and thus should be deleted.
552 * @param $existing array
555 private function getTemplateDeletions( $existing ) {
557 foreach ( $existing as $ns => $dbkeys ) {
558 if ( isset( $this->mTemplates
[$ns] ) ) {
559 $del[$ns] = array_diff_key( $existing[$ns], $this->mTemplates
[$ns] );
561 $del[$ns] = $existing[$ns];
568 * Given an array of existing images, returns those images which are not in $this
569 * and thus should be deleted.
570 * @param $existing array
573 private function getImageDeletions( $existing ) {
574 return array_diff_key( $existing, $this->mImages
);
578 * Given an array of existing external links, returns those links which are not
579 * in $this and thus should be deleted.
580 * @param $existing array
583 private function getExternalDeletions( $existing ) {
584 return array_diff_key( $existing, $this->mExternals
);
588 * Given an array of existing categories, returns those categories which are not in $this
589 * and thus should be deleted.
590 * @param $existing array
593 private function getCategoryDeletions( $existing ) {
594 return array_diff_assoc( $existing, $this->mCategories
);
598 * Given an array of existing interlanguage links, returns those links which are not
599 * in $this and thus should be deleted.
600 * @param $existing array
603 private function getInterlangDeletions( $existing ) {
604 return array_diff_assoc( $existing, $this->mInterlangs
);
608 * Get array of properties which should be deleted.
609 * @param $existing array
612 function getPropertyDeletions( $existing ) {
613 return array_diff_assoc( $existing, $this->mProperties
);
617 * Given an array of existing interwiki links, returns those links which are not in $this
618 * and thus should be deleted.
619 * @param $existing array
622 private function getInterwikiDeletions( $existing ) {
624 foreach ( $existing as $prefix => $dbkeys ) {
625 if ( isset( $this->mInterwikis
[$prefix] ) ) {
626 $del[$prefix] = array_diff_key( $existing[$prefix], $this->mInterwikis
[$prefix] );
628 $del[$prefix] = $existing[$prefix];
635 * Get an array of existing links, as a 2-D array
639 private function getExistingLinks() {
640 $res = $this->mDb
->select( 'pagelinks', array( 'pl_namespace', 'pl_title' ),
641 array( 'pl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
643 foreach ( $res as $row ) {
644 if ( !isset( $arr[$row->pl_namespace
] ) ) {
645 $arr[$row->pl_namespace
] = array();
647 $arr[$row->pl_namespace
][$row->pl_title
] = 1;
653 * Get an array of existing templates, as a 2-D array
657 private function getExistingTemplates() {
658 $res = $this->mDb
->select( 'templatelinks', array( 'tl_namespace', 'tl_title' ),
659 array( 'tl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
661 foreach ( $res as $row ) {
662 if ( !isset( $arr[$row->tl_namespace
] ) ) {
663 $arr[$row->tl_namespace
] = array();
665 $arr[$row->tl_namespace
][$row->tl_title
] = 1;
671 * Get an array of existing images, image names in the keys
675 private function getExistingImages() {
676 $res = $this->mDb
->select( 'imagelinks', array( 'il_to' ),
677 array( 'il_from' => $this->mId
), __METHOD__
, $this->mOptions
);
679 foreach ( $res as $row ) {
680 $arr[$row->il_to
] = 1;
686 * Get an array of existing external links, URLs in the keys
690 private function getExistingExternals() {
691 $res = $this->mDb
->select( 'externallinks', array( 'el_to' ),
692 array( 'el_from' => $this->mId
), __METHOD__
, $this->mOptions
);
694 foreach ( $res as $row ) {
695 $arr[$row->el_to
] = 1;
701 * Get an array of existing categories, with the name in the key and sort key in the value.
705 private function getExistingCategories() {
706 $res = $this->mDb
->select( 'categorylinks', array( 'cl_to', 'cl_sortkey_prefix' ),
707 array( 'cl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
709 foreach ( $res as $row ) {
710 $arr[$row->cl_to
] = $row->cl_sortkey_prefix
;
716 * Get an array of existing interlanguage links, with the language code in the key and the
717 * title in the value.
721 private function getExistingInterlangs() {
722 $res = $this->mDb
->select( 'langlinks', array( 'll_lang', 'll_title' ),
723 array( 'll_from' => $this->mId
), __METHOD__
, $this->mOptions
);
725 foreach ( $res as $row ) {
726 $arr[$row->ll_lang
] = $row->ll_title
;
732 * Get an array of existing inline interwiki links, as a 2-D array
733 * @return array (prefix => array(dbkey => 1))
735 protected function getExistingInterwikis() {
736 $res = $this->mDb
->select( 'iwlinks', array( 'iwl_prefix', 'iwl_title' ),
737 array( 'iwl_from' => $this->mId
), __METHOD__
, $this->mOptions
);
739 foreach ( $res as $row ) {
740 if ( !isset( $arr[$row->iwl_prefix
] ) ) {
741 $arr[$row->iwl_prefix
] = array();
743 $arr[$row->iwl_prefix
][$row->iwl_title
] = 1;
749 * Get an array of existing categories, with the name in the key and sort key in the value.
753 private function getExistingProperties() {
754 $res = $this->mDb
->select( 'page_props', array( 'pp_propname', 'pp_value' ),
755 array( 'pp_page' => $this->mId
), __METHOD__
, $this->mOptions
);
757 foreach ( $res as $row ) {
758 $arr[$row->pp_propname
] = $row->pp_value
;
764 * Return the title object of the page being updated
767 public function getTitle() {
768 return $this->mTitle
;
772 * Returns parser output
774 * @return ParserOutput
776 public function getParserOutput() {
777 return $this->mParserOutput
;
781 * Return the list of images used as generated by the parser
784 public function getImages() {
785 return $this->mImages
;
789 * Invalidate any necessary link lists related to page property changes
792 private function invalidateProperties( $changed ) {
793 global $wgPagePropLinkInvalidations;
795 foreach ( $changed as $name => $value ) {
796 if ( isset( $wgPagePropLinkInvalidations[$name] ) ) {
797 $inv = $wgPagePropLinkInvalidations[$name];
798 if ( !is_array( $inv ) ) {
799 $inv = array( $inv );
801 foreach ( $inv as $table ) {
802 $update = new HTMLCacheUpdate( $this->mTitle
, $table );
811 * Update object handling the cleanup of links tables after a page was deleted.
813 class LinksDeletionUpdate
extends SqlDataUpdate
{
815 protected $mPage; //!< WikiPage the wikipage that was deleted
820 * @param $title Title of the page we're updating
821 * @param $parserOutput ParserOutput: output from a full parse of this page
822 * @param $recursive Boolean: queue jobs for recursive updates?
824 function __construct( WikiPage
$page ) {
825 parent
::__construct( );
827 $this->mPage
= $page;
831 * Do some database updates after deletion
833 public function doUpdate() {
834 $title = $this->mPage
->getTitle();
835 $id = $this->mPage
->getId();
837 # Delete restrictions for it
838 $this->mDb
->delete( 'page_restrictions', array ( 'pr_page' => $id ), __METHOD__
);
840 # Fix category table counts
842 $res = $this->mDb
->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__
);
844 foreach ( $res as $row ) {
845 $cats [] = $row->cl_to
;
848 $this->mPage
->updateCategoryCounts( array(), $cats );
850 # If using cascading deletes, we can skip some explicit deletes
851 if ( !$this->mDb
->cascadingDeletes() ) {
852 $this->mDb
->delete( 'revision', array( 'rev_page' => $id ), __METHOD__
);
854 # Delete outgoing links
855 $this->mDb
->delete( 'pagelinks', array( 'pl_from' => $id ), __METHOD__
);
856 $this->mDb
->delete( 'imagelinks', array( 'il_from' => $id ), __METHOD__
);
857 $this->mDb
->delete( 'categorylinks', array( 'cl_from' => $id ), __METHOD__
);
858 $this->mDb
->delete( 'templatelinks', array( 'tl_from' => $id ), __METHOD__
);
859 $this->mDb
->delete( 'externallinks', array( 'el_from' => $id ), __METHOD__
);
860 $this->mDb
->delete( 'langlinks', array( 'll_from' => $id ), __METHOD__
);
861 $this->mDb
->delete( 'iwlinks', array( 'iwl_from' => $id ), __METHOD__
);
862 $this->mDb
->delete( 'redirect', array( 'rd_from' => $id ), __METHOD__
);
863 $this->mDb
->delete( 'page_props', array( 'pp_page' => $id ), __METHOD__
);
866 # If using cleanup triggers, we can skip some manual deletes
867 if ( !$this->mDb
->cleanupTriggers() ) {
868 # Clean up recentchanges entries...
869 $this->mDb
->delete( 'recentchanges',
870 array( 'rc_type != ' . RC_LOG
,
871 'rc_namespace' => $title->getNamespace(),
872 'rc_title' => $title->getDBkey() ),
874 $this->mDb
->delete( 'recentchanges',
875 array( 'rc_type != ' . RC_LOG
, 'rc_cur_id' => $id ),