r40920 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40919‎ | r40920 | r40921 >
Date:17:08, 16 September 2008
Author:aaron
Status:old
Tags:
Comment:
* Make sure we have the right article ID, not slave lagged. (bug 8072)
* Make FileDeleteForm use hook properly
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/FileDeleteForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -2262,12 +2262,12 @@
22632263 global $wgOut, $wgUser;
22642264 wfDebug( __METHOD__."\n" );
22652265
2266 - $id = $this->getId();
 2266+ $id = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
22672267
22682268 $error = '';
22692269
2270 - if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason, &$error))) {
2271 - if ( $this->doDeleteArticle( $reason, $suppress ) ) {
 2270+ if ( wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason, &$error)) ) {
 2271+ if ( $this->doDeleteArticle( $reason, $suppress, $id ) ) {
22722272 $deleted = $this->mTitle->getPrefixedText();
22732273
22742274 $wgOut->setPagetitle( wfMsg( 'actioncomplete' ) );
@@ -2292,7 +2292,7 @@
22932293 * Deletes the article with database consistency, writes logs, purges caches
22942294 * Returns success
22952295 */
2296 - function doDeleteArticle( $reason, $suppress = false ) {
 2296+ function doDeleteArticle( $reason, $suppress = false, $id = 0 ) {
22972297 global $wgUseSquid, $wgDeferredUpdateList;
22982298 global $wgUseTrackbacks;
22992299
@@ -2301,7 +2301,7 @@
23022302 $dbw = wfGetDB( DB_MASTER );
23032303 $ns = $this->mTitle->getNamespace();
23042304 $t = $this->mTitle->getDBkey();
2305 - $id = $this->mTitle->getArticleID();
 2305+ $id = $id ? $id : $this->mTitle->getArticleID( GAID_FOR_UPDATE );
23062306
23072307 if ( $t == '' || $id == 0 ) {
23082308 return false;
Index: trunk/phase3/includes/FileDeleteForm.php
@@ -105,11 +105,12 @@
106106 } else {
107107 $status = $file->delete( $reason, $suppress );
108108 if( $status->ok ) {
 109+ $id = $title->getArticleID( GAID_FOR_UPDATE );
109110 // Need to delete the associated article
110111 $article = new Article( $title );
111112 if( wfRunHooks('ArticleDelete', array(&$article, &$wgUser, &$reason)) ) {
112 - if( $article->doDeleteArticle( $reason, $suppress ) )
113 - wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason));
 113+ if( $article->doDeleteArticle( $reason, $suppress, $id ) )
 114+ wfRunHooks('ArticleDeleteComplete', array(&$article, &$wgUser, $reason, $id));
114115 }
115116 }
116117 }