MediaWiki REL1_29
SqliteUpdater.php
Go to the documentation of this file.
1<?php
25
33
34 protected function getCoreUpdateList() {
35 return [
36 [ 'disableContentHandlerUseDB' ],
37
38 // 1.14
39 [ 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ],
40 [ 'doActiveUsersInit' ],
41 [ 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ],
42 [ 'sqliteInitialIndexes' ],
43
44 // 1.15
45 [ 'addTable', 'change_tag', 'patch-change_tag.sql' ],
46 [ 'addTable', 'tag_summary', 'patch-tag_summary.sql' ],
47 [ 'addTable', 'valid_tag', 'patch-valid_tag.sql' ],
48
49 // 1.16
50 [ 'addTable', 'user_properties', 'patch-user_properties.sql' ],
51 [ 'addTable', 'log_search', 'patch-log_search.sql' ],
52 [ 'addField', 'logging', 'log_user_text', 'patch-log_user_text.sql' ],
53 # listed separately from the previous update because 1.16 was released without this update
54 [ 'doLogUsertextPopulation' ],
55 [ 'doLogSearchPopulation' ],
56 [ 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ],
57 [ 'addIndex', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ],
58 [ 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ],
59 [ 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ],
60 [ 'doUpdateTranscacheField' ],
61 [ 'sqliteSetupSearchindex' ],
62
63 // 1.17
64 [ 'addTable', 'iwlinks', 'patch-iwlinks.sql' ],
65 [ 'addIndex', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ],
66 [ 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ],
67 [ 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ],
68 [ 'dropIndex', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ],
69 [ 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ],
70 [ 'addTable', 'module_deps', 'patch-module_deps.sql' ],
71 [ 'dropIndex', 'archive', 'ar_page_revid', 'patch-archive_kill_ar_page_revid.sql' ],
72 [ 'addIndex', 'archive', 'ar_revid', 'patch-archive_ar_revid.sql' ],
73
74 // 1.18
75 [ 'addIndex', 'user', 'user_email', 'patch-user_email_index.sql' ],
76 [ 'addTable', 'uploadstash', 'patch-uploadstash.sql' ],
77 [ 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ],
78
79 // 1.19
80 [ 'addIndex', 'logging', 'type_action', 'patch-logging-type-action-index.sql' ],
81 [ 'doMigrateUserOptions' ],
82 [ 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ],
83 [ 'addField', 'revision', 'rev_sha1', 'patch-rev_sha1.sql' ],
84 [ 'addField', 'archive', 'ar_sha1', 'patch-ar_sha1.sql' ],
85 [ 'addIndex', 'page', 'page_redirect_namespace_len',
86 'patch-page_redirect_namespace_len.sql' ],
87 [ 'addField', 'uploadstash', 'us_chunk_inx', 'patch-uploadstash_chunk.sql' ],
88 [ 'addfield', 'job', 'job_timestamp', 'patch-jobs-add-timestamp.sql' ],
89
90 // 1.20
91 [ 'addIndex', 'revision', 'page_user_timestamp', 'patch-revision-user-page-index.sql' ],
92 [ 'addField', 'ipblocks', 'ipb_parent_block_id', 'patch-ipb-parent-block-id.sql' ],
93 [ 'addIndex', 'ipblocks', 'ipb_parent_block_id', 'patch-ipb-parent-block-id-index.sql' ],
94 [ 'dropField', 'category', 'cat_hidden', 'patch-cat_hidden.sql' ],
95
96 // 1.21
97 [ 'addField', 'revision', 'rev_content_format', 'patch-revision-rev_content_format.sql' ],
98 [ 'addField', 'revision', 'rev_content_model', 'patch-revision-rev_content_model.sql' ],
99 [ 'addField', 'archive', 'ar_content_format', 'patch-archive-ar_content_format.sql' ],
100 [ 'addField', 'archive', 'ar_content_model', 'patch-archive-ar_content_model.sql' ],
101 [ 'addField', 'page', 'page_content_model', 'patch-page-page_content_model.sql' ],
102 [ 'enableContentHandlerUseDB' ],
103
104 [ 'dropField', 'site_stats', 'ss_admins', 'patch-drop-ss_admins.sql' ],
105 [ 'dropField', 'recentchanges', 'rc_moved_to_title', 'patch-rc_moved.sql' ],
106 [ 'addTable', 'sites', 'patch-sites.sql' ],
107 [ 'addField', 'filearchive', 'fa_sha1', 'patch-fa_sha1.sql' ],
108 [ 'addField', 'job', 'job_token', 'patch-job_token.sql' ],
109 [ 'addField', 'job', 'job_attempts', 'patch-job_attempts.sql' ],
110 [ 'doEnableProfiling' ],
111 [ 'addField', 'uploadstash', 'us_props', 'patch-uploadstash-us_props.sql' ],
112 [ 'modifyField', 'user_groups', 'ug_group', 'patch-ug_group-length-increase-255.sql' ],
113 [ 'modifyField', 'user_former_groups', 'ufg_group',
114 'patch-ufg_group-length-increase-255.sql' ],
115 [ 'addIndex', 'page_props', 'pp_propname_page',
116 'patch-page_props-propname-page-index.sql' ],
117 [ 'addIndex', 'image', 'img_media_mime', 'patch-img_media_mime-index.sql' ],
118
119 // 1.22
120 [ 'addIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-iwlinks-from-title-index.sql' ],
121 [ 'addField', 'archive', 'ar_id', 'patch-archive-ar_id.sql' ],
122 [ 'addField', 'externallinks', 'el_id', 'patch-externallinks-el_id.sql' ],
123
124 // 1.23
125 [ 'addField', 'recentchanges', 'rc_source', 'patch-rc_source.sql' ],
126 [ 'addIndex', 'logging', 'log_user_text_type_time',
127 'patch-logging_user_text_type_time_index.sql' ],
128 [ 'addIndex', 'logging', 'log_user_text_time', 'patch-logging_user_text_time_index.sql' ],
129 [ 'addField', 'page', 'page_links_updated', 'patch-page_links_updated.sql' ],
130 [ 'addField', 'user', 'user_password_expires', 'patch-user_password_expire.sql' ],
131
132 // 1.24
133 [ 'addField', 'page_props', 'pp_sortkey', 'patch-pp_sortkey.sql' ],
134 [ 'dropField', 'recentchanges', 'rc_cur_time', 'patch-drop-rc_cur_time.sql' ],
135 [ 'addIndex', 'watchlist', 'wl_user_notificationtimestamp',
136 'patch-watchlist-user-notificationtimestamp-index.sql' ],
137 [ 'addField', 'page', 'page_lang', 'patch-page-page_lang.sql' ],
138 [ 'addField', 'pagelinks', 'pl_from_namespace', 'patch-pl_from_namespace.sql' ],
139 [ 'addField', 'templatelinks', 'tl_from_namespace', 'patch-tl_from_namespace.sql' ],
140 [ 'addField', 'imagelinks', 'il_from_namespace', 'patch-il_from_namespace.sql' ],
141
142 // 1.25
143 [ 'dropTable', 'hitcounter' ],
144 [ 'dropField', 'site_stats', 'ss_total_views', 'patch-drop-ss_total_views.sql' ],
145 [ 'dropField', 'page', 'page_counter', 'patch-drop-page_counter.sql' ],
146 [ 'modifyField', 'filearchive', 'fa_deleted_reason', 'patch-editsummary-length.sql' ],
147
148 // 1.27
149 [ 'dropTable', 'msg_resource_links' ],
150 [ 'dropTable', 'msg_resource' ],
151 [ 'addTable', 'bot_passwords', 'patch-bot_passwords.sql' ],
152 [ 'addField', 'watchlist', 'wl_id', 'patch-watchlist-wl_id.sql' ],
153 [ 'dropIndex', 'categorylinks', 'cl_collation', 'patch-kill-cl_collation_index.sql' ],
154 [ 'addIndex', 'categorylinks', 'cl_collation_ext',
155 'patch-add-cl_collation_ext_index.sql' ],
156 [ 'doCollationUpdate' ],
157
158 // 1.28
159 [ 'addIndex', 'recentchanges', 'rc_name_type_patrolled_timestamp',
160 'patch-add-rc_name_type_patrolled_timestamp_index.sql' ],
161 [ 'addField', 'change_tag', 'ct_id', 'patch-change_tag-ct_id.sql' ],
162 [ 'addField', 'tag_summary', 'ts_id', 'patch-tag_summary-ts_id.sql' ],
163
164 // 1.29
165 [ 'addField', 'externallinks', 'el_index_60', 'patch-externallinks-el_index_60.sql' ],
166 [ 'addField', 'user_groups', 'ug_expiry', 'patch-user_groups-ug_expiry.sql' ],
167 [ 'addIndex', 'image', 'img_user_timestamp', 'patch-image-user-index-2.sql' ],
168 ];
169 }
170
171 protected function sqliteInitialIndexes() {
172 // initial-indexes.sql fails if the indexes are already present,
173 // so we perform a quick check if our database is newer.
174 if ( $this->updateRowExists( 'initial_indexes' ) ||
175 $this->db->indexExists( 'user', 'user_name', __METHOD__ )
176 ) {
177 $this->output( "...have initial indexes\n" );
178
179 return;
180 }
181 $this->applyPatch( 'initial-indexes.sql', false, "Adding initial indexes" );
182 }
183
184 protected function sqliteSetupSearchindex() {
185 $module = DatabaseSqlite::getFulltextSearchModule();
186 $fts3tTable = $this->updateRowExists( 'fts3' );
187 if ( $fts3tTable && !$module ) {
188 $this->applyPatch(
189 'searchindex-no-fts.sql',
190 false,
191 'PHP is missing FTS3 support, downgrading tables'
192 );
193 } elseif ( !$fts3tTable && $module == 'FTS3' ) {
194 $this->applyPatch( 'searchindex-fts3.sql', false, "Adding FTS3 search capabilities" );
195 } else {
196 $this->output( "...fulltext search table appears to be in order.\n" );
197 }
198 }
199}
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Class for handling database updates.
updateRowExists( $key)
Helper function: check if the given key is present in the updatelog table.
applyPatch( $path, $isFullPath=false, $msg=null)
Applies a SQL patch.
Class for handling updates to Sqlite databases.
getCoreUpdateList()
Get an array of updates to perform on the database.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling output() to send it all. It could be easily changed to send incrementally if that becomes useful
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition injection.txt:37