r45058 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r45057‎ | r45058 | r45059 >
Date:19:42, 26 December 2008
Author:btongminh
Status:reverted (Comments)
Tags:
Comment:
(bug 15430) Cancel the upload process and rollback database changes in case no article associated with the file can be created
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -913,7 +913,11 @@
914914 } else {
915915 // New file; create the description page.
916916 // There's already a log entry, so don't make a second RC entry
917 - $article->doEdit( $pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC );
 917+ $result = $article->doEdit( $pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC );
 918+ if ( !$result->isOK() ) {
 919+ $dbw->rollback( __METHOD__ );
 920+ return false;
 921+ }
918922 }
919923
920924 # Hooks, hooks, the magic of hooks...
Index: trunk/phase3/RELEASE-NOTES
@@ -563,6 +563,8 @@
564564 * (bug 16726) siprop=namespacealiases should also list localized aliases
565565 * (bug 16730) Added apprfiltercascade parameter to list=allpages to filter
566566 cascade-protected pages
 567+* (bug 15430) Cancel the upload process and rollback database changes in case
 568+ no article associated with the file can be created
567569
568570 === Languages updated in 1.14 ===
569571

Follow-up revisions

RevisionCommit summaryAuthorDate
r45230Reverting r45058 "(bug 15430) Cancel the upload process and rollback database...brion17:25, 31 December 2008

Comments

#Comment by Brion VIBBER (talk | contribs)   17:25, 31 December 2008

Reverted in r45230

Article::doEdit() opens and commits transactions of its own, so the transaction we started earlier will already be committed and cannot be rolled back at this point unless one of two particular failure modes hits (ArticleSave hook aborts or mLatest isn't set). A more general fix needs to be devised...

#Comment by Bryan (talk | contribs)   19:03, 31 December 2008

How about moving the Article::doEdit call entirely to the top? This way we can safely bail out if it fails.

Status & tagging log