From: Aaron Schulz Date: Tue, 16 Sep 2008 17:08:08 +0000 (+0000) Subject: * Make sure we have the right article ID, not slave lagged. (bug 8072) X-Git-Tag: 1.31.0-rc.0~45261 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=12d279ff91d8f99eecde352fdfc909a66bf7afa7;p=lhc%2Fweb%2Fwiklou.git * Make sure we have the right article ID, not slave lagged. (bug 8072) * Make FileDeleteForm use hook properly --- diff --git a/includes/Article.php b/includes/Article.php index aa5e5b69a5..9a8b274ed2 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2262,12 +2262,12 @@ class Article { 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' ) ); @@ -2292,7 +2292,7 @@ class Article { * 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; @@ -2301,7 +2301,7 @@ class Article { $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; diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index ae144d7d07..4f6986aa86 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -105,11 +105,12 @@ class FileDeleteForm { } 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)); } } }