From: Aaron Schulz Date: Mon, 27 Apr 2015 19:17:52 +0000 (-0700) Subject: Made DatabaseSqlite::__construct always caller super X-Git-Tag: 1.31.0-rc.0~11561 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dcompta/operations/modifier.php?a=commitdiff_plain;h=a129edcc5ed3d11fc088d6ca559b03c11313883f;p=lhc%2Fweb%2Fwiklou.git Made DatabaseSqlite::__construct always caller super * Also fixed misuse of private mTrxAtomicLevels var Change-Id: I711508cb3906a5192be1a244a7e511b1720141ca --- diff --git a/includes/db/Database.php b/includes/db/Database.php index d2cac34e93..5afff91550 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -818,14 +818,14 @@ abstract class DatabaseBase implements IDatabase { $this->mSessionVars = $params['variables']; /** Get the default table prefix*/ - if ( $tablePrefix == 'get from global' ) { + if ( $tablePrefix === 'get from global' ) { $this->mTablePrefix = $wgDBprefix; } else { $this->mTablePrefix = $tablePrefix; } /** Get the database schema*/ - if ( $schema == 'get from global' ) { + if ( $schema === 'get from global' ) { $this->mSchema = $wgDBmwschema; } else { $this->mSchema = $schema; @@ -2485,7 +2485,7 @@ abstract class DatabaseBase implements IDatabase { } # Quote $schema and merge it with the table name if needed - if ( $schema !== null ) { + if ( strlen( $schema ) ) { if ( $format == 'quoted' && !$this->isQuotedIdentifier( $schema ) ) { $schema = $this->addIdentifierQuotes( $schema ); } diff --git a/includes/db/DatabaseSqlite.php b/includes/db/DatabaseSqlite.php index ed86bab1b8..2bad711680 100644 --- a/includes/db/DatabaseSqlite.php +++ b/includes/db/DatabaseSqlite.php @@ -64,16 +64,16 @@ class DatabaseSqlite extends DatabaseBase { $this->dbDir = isset( $p['dbDirectory'] ) ? $p['dbDirectory'] : $wgSQLiteDataDir; if ( isset( $p['dbFilePath'] ) ) { - $this->mFlags = isset( $p['flags'] ) ? $p['flags'] : 0; - // Standalone .sqlite file mode + parent::__construct( $p ); + // Standalone .sqlite file mode. + // Super doesn't open when $user is false, but we can work with $dbName, + // which is derived from the file path in this case. $this->openFile( $p['dbFilePath'] ); - // @FIXME: clean up base constructor so this can call super instead - $this->mTrxAtomicLevels = new SplStack; } else { $this->mDBname = $p['dbname']; - // Stock wiki mode using standard file names per DB + // Stock wiki mode using standard file names per DB. parent::__construct( $p ); - // parent doesn't open when $user is false, but we can work with $dbName + // Super doesn't open when $user is false, but we can work with $dbName if ( $p['dbname'] && !$this->isOpen() ) { if ( $this->open( $p['host'], $p['user'], $p['password'], $p['dbname'] ) ) { if ( $wgSharedDB ) { @@ -105,8 +105,10 @@ class DatabaseSqlite extends DatabaseBase { */ public static function newStandaloneInstance( $filename, array $p = array() ) { $p['dbFilePath'] = $filename; + $p['schema'] = false; + $p['tablePrefix'] = ''; - return new self( $p ); + return DatabaseBase::factory( 'sqlite', $p ); } /**