From: Greg Sabino Mullane Date: Sun, 16 Jul 2006 17:53:25 +0000 (+0000) Subject: Add mysql if blocks for deletion, remove unused getPrefixedDBkey() call. X-Git-Tag: 1.31.0-rc.0~56200 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=030118319efcd5e3de103be0bc2e94e94374f1df;p=lhc%2Fweb%2Fwiklou.git Add mysql if blocks for deletion, remove unused getPrefixedDBkey() call. --- diff --git a/includes/Article.php b/includes/Article.php index 64168896a0..716a0f9be6 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1910,29 +1910,28 @@ class Article { ); # 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 ($wgDBtype == 'mysql') { + $dbw->delete( 'revision', array( 'rev_page' => $id ), __METHOD__ ); + if ($wgUseTrackbacks) + $dbw->delete( 'trackbacks', array( 'tb_page' => $id ), __METHOD__ ); - # Clean up recentchanges entries... - $dbw->delete( 'recentchanges', array( 'rc_namespace' => $ns, 'rc_title' => $t ), __METHOD__ ); + # Clean up recentchanges entries... + $dbw->delete( 'recentchanges', array( 'rc_namespace' => $ns, 'rc_title' => $t ), __METHOD__ ); - # Finally, clean up the link tables - $t = $this->mTitle->getPrefixedDBkey(); + # 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 ) ); + } # 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 );