);
# Now that it's safely backed up, delete it
- $dbw->delete( 'revision', array( 'rev_page' => $id ), __METHOD__ );
$dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__);
- if ($wgUseTrackbacks)
- $dbw->delete( 'trackbacks', array( 'tb_page' => $id ), __METHOD__ );
+ # If using cascading deletes, we can skip some explicit deletes
+ if ( !$dbw->cascadingDeletes() ) {
+
+ $dbw->delete( 'revision', array( 'rev_page' => $id ), __METHOD__ );
- # Clean up recentchanges entries...
- $dbw->delete( 'recentchanges', array( 'rc_namespace' => $ns, 'rc_title' => $t ), __METHOD__ );
+ if ($wgUseTrackbacks)
+ $dbw->delete( 'trackbacks', array( 'tb_page' => $id ), __METHOD__ );
+
+ # Delete outgoing links
+ $dbw->delete( 'pagelinks', array( 'pl_from' => $id ) );
+ $dbw->delete( 'imagelinks', array( 'il_from' => $id ) );
+ $dbw->delete( 'categorylinks', array( 'cl_from' => $id ) );
+ $dbw->delete( 'templatelinks', array( 'tl_from' => $id ) );
+ $dbw->delete( 'externallinks', array( 'el_from' => $id ) );
+ $dbw->delete( 'langlinks', array( 'll_from' => $id ) );
+ }
- # Finally, clean up the link tables
- $t = $this->mTitle->getPrefixedDBkey();
+ # If using cleanup triggers, we can skip some manual deletes
+ if ( !$dbw->cleanupTriggers() ) {
+
+ # Clean up recentchanges entries...
+ $dbw->delete( 'recentchanges', array( 'rc_namespace' => $ns, 'rc_title' => $t ), __METHOD__ );
+ }
# Clear caches
Article::onArticleDelete( $this->mTitle );
- # Delete outgoing links
- $dbw->delete( 'pagelinks', array( 'pl_from' => $id ) );
- $dbw->delete( 'imagelinks', array( 'il_from' => $id ) );
- $dbw->delete( 'categorylinks', array( 'cl_from' => $id ) );
- $dbw->delete( 'templatelinks', array( 'tl_from' => $id ) );
- $dbw->delete( 'externallinks', array( 'el_from' => $id ) );
- $dbw->delete( 'langlinks', array( 'll_from' => $id ) );
-
# Log the deletion
$log = new LogPage( 'delete' );
$log->addEntry( 'delete', $this->mTitle, $reason );
protected $mTrxLevel = 0;
protected $mErrorCount = 0;
protected $mLBInfo = array();
+ protected $mCascadingDeletes = false;
+ protected $mCleanupTriggers = false;
#------------------------------------------------------------------------------
# Accessors
}
}
+ /**
+ * Returns true if this database supports (and uses) cascading deletes
+ */
+ function cascadingDeletes() {
+ return $this->mCascadingDeletes;
+ }
+
+ /**
+ * Returns true if this database supports (and uses) triggers (e.g. on the page table)
+ */
+ function cleanupTriggers() {
+ return $this->mCleanupTriggers;
+ }
+
/**#@+
* Get function
*/