r102973 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102972‎ | r102973 | r102974 >
Date:12:40, 14 November 2011
Author:ialex
Status:resolved (Comments)
Tags:
Comment:
Updated remaining functions executing NewRevisionFromEditComplete hook to use WikiPage instead of Article
Modified paths:
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialImport.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -1051,8 +1051,7 @@
10521052 }
10531053
10541054 $descTitle = $this->getTitle();
1055 - $article = new ImagePage( $descTitle );
1056 - $article->setFile( $this );
 1055+ $wikiPage = WikiPage::factory( $descTitle );
10571056
10581057 # Add the log entry
10591058 $log = new LogPage( 'upload' );
@@ -1071,8 +1070,8 @@
10721071 if (!is_null($nullRevision)) {
10731072 $nullRevision->insertOn( $dbw );
10741073
1075 - wfRunHooks( 'NewRevisionFromEditComplete', array( $article, $nullRevision, $latest, $user ) );
1076 - $article->updateRevisionOn( $dbw, $nullRevision );
 1074+ wfRunHooks( 'NewRevisionFromEditComplete', array( $wikiPage, $nullRevision, $latest, $user ) );
 1075+ $wikiPage->updateRevisionOn( $dbw, $nullRevision );
10771076 }
10781077 # Invalidate the cache for the description page
10791078 $descTitle->invalidateCache();
@@ -1081,7 +1080,7 @@
10821081 # New file; create the description page.
10831082 # There's already a log entry, so don't make a second RC entry
10841083 # Squid and file cache for the description page are purged by doEdit.
1085 - $article->doEdit( $pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC );
 1084+ $wikiPage->doEdit( $pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC );
10861085 }
10871086
10881087 # Commit the transaction now, in case something goes wrong later
Index: trunk/phase3/includes/specials/SpecialImport.php
@@ -390,10 +390,10 @@
391391 $nullRevision = Revision::newNullRevision( $dbw, $title->getArticleId(), $comment, true );
392392 if (!is_null($nullRevision)) {
393393 $nullRevision->insertOn( $dbw );
394 - $article = new Article( $title );
 394+ $page = WikiPage::factory( $title );
395395 # Update page record
396 - $article->updateRevisionOn( $dbw, $nullRevision );
397 - wfRunHooks( 'NewRevisionFromEditComplete', array( $article, $nullRevision, $latest, $this->getUser() ) );
 396+ $page->updateRevisionOn( $dbw, $nullRevision );
 397+ wfRunHooks( 'NewRevisionFromEditComplete', array( $page, $nullRevision, $latest, $this->getUser() ) );
398398 }
399399 } else {
400400 $this->getOutput()->addHTML( "<li>" . Linker::linkKnown( $title ) . " " .

Follow-up revisions

RevisionCommit summaryAuthorDate
r103380Per Aaron, fix for r102973: create directly a WikiFilePage object and call se...ialex20:54, 16 November 2011

Comments

#Comment by Aaron Schulz (talk | contribs)   20:04, 16 November 2011

Why not create specifically a WikiFilePage and call setFile()?

#Comment by Aaron Schulz (talk | contribs)   20:05, 16 November 2011

Also things tend to call setFile() for a good reason, like avoiding cache/slave lag or something.

#Comment by IAlex (talk | contribs)   20:55, 16 November 2011

Done in r103380; for the record the setFile() call was added in r44640.

Status & tagging log