global $wgOut, $wgUser;
wfDebug( __METHOD__."\n" );
- $id = $this->getId();
+ $id = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
$error = '';
- if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason, &$error))) {
- if ( $this->doDeleteArticle( $reason, $suppress ) ) {
+ if ( wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason, &$error)) ) {
+ if ( $this->doDeleteArticle( $reason, $suppress, $id ) ) {
$deleted = $this->mTitle->getPrefixedText();
$wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
* Deletes the article with database consistency, writes logs, purges caches
* Returns success
*/
- function doDeleteArticle( $reason, $suppress = false ) {
+ function doDeleteArticle( $reason, $suppress = false, $id = 0 ) {
global $wgUseSquid, $wgDeferredUpdateList;
global $wgUseTrackbacks;
$dbw = wfGetDB( DB_MASTER );
$ns = $this->mTitle->getNamespace();
$t = $this->mTitle->getDBkey();
- $id = $this->mTitle->getArticleID();
+ $id = $id ? $id : $this->mTitle->getArticleID( GAID_FOR_UPDATE );
if ( $t == '' || $id == 0 ) {
return false;
} else {
$status = $file->delete( $reason, $suppress );
if( $status->ok ) {
+ $id = $title->getArticleID( GAID_FOR_UPDATE );
// Need to delete the associated article
$article = new Article( $title );
if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)) ) {
- if( $article->doDeleteArticle( $reason, $suppress ) )
- wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason));
+ if( $article->doDeleteArticle( $reason, $suppress, $id ) )
+ wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason, $id));
}
}
}