From a15a28fadc4c2321ec86d3c24c964a2baa8bfe60 Mon Sep 17 00:00:00 2001 From: Bryan Tong Minh Date: Fri, 26 Dec 2008 19:42:29 +0000 Subject: [PATCH] (bug 15430) Cancel the upload process and rollback database changes in case no article associated with the file can be created --- RELEASE-NOTES | 2 ++ includes/filerepo/LocalFile.php | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 80b88eb0fa..70ad4bf672 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -563,6 +563,8 @@ The following extensions are migrated into MediaWiki 1.14: * (bug 16726) siprop=namespacealiases should also list localized aliases * (bug 16730) Added apprfiltercascade parameter to list=allpages to filter cascade-protected pages +* (bug 15430) Cancel the upload process and rollback database changes in case + no article associated with the file can be created === Languages updated in 1.14 === diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 899fbd0a9e..9adac91fdb 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -913,7 +913,11 @@ class LocalFile extends File } else { // New file; create the description page. // There's already a log entry, so don't make a second RC entry - $article->doEdit( $pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC ); + $result = $article->doEdit( $pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC ); + if ( !$result->isOK() ) { + $dbw->rollback( __METHOD__ ); + return false; + } } # Hooks, hooks, the magic of hooks... -- 2.20.1