bugfix: check for existence of PRIMARY key in addition to UNIQUE key, as
authorErik Moeller <erik@users.mediawiki.org>
Mon, 11 Oct 2004 04:10:41 +0000 (04:10 +0000)
committerErik Moeller <erik@users.mediawiki.org>
Mon, 11 Oct 2004 04:10:41 +0000 (04:10 +0000)
MySQL returns "PRIMARY" as key_name. This caused uploads to fail with a
"patch required" message in HEAD even if the schema was up to date.

includes/Image.php

index 438b2e9..025c13f 100644 (file)
@@ -578,7 +578,7 @@ function wfRecordUpload( $name, $oldver, $size, $desc, $copyStatus = "", $source
        $dbw =& wfGetDB( DB_MASTER );
 
        # img_name must be unique
-       if ( !$dbw->indexUnique( 'image', 'img_name' ) ) {
+       if ( !$dbw->indexUnique( 'image', 'img_name' ) && !$dbw->indexExists('image','PRIMARY') ) {
                wfDebugDieBacktrace( 'Database schema not up to date, please run maintenance/archives/patch-image_name_unique.sql' );
        }