remove schema check on upload, any wiki this old almost certainly won't work anyway...
authorRiver Tarnell <river@users.mediawiki.org>
Wed, 2 May 2007 01:44:46 +0000 (01:44 +0000)
committerRiver Tarnell <river@users.mediawiki.org>
Wed, 2 May 2007 01:44:46 +0000 (01:44 +0000)
includes/Image.php

index 8cc8c39..417d2a8 100644 (file)
@@ -321,7 +321,6 @@ class Image
                wfProfileIn( __METHOD__ );
 
                $dbr = wfGetDB( DB_SLAVE );
-               $this->checkDBSchema($dbr);
 
                $row = $dbr->selectRow( 'image',
                        array( 'img_size', 'img_width', 'img_height', 'img_bits',
@@ -455,8 +454,6 @@ class Image
                        $dbw = wfGetDB( DB_MASTER );
                }
 
-               $this->checkDBSchema($dbw);
-
                list( $major, $minor ) = self::splitMime( $this->mime );
 
                wfDebug(__METHOD__.': upgrading '.$this->name." to the current schema\n");
@@ -1121,38 +1118,6 @@ class Image
                $update->doUpdate();
        }
 
-       /**
-        * Check the image table schema on the given connection for subtle problems
-        */
-       function checkDBSchema(&$db) {
-               static $checkDone = false;
-               global $wgCheckDBSchema;
-               if (!$wgCheckDBSchema || $checkDone) {
-                       return;
-               }
-               # img_name must be unique
-               if ( !$db->indexUnique( 'image', 'img_name' ) && !$db->indexExists('image','PRIMARY') ) {
-                       throw new MWException( 'Database schema not up to date, please run maintenance/archives/patch-image_name_unique.sql' );
-               }
-               $checkDone = true;
-
-               # new fields must exist
-               # 
-               # Not really, there's hundreds of checks like this that we could do and they're all pointless, because 
-               # if the fields are missing, the database will loudly report a query error, the first time you try to do 
-               # something. The only reason I put the above schema check in was because the absence of that particular
-               # index would lead to an annoying subtle bug. No error message, just some very odd behaviour on duplicate
-               # uploads. -- TS
-               /*
-               if ( !$db->fieldExists( 'image', 'img_media_type' )
-                 || !$db->fieldExists( 'image', 'img_metadata' )
-                 || !$db->fieldExists( 'image', 'img_width' ) ) {
-
-                       throw new MWException( 'Database schema not up to date, please run maintenance/update.php' );
-                }
-                */
-       }
-
        /**
         * Return the image history of this image, line by line.
         * starts with current version, then old versions.
@@ -1166,8 +1131,6 @@ class Image
        function nextHistoryLine() {
                $dbr = wfGetDB( DB_SLAVE );
 
-               $this->checkDBSchema($dbr);
-
                if ( $this->historyLine == 0 ) {// called for the first time, return line from cur
                        $this->historyRes = $dbr->select( 'image',
                                array(
@@ -1262,8 +1225,6 @@ class Image
 
                $dbw = wfGetDB( DB_MASTER );
 
-               $this->checkDBSchema($dbw);
-
                // Delete thumbnails and refresh the metadata cache
                $this->purgeCache();