* @ingroup Maintenance
*/
+use Wikimedia\Rdbms\DatabaseSqlite;
+use Wikimedia\Rdbms\DBError;
+
/**
* This class contains code common to different SQLite-related maintenance scripts
*
* Will throw exceptions on SQL errors
* @param array|string $files
* @throws MWException
- * @return string|bool true if no error or error string in case of errors
+ * @return bool True if no error or error string in case of errors
*/
public static function checkSqlSyntax( $files ) {
- if ( !Sqlite::isPresent() ) {
+ if ( !self::isPresent() ) {
throw new MWException( "Can't check SQL syntax: SQLite not found" );
}
if ( !is_array( $files ) ) {
- $files = array( $files );
+ $files = [ $files ];
}
- $allowedTypes = array_flip( array(
+ $allowedTypes = array_flip( [
'integer',
'real',
'text',
'blob', // NULL type is omitted intentionally
- ) );
+ ] );
- $db = new DatabaseSqliteStandalone( ':memory:' );
+ $db = DatabaseSqlite::newStandaloneInstance( ':memory:' );
try {
foreach ( $files as $file ) {
$err = $db->sourceFile( $file );