public function execute() { // Shouldn't be needed for Postgres $this->db = $this->getDB(DB_MASTER); if ($this->db->getType() == 'postgres') { $this->error("This script is not needed when using Postgres.\n", true); } if ($this->db->getType() == 'sqlite') { if (!DatabaseSqlite::getFulltextSearchModule()) { $this->error("Your version of SQLite module for PHP doesn't " . "support full-text search (FTS3).\n", true); } if (!$this->db->checkForEnabledSearch()) { $this->error("Your database schema is not configured for " . "full-text search support. Run update.php.\n", true); } } if ($this->db->getType() == 'mysql') { $this->dropMysqlTextIndex(); $this->clearSearchIndex(); $this->populateSearchIndex(); $this->createMysqlTextIndex(); } else { $this->clearSearchIndex(); $this->populateSearchIndex(); } $this->output("Done.\n"); }
protected function sqliteSetupSearchindex() { $module = DatabaseSqlite::getFulltextSearchModule(); $fts3tTable = $this->updateRowExists('fts3'); if ($fts3tTable && !$module) { $this->applyPatch('searchindex-no-fts.sql', false, 'PHP is missing FTS3 support, downgrading tables'); } elseif (!$fts3tTable && $module == 'FTS3') { $this->applyPatch('searchindex-fts3.sql', false, "Adding FTS3 search capabilities"); } else { $this->output("...fulltext search table appears to be in order.\n"); } }
/** * @param $status Status * @return Status */ public function setupSearchIndex(&$status) { global $IP; $module = DatabaseSqlite::getFulltextSearchModule(); $fts3tTable = $this->db->checkForEnabledSearch(); if ($fts3tTable && !$module) { $status->warning('config-sqlite-fts3-downgrade'); $this->db->sourceFile("{$IP}/maintenance/sqlite/archives/searchindex-no-fts.sql"); } elseif (!$fts3tTable && $module == 'FTS3') { $this->db->sourceFile("{$IP}/maintenance/sqlite/archives/searchindex-fts3.sql"); } return $status; }
/** * Environment check for DB types. */ protected function envCheckDB() { global $wgLang; $allNames = array(); foreach (self::getDBTypes() as $name) { $allNames[] = wfMsg("config-type-{$name}"); } if (!$this->getVar('_CompiledDBs')) { $this->showError('config-no-db', $wgLang->commaList($allNames)); // @todo FIXME: This only works for the web installer! return false; } // Check for FTS3 full-text search module $sqlite = $this->getDBInstaller('sqlite'); if ($sqlite->isCompiled()) { if (DatabaseSqlite::getFulltextSearchModule() != 'FTS3') { $this->showMessage('config-no-fts3'); } } }