- /**
- * 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' );
- }
- */
- }
-