$wgOut->addWikiText( $fol );
}
$wgOut->addHTML( '<div id="shared-image-desc">' . $this->mExtraDescription . '</div>' );
+ } else {
+ $this->checkSharedConflict();
}
$this->closeShowImage();
}
}
+ function checkSharedConflict() {
+ global $wgOut, $wgUser, $wgUseSharedUploads;
+ if( !$wgUseSharedUploads ) {
+ return;
+ }
+ if( $this->repo->getName() != 'local' ) {
+ return;
+ }
+
+ $repo = RepoGroup::singleton()->getRepoByName( 'shared' );
+ $dupfile = $repo->newFile( $this->img->getTitle() );
+ if( !$dupfile->exists() ) {
+ return;
+ }
+ $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( '<div id="shared-image-dup">' . wfMsgWikiHtml( 'shareduploadduplicate', $link ) . '</div>' );
+ } else {
+ $link = $sk->makeExternalLink( $descUrl, wfMsg( 'shareduploadconflict-linktext' ) );
+ $wgOut->addHTML( '<div id="shared-image-conflict">' . wfMsgWikiHtml( 'shareduploadconflict', $link ) . '</div>' );
+ }
+ }
+
function getUploadUrl() {
$uploadTitle = SpecialPage::getTitleFor( 'Upload' );
return $uploadTitle->getFullUrl( 'wpDestFile=' . urlencode( $this->img->getName() ) );
'imagelist_description' => 'Description',
# Image description page
-'filehist' => 'File history',
-'filehist-help' => 'Click on a date/time to view the file as it appeared at that time.',
-'filehist-deleteall' => 'delete all',
-'filehist-deleteone' => 'delete this',
-'filehist-revert' => 'revert',
-'filehist-current' => 'current',
-'filehist-datetime' => 'Date/Time',
-'filehist-user' => 'User',
-'filehist-dimensions' => 'Dimensions',
-'filehist-filesize' => 'File size',
-'filehist-comment' => 'Comment',
-'imagelinks' => 'Links',
-'linkstoimage' => 'The following pages link to this file:',
-'nolinkstoimage' => 'There are no pages that link to this file.',
-'sharedupload' => 'This file is a shared upload and may be used by other projects.',
-'shareduploadwiki' => 'Please see the $1 for further information.',
-'shareduploadwiki-desc' => 'The description on its $1 there is shown below.',
-'shareduploadwiki-linktext' => 'file description page',
-'shareddescriptionfollows' => '-', # do not translate or duplicate this message to other languages
-'noimage' => 'No file by this name exists, you can $1.',
-'noimage-linktext' => 'upload it',
-'uploadnewversion-linktext' => 'Upload a new version of this file',
-'imagepage-searchdupe' => 'Search for duplicate files',
+'filehist' => 'File history',
+'filehist-help' => 'Click on a date/time to view the file as it appeared at that time.',
+'filehist-deleteall' => 'delete all',
+'filehist-deleteone' => 'delete this',
+'filehist-revert' => 'revert',
+'filehist-current' => 'current',
+'filehist-datetime' => 'Date/Time',
+'filehist-user' => 'User',
+'filehist-dimensions' => 'Dimensions',
+'filehist-filesize' => 'File size',
+'filehist-comment' => 'Comment',
+'imagelinks' => 'Links',
+'linkstoimage' => 'The following pages link to this file:',
+'nolinkstoimage' => 'There are no pages that link to this file.',
+'sharedupload' => 'This file is a shared upload and may be used by other projects.',
+'shareduploadwiki' => 'Please see the $1 for further information.',
+'shareduploadwiki-desc' => 'The description on its $1 there 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 shared repository has.',
+'shareduploadconflict-linktext' => 'another file',
+'noimage' => 'No file by this name exists, you can $1.',
+'noimage-linktext' => 'upload it',
+'uploadnewversion-linktext' => 'Upload a new version of this file',
+'imagepage-searchdupe' => 'Search for duplicate files',
# File reversion
'filerevert' => 'Revert $1',