jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/352570 )

Change subject: Check hash existance before title
......................................................................


Check hash existance before title

In the case that an exact file copy already exists on the wiki
we don't want the use to start thinking of a new title for it
when on submit they will be shown another error message that
the file already exists.

So instead run the hash check first and thus avoid the error chain.

Change-Id: I367d02ff1f014c7db26c11322fe10f1435f2018d
---
M src/SpecialImportFile.php
1 file changed, 10 insertions(+), 10 deletions(-)

Approvals:
  WMDE-Fisch: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/SpecialImportFile.php b/src/SpecialImportFile.php
index 50eefab..c77da8e 100644
--- a/src/SpecialImportFile.php
+++ b/src/SpecialImportFile.php
@@ -190,8 +190,17 @@
                ImportTitleChecker $importTitleChecker
        ) {
                $out = $this->getOutput();
-               $targetTitle = $importDetails->getTargetTitle();
 
+               $duplicateFiles = $this->duplicateFileChecker->findDuplicates(
+                       $importDetails->getFileRevisions()->getLatest()
+               );
+
+               if ( !empty( $duplicateFiles ) ) {
+                       $out->addHTML( ( new DuplicateFilesPage( 
$duplicateFiles ) )->getHtml() );
+                       return false;
+               }
+
+               $targetTitle = $importDetails->getTargetTitle();
                if ( $targetTitle->exists() ) {
                        $out->addHTML( ( new TitleConflictPage(
                                $this,
@@ -214,15 +223,6 @@
                                $targetTitle,
                                'fileimporter-sourcetitleexists'
                        ) )->getHtml() );
-                       return false;
-               }
-
-               $duplicateFiles = $this->duplicateFileChecker->findDuplicates(
-                       $importDetails->getFileRevisions()->getLatest()
-               );
-
-               if ( !empty( $duplicateFiles ) ) {
-                       $this->getOutput()->addHTML( ( new DuplicateFilesPage( 
$duplicateFiles ) )->getHtml() );
                        return false;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/352570
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I367d02ff1f014c7db26c11322fe10f1435f2018d
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/FileImporter
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Andrew-WMDE <andrew.kos...@wikimedia.de>
Gerrit-Reviewer: MarkTraceur <mholmqu...@wikimedia.org>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de>
Gerrit-Reviewer: Tobias Gritschacher <tobias.gritschac...@wikimedia.de>
Gerrit-Reviewer: WMDE-Fisch <christoph.jau...@wikimedia.de>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to