MediaWiki master
SqliteCreateSearchIndexTask.php
Go to the documentation of this file.
1<?php
2
4
7
14 public function getName() {
15 return 'search';
16 }
17
18 public function execute(): Status {
19 $status = Status::newGood();
21 $module = DatabaseSqlite::getFulltextSearchModule();
22 $searchIndexSql = (string)$db->newSelectQueryBuilder()
23 ->select( 'sql' )
24 ->from( 'sqlite_master' )
25 ->where( [ 'tbl_name' => $db->tableName( 'searchindex', 'raw' ) ] )
26 ->caller( __METHOD__ )->fetchField();
27 $fts3tTable = ( stristr( $searchIndexSql, 'fts' ) !== false );
28
29 if ( $fts3tTable && !$module ) {
30 $status->warning( 'config-sqlite-fts3-downgrade' );
31 $this->applySourceFile( $db, 'searchindex-no-fts.sql' );
32 } elseif ( !$fts3tTable && $module == 'FTS3' ) {
33 $this->applySourceFile( $db, 'searchindex-fts3.sql' );
34 }
35
36 return $status;
37 }
38
39}
Base class for installer tasks.
Definition Task.php:24
definitelyGetConnection(string $type)
Get a database connection, and throw if a connection could not be obtained.
Definition Task.php:214
applySourceFile(IMaintainableDatabase $conn, string $relPath)
Apply a SQL source file to the database as part of running an installation step.
Definition Task.php:229
Generic operation result class Has warning/error list, boolean status and arbitrary value.
Definition Status.php:54
This is the SQLite database abstraction layer.
const CONN_CREATE_TABLES
A connection with a role suitable for creating tables.