* - dbDirectory : directory containing the DB and the lock file directory
* - dbFilePath : use this to force the path of the DB file
* - trxMode : one of (deferred, immediate, exclusive)
- * @param array $p
+ * @param array $params
*/
- public function __construct( array $p ) {
- if ( isset( $p['dbFilePath'] ) ) {
- $this->dbPath = $p['dbFilePath'];
- if ( !strlen( $p['dbname'] ) ) {
- $p['dbname'] = self::generateDatabaseName( $this->dbPath );
+ public function __construct( array $params ) {
+ if ( isset( $params['dbFilePath'] ) ) {
+ $this->dbPath = $params['dbFilePath'];
+ if ( !strlen( $params['dbname'] ) ) {
+ $params['dbname'] = self::generateDatabaseName( $this->dbPath );
}
- } elseif ( isset( $p['dbDirectory'] ) ) {
- $this->dbDir = $p['dbDirectory'];
+ } elseif ( isset( $params['dbDirectory'] ) ) {
+ $this->dbDir = $params['dbDirectory'];
}
- parent::__construct( $p );
+ parent::__construct( $params );
- $this->trxMode = strtoupper( $p['trxMode'] ?? '' );
+ $this->trxMode = strtoupper( $params['trxMode'] ?? '' );
$lockDirectory = $this->getLockFileDirectory();
if ( $lockDirectory !== null ) {
}
protected static function getAttributes() {
- return [ self::ATTR_DB_LEVEL_LOCKING => true ];
+ return [
+ self::ATTR_DB_IS_FILE => true,
+ self::ATTR_DB_LEVEL_LOCKING => true
+ ];
}
/**
return preg_match( '/^(:memory:$|file:(:memory:|[^?]+\?mode=memory(&|$)))/', $path );
}
- /**
- * Check if the searchindext table is FTS enabled.
- * @return bool False if not enabled.
- */
- public function checkForEnabledSearch() {
- if ( self::$fulltextEnabled === null ) {
- self::$fulltextEnabled = false;
- $table = $this->tableName( 'searchindex' );
- $res = $this->query(
- "SELECT sql FROM sqlite_master WHERE tbl_name = '$table'",
- __METHOD__,
- self::QUERY_IGNORE_DBO_TRX
- );
- if ( $res ) {
- $row = $res->fetchRow();
- self::$fulltextEnabled = stristr( $row['sql'], 'fts' ) !== false;
- }
- }
-
- return self::$fulltextEnabled;
- }
-
/**
* Returns version of currently supported SQLite fulltext search module or false if none present.
* @return string