From 082e0ad3df2e4def473d0a2331c0fcfb4d6bc054 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 17 Feb 2009 21:33:12 +0000 Subject: [PATCH] * Only show dupe messages for remote images once. Twice is redundant :) * Phased out sharedupload(duplicate|conflict)(\-linktext)? messages (removed from en and messages.inc) --- RELEASE-NOTES | 1 + includes/ImagePage.php | 50 ------------------------------- languages/messages/MessagesEn.php | 4 --- maintenance/language/messages.inc | 4 --- 4 files changed, 1 insertion(+), 58 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 2a64920a44..d0a2e29828 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -184,6 +184,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN in next page link * (bug 17506) Exceptions within exceptions now respect $wgShowExceptionDetails * Fixed excessive job queue utilisation +* File dupe messages for remote repos are now shown only once. == API changes in 1.15 == * (bug 16858) Revamped list=deletedrevs to make listing deleted contributions diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 1dc6fd6749..88d0b5ce38 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -117,8 +117,6 @@ class ImagePage extends Article { $wgOut->addWikiText( $fol ); } $wgOut->addHTML( '
' . $this->mExtraDescription . '
' ); - } else { - $this->checkSharedConflict(); } $this->closeShowImage(); @@ -502,54 +500,6 @@ EOT } } - /* - * Check for files with the same name on the foreign repos. - */ - protected function checkSharedConflict() { - global $wgOut, $wgUser; - - $repoGroup = RepoGroup::singleton(); - if( !$repoGroup->hasForeignRepos() ) { - return; - } - - $this->loadFile(); - if( !$this->img->isLocal() ) { - return; - } - - $this->dupFile = null; - $repoGroup->forEachForeignRepo( array( $this, 'checkSharedConflictCallback' ) ); - - if( !$this->dupFile ) - return; - $dupfile = $this->dupFile; - $same = ( - ($this->img->getSha1() == $dupfile->getSha1()) && - ($this->img->getSize() == $dupfile->getSize()) - ); - - $sk = $wgUser->getSkin(); - $descUrl = $dupfile->getDescriptionUrl(); - if( $same ) { - $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadduplicate-linktext' ) ); - $wgOut->addHTML( '
' . wfMsgWikiHtml( 'shareduploadduplicate', $link ) . '
' ); - } else { - $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadconflict-linktext' ) ); - $wgOut->addHTML( '
' . wfMsgWikiHtml( 'shareduploadconflict', $link ) . '
' ); - } - } - - public function checkSharedConflictCallback( $repo ) { - $this->loadFile(); - $dupfile = $repo->newFile( $this->img->getTitle() ); - if( $dupfile && $dupfile->exists() ) { - $this->dupFile = $dupfile; - return $dupfile->exists(); - } - return false; - } - public function getUploadUrl() { $this->loadFile(); $uploadTitle = SpecialPage::getTitleFor( 'Upload' ); diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index f5513e6679..f6023dbd7d 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1986,10 +1986,6 @@ A [[Special:WhatLinksHere/$2|full list]] is available.', 'shareduploadwiki-desc' => 'The description on its $1 on the shared repository is shown below.', 'shareduploadwiki-linktext' => 'file description page', 'shareddescriptionfollows' => '-', # do not translate or duplicate this message to other languages -'shareduploadduplicate' => 'This file is a duplicate of $1 from shared repository.', -'shareduploadduplicate-linktext' => 'another file', -'shareduploadconflict' => 'This file has the same name as $1 from the shared repository.', -'shareduploadconflict-linktext' => 'another file', 'noimage' => 'No file by this name exists, but you can $1.', 'noimage-linktext' => 'upload one', 'uploadnewversion-linktext' => 'Upload a new version of this file', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index 7ed875d214..cdd9061e28 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -1243,10 +1243,6 @@ $wgMessageStructure = array( 'shareduploadwiki-desc', 'shareduploadwiki-linktext', 'shareddescriptionfollows', - 'shareduploadduplicate', - 'shareduploadduplicate-linktext', - 'shareduploadconflict', - 'shareduploadconflict-linktext', 'noimage', 'noimage-linktext', 'uploadnewversion-linktext', -- 2.20.1