From 2506b05ef1ab82241997089e43302ac3dbff4b05 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Wed, 28 Jan 2009 13:47:21 +0000 Subject: [PATCH] Re-commit r46417 (Skip dupe warnings when it's a titles are the same and it's a reupload), this time without an E_NOTICE. --- RELEASE-NOTES | 2 ++ includes/specials/SpecialUpload.php | 12 ++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 3447340cfd..40d25a9a1f 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -107,6 +107,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN messages on save were the edit in fact is saved. * (bug 17184) Remove duplicate "z" accesskey in MonoBook * Parser tests no longer fail when $wgAlwaysUseTidy is set in LocalSettings.php +* Removed redundant dupe warnings on reupload for the same title. Dupe warnings + for identical files at different titles are still given. == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 207f44e8c2..7529d473fd 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -550,7 +550,7 @@ class UploadForm { $warning .= self::getExistsWarning( $this->mLocalFile ); } - $warning .= $this->getDupeWarning( $this->mTempPath, $finalExt ); + $warning .= $this->getDupeWarning( $this->mTempPath, $finalExt, $nt ); if( $warning != '' ) { /** @@ -757,7 +757,7 @@ class UploadForm { * Check for duplicate files and throw up a warning before the upload * completes. */ - function getDupeWarning( $tempfile, $extension ) { + function getDupeWarning( $tempfile, $extension, $destinationTitle ) { $hash = File::sha1Base36( $tempfile ); $dupes = RepoGroup::singleton()->findBySha1( $hash ); $archivedImage = new ArchivedFile( null, 0, $hash.".$extension" ); @@ -766,8 +766,12 @@ class UploadForm { $msg = ""; foreach( $dupes as $file ) { $title = $file->getTitle(); - $msg .= $title->getPrefixedText() . - "|" . $title->getText() . "\n"; + # Don't throw the warning when the titles are the same, it's a reupload + # and highly redundant. + if ( !$title->equals( $destinationTitle ) || !$this->mReUpload ) { + $msg .= $title->getPrefixedText() . + "|" . $title->getText() . "\n"; + } } $msg .= ""; return "
  • " . -- 2.20.1