X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/mediawiki.git/blobdiff_plain/87219ebd28426c6d21cb545233ee52f5f7af7dfd..18a6620945d02687fbcfc4c27355d952fd748b41:/maintenance/sqlite.inc diff --git a/maintenance/sqlite.inc b/maintenance/sqlite.inc new file mode 100644 index 00000000..238fe82b --- /dev/null +++ b/maintenance/sqlite.inc @@ -0,0 +1,67 @@ +sourceFile( $file ); + if ( $err != true ) { + return $err; + } + } + + $tables = $db->query( "SELECT name FROM sqlite_master WHERE type='table'", __METHOD__ ); + foreach ( $tables as $table ) { + if ( strpos( $table->name, 'sqlite_' ) === 0 ) continue; + + $columns = $db->query( "PRAGMA table_info({$table->name})", __METHOD__ ); + foreach ( $columns as $col ) { + if ( !isset( $allowedTypes[strtolower( $col->type )] ) ) { + $db->close(); + return "Table {$table->name} has column {$col->name} with non-native type '{$col->type}'"; + } + } + } + } catch ( DBError $e ) { + return $e->getMessage(); + } + $db->close(); + return true; + } + }; \ No newline at end of file