* Fixed Oracle new installer support, broken by r80957. This is a minimal patch and...
[lhc/web/wiklou.git] / includes / installer / SqliteUpdater.php
1 <?php
2 /**
3 * Sqlite-specific updater.
4 *
5 * @file
6 * @ingroup Deployment
7 */
8
9 /**
10 * Class for handling updates to Sqlite databases.
11 *
12 * @ingroup Deployment
13 * @since 1.17
14 */
15 class SqliteUpdater extends DatabaseUpdater {
16
17 protected function getCoreUpdateList() {
18 return array(
19 // 1.14
20 array( 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
21 array( 'doActiveUsersInit' ),
22 array( 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
23 array( 'sqliteInitialIndexes' ),
24
25 // 1.15
26 array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),
27 array( 'addTable', 'tag_summary', 'patch-change_tag.sql' ),
28 array( 'addTable', 'valid_tag', 'patch-change_tag.sql' ),
29
30 // 1.16
31 array( 'addTable', 'user_properties', 'patch-user_properties.sql' ),
32 array( 'addTable', 'log_search', 'patch-log_search.sql' ),
33 array( 'doLogSearchPopulation' ),
34 array( 'addField', 'logging', 'log_user_text', 'patch-log_user_text.sql' ),
35 array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ),
36 array( 'addTable', 'external_user', 'patch-external_user.sql' ),
37 array( 'addIndex', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ),
38 array( 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
39 array( 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ),
40 array( 'doUpdateTranscacheField' ),
41 array( 'sqliteSetupSearchindex' ),
42
43 // 1.17
44 array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
45 array( 'addIndex', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ),
46 array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
47 array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
48 array( 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ),
49 array( 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ),
50 array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),
51 array( 'doCollationUpdate' ),
52 array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
53 array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
54 );
55 }
56
57 protected function sqliteInitialIndexes() {
58 // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer.
59 if ( $this->updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name' ) ) {
60 $this->output( "...have initial indexes\n" );
61 return;
62 }
63 $this->output( "Adding initial indexes..." );
64 $this->applyPatch( 'initial-indexes.sql' );
65 $this->output( "done\n" );
66 }
67
68 protected function sqliteSetupSearchindex() {
69 $module = $this->db->getFulltextSearchModule();
70 $fts3tTable = $this->updateRowExists( 'fts3' );
71 if ( $fts3tTable && !$module ) {
72 $this->output( '...PHP is missing FTS3 support, downgrading tables...' );
73 $this->applyPatch( 'searchindex-no-fts.sql' );
74 $this->output( "done\n" );
75 } elseif ( !$fts3tTable && $module == 'FTS3' ) {
76 $this->output( '...adding FTS3 search capabilities...' );
77 $this->applyPatch( 'searchindex-fts3.sql' );
78 $this->output( "done\n" );
79 } else {
80 $this->output( "...fulltext search table appears to be in order.\n" );
81 }
82 }
83 }