(bug 40326) Check if files exist with a different extension during
[lhc/web/wiklou.git] / includes / upload / UploadBase.php
index 49713fc..9d756f8 100644 (file)
@@ -1377,6 +1377,17 @@ abstract class UploadBase {
                        }
                }
 
+               // Check for files with the same name but a different extension
+               $similarFiles = RepoGroup::singleton()->getLocalRepo()->findFilesByPrefix(
+                               "{$partname}.", 1 );
+               if ( count( $similarFiles ) ) {
+                       return array(\r
+                               'warning' => 'exists-normalized',\r
+                               'file' => $file,\r
+                               'normalizedFile' => $similarFiles[0],\r
+                       );
+               }
+
                if ( self::isThumbName( $file->getName() ) ) {
                        # Check for filenames like 50px- or 180px-, these are mostly thumbnails
                        $nt_thb = Title::newFromText( substr( $partname, strpos( $partname, '-' ) + 1 ) . '.' . $extension, NS_FILE );