Show warning if image page exists
authorVictor Vasiliev <vasilievvv@users.mediawiki.org>
Sat, 26 Jan 2008 19:44:31 +0000 (19:44 +0000)
committerVictor Vasiliev <vasilievvv@users.mediawiki.org>
Sat, 26 Jan 2008 19:44:31 +0000 (19:44 +0000)
includes/SpecialUpload.php
languages/messages/MessagesEn.php
maintenance/language/messages.inc

index 657a1a5..07d134b 100644 (file)
@@ -610,6 +610,9 @@ class UploadForm {
 
                        $warning .= '<li>' . wfMsgExt( 'fileexists', 'parseline', $dlink ) . '</li>' . $dlink2;
 
+               } elseif( $file->getTitle()->getArticleID() ) {
+                       $lnk = $sk->makeKnownLinkObj( $file->getTitle(), '', 'redirect=no' );
+                       $warning .= '<li>' . wfMsgExt( 'filepageexists', 'parseline', $lnk ) . '</li>';
                } elseif ( $file_lc && $file_lc->exists() ) {
                        # Check if image with lowercase extension exists.
                        # It's not forbidden but in 99% it makes no sense to upload the same filename with uppercase extension
index e06f6d0..98d8351 100644 (file)
@@ -1451,6 +1451,7 @@ To include the image in a page, use a link in the form
 'largefileserver'             => 'This file is bigger than the server is configured to allow.',
 'emptyfile'                   => 'The file you uploaded seems to be empty. This might be due to a typo in the file name. Please check whether you really want to upload this file.',
 'fileexists'                  => 'A file with this name exists already, please check <strong><tt>$1</tt></strong> if you are not sure if you want to change it.',
+'filepageexists'               => 'A page (not image) with this name exists already, please check <strong><tt>$1</tt></strong> if you are not sure if you want to change it.',
 'fileexists-extension'        => 'A file with a similar name exists:<br />
 Name of the uploading file: <strong><tt>$1</tt></strong><br />
 Name of the existing file: <strong><tt>$2</tt></strong><br />
index 87326f8..804fbdf 100644 (file)
@@ -851,6 +851,7 @@ $wgMessageStructure = array(
                'largefileserver',
                'emptyfile',
                'fileexists',
+               'filepageexists',
                'fileexists-extension',
                'fileexists-thumb',
                'fileexists-thumbnail-yes',