- $status = $file->delete( $reason, $suppress );
- if( $status->ok ) {
- $id = $title->getArticleID( GAID_FOR_UPDATE );
- // Need to delete the associated article
- $article = new Article( $title );
- $error = '';
- if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason, &$error)) ) {
- if( $article->doDeleteArticle( $reason, $suppress, $id ) ) {
+ $id = $title->getArticleID( GAID_FOR_UPDATE );
+ $article = new Article( $title );
+ $error = '';
+ $dbw = wfGetDB( DB_MASTER );
+ try {
+ if( wfRunHooks( 'ArticleDelete', array( &$article, &$wgUser, &$reason, &$error ) ) ) {
+ // delete the associated article first
+ if( $article->doDeleteArticle( $reason, $suppress, $id, false ) ) {