r21785 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r21784‎ | r21785 | r21786 >
Date:01:44, 2 May 2007
Author:river
Status:old
Tags:
Comment:
remove schema check on upload, any wiki this old almost certainly won't work anyway, and it's a little mysql-specific
Modified paths:
  • /trunk/phase3/includes/Image.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Image.php
@@ -321,7 +321,6 @@
322322 wfProfileIn( __METHOD__ );
323323
324324 $dbr = wfGetDB( DB_SLAVE );
325 - $this->checkDBSchema($dbr);
326325
327326 $row = $dbr->selectRow( 'image',
328327 array( 'img_size', 'img_width', 'img_height', 'img_bits',
@@ -455,8 +454,6 @@
456455 $dbw = wfGetDB( DB_MASTER );
457456 }
458457
459 - $this->checkDBSchema($dbw);
460 -
461458 list( $major, $minor ) = self::splitMime( $this->mime );
462459
463460 wfDebug(__METHOD__.': upgrading '.$this->name." to the current schema\n");
@@ -1122,38 +1119,6 @@
11231120 }
11241121
11251122 /**
1126 - * Check the image table schema on the given connection for subtle problems
1127 - */
1128 - function checkDBSchema(&$db) {
1129 - static $checkDone = false;
1130 - global $wgCheckDBSchema;
1131 - if (!$wgCheckDBSchema || $checkDone) {
1132 - return;
1133 - }
1134 - # img_name must be unique
1135 - if ( !$db->indexUnique( 'image', 'img_name' ) && !$db->indexExists('image','PRIMARY') ) {
1136 - throw new MWException( 'Database schema not up to date, please run maintenance/archives/patch-image_name_unique.sql' );
1137 - }
1138 - $checkDone = true;
1139 -
1140 - # new fields must exist
1141 - #
1142 - # Not really, there's hundreds of checks like this that we could do and they're all pointless, because
1143 - # if the fields are missing, the database will loudly report a query error, the first time you try to do
1144 - # something. The only reason I put the above schema check in was because the absence of that particular
1145 - # index would lead to an annoying subtle bug. No error message, just some very odd behaviour on duplicate
1146 - # uploads. -- TS
1147 - /*
1148 - if ( !$db->fieldExists( 'image', 'img_media_type' )
1149 - || !$db->fieldExists( 'image', 'img_metadata' )
1150 - || !$db->fieldExists( 'image', 'img_width' ) ) {
1151 -
1152 - throw new MWException( 'Database schema not up to date, please run maintenance/update.php' );
1153 - }
1154 - */
1155 - }
1156 -
1157 - /**
11581123 * Return the image history of this image, line by line.
11591124 * starts with current version, then old versions.
11601125 * uses $this->historyLine to check which line to return:
@@ -1166,8 +1131,6 @@
11671132 function nextHistoryLine() {
11681133 $dbr = wfGetDB( DB_SLAVE );
11691134
1170 - $this->checkDBSchema($dbr);
1171 -
11721135 if ( $this->historyLine == 0 ) {// called for the first time, return line from cur
11731136 $this->historyRes = $dbr->select( 'image',
11741137 array(
@@ -1262,8 +1225,6 @@
12631226
12641227 $dbw = wfGetDB( DB_MASTER );
12651228
1266 - $this->checkDBSchema($dbw);
1267 -
12681229 // Delete thumbnails and refresh the metadata cache
12691230 $this->purgeCache();
12701231

Follow-up revisions

RevisionCommit summaryAuthorDate
r63911Remove ancient (added in r13105) stopgap to prevent running schema sanity che...demon16:03, 18 March 2010