36 [
'addField',
'revision',
'rev_actor',
'patch-revision-rev_actor.sql' ],
39 [
'addField',
'image',
'img_description_id',
'patch-image-img_description_id.sql' ],
40 [
'migrateComments' ],
42 [
'addTable',
'slots',
'patch-slots.sql' ],
43 [
'addField',
'slots',
'slot_origin',
'patch-slot-origin.sql' ],
44 [
'addTable',
'content',
'patch-content.sql' ],
45 [
'addTable',
'slot_roles',
'patch-slot_roles.sql' ],
46 [
'addTable',
'content_models',
'patch-content_models.sql' ],
47 [
'migrateArchiveText' ],
48 [
'addTable',
'actor',
'patch-actor-table.sql' ],
49 [
'addField',
'archive',
'ar_actor',
'patch-archive-ar_actor.sql' ],
50 [
'addField',
'ipblocks',
'ipb_by_actor',
'patch-ipblocks-ipb_by_actor.sql' ],
51 [
'addField',
'image',
'img_actor',
'patch-image-img_actor.sql' ],
52 [
'addField',
'oldimage',
'oi_actor',
'patch-oldimage-oi_actor.sql' ],
53 [
'addField',
'filearchive',
'fa_actor',
'patch-filearchive-fa_actor.sql' ],
54 [
'addField',
'recentchanges',
'rc_actor',
'patch-recentchanges-rc_actor.sql' ],
55 [
'addField',
'logging',
'log_actor',
'patch-logging-log_actor.sql' ],
61 [
'setDefault',
'revision',
'rev_text_id', 0 ],
62 [
'modifyTable',
'site_stats',
'patch-site_stats-modify.sql' ],
63 [
'populateArchiveRevId' ],
64 [
'addIndex',
'recentchanges',
'rc_namespace_title_timestamp',
65 'patch-recentchanges-nttindex.sql' ],
68 [
'addTable',
'change_tag_def',
'patch-change_tag_def.sql' ],
69 [
'populateExternallinksIndex60' ],
70 [
'dropDefault',
'externallinks',
'el_index_60' ],
71 [
'runMaintenance', DeduplicateArchiveRevId::class ],
72 [
'addField',
'change_tag',
'ct_tag_id',
'patch-change_tag-tag_id.sql' ],
73 [
'addIndex',
'archive',
'ar_revid_uniq',
'patch-archive-ar_rev_id-unique.sql' ],
74 [
'populateContentTables' ],
75 [
'addIndex',
'logging',
'log_type_action',
'patch-logging-log-type-action-index.sql' ],
76 [
'dropIndex',
'logging',
'type_action',
'patch-logging-drop-type-action-index.sql' ],
77 [
'renameIndex',
'interwiki',
'iw_prefix',
'PRIMARY',
false,
'patch-interwiki-fix-pk.sql' ],
78 [
'renameIndex',
'page_props',
'pp_page_propname',
'PRIMARY',
false,
79 'patch-page_props-fix-pk.sql' ],
80 [
'renameIndex',
'protected_titles',
'pt_namespace_title',
'PRIMARY',
false,
81 'patch-protected_titles-fix-pk.sql' ],
82 [
'renameIndex',
'site_identifiers',
'site_ids_type',
'PRIMARY',
false,
83 'patch-site_identifiers-fix-pk.sql' ],
84 [
'addIndex',
'recentchanges',
'rc_this_oldid',
'patch-recentchanges-rc_this_oldid-index.sql' ],
85 [
'dropTable',
'transcache' ],
86 [
'runMaintenance', PopulateChangeTagDef::class ],
87 [
'dropIndex',
'change_tag',
'change_tag_rc_tag',
'patch-change_tag-change_tag_rc_tag_id.sql' ],
88 [
'addField',
'ipblocks',
'ipb_sitewide',
'patch-ipb_sitewide.sql' ],
89 [
'addTable',
'ipblocks_restrictions',
'patch-ipblocks_restrictions-table.sql' ],
90 [
'migrateImageCommentTemp' ],
93 [
'dropField',
'change_tag',
'ct_tag',
'patch-drop-ct_tag.sql' ],
94 [
'dropTable',
'valid_tag' ],
95 [
'dropTable',
'tag_summary' ],
96 [
'dropField',
'archive',
'ar_comment',
'patch-archive-drop-ar_comment.sql' ],
97 [
'dropField',
'ipblocks',
'ipb_reason',
'patch-ipblocks-drop-ipb_reason.sql' ],
98 [
'dropField',
'image',
'img_description',
'patch-image-drop-img_description.sql' ],
99 [
'dropField',
'oldimage',
'oi_description',
'patch-oldimage-drop-oi_description.sql' ],
100 [
'dropField',
'filearchive',
'fa_description',
'patch-filearchive-drop-fa_description.sql' ],
101 [
'dropField',
'recentchanges',
'rc_comment',
'patch-recentchanges-drop-rc_comment.sql' ],
102 [
'dropField',
'logging',
'log_comment',
'patch-logging-drop-log_comment.sql' ],
103 [
'dropField',
'protected_titles',
'pt_reason',
'patch-protected_titles-drop-pt_reason.sql' ],
104 [
'modifyTable',
'job',
'patch-job-params-mediumblob.sql' ],
107 [
'dropIndex',
'archive',
'ar_usertext_timestamp',
108 'patch-drop-archive-ar_usertext_timestamp.sql' ],
109 [
'dropIndex',
'archive',
'usertext_timestamp',
'patch-drop-archive-usertext_timestamp.sql' ],
110 [
'dropField',
'archive',
'ar_user',
'patch-drop-archive-user-fields.sql' ],
111 [
'dropField',
'ipblocks',
'ip_by',
'patch-drop-ipblocks-user-fields.sql' ],
112 [
'dropIndex',
'image',
'img_user_timestamp',
'patch-drop-image-img_user_timestamp.sql' ],
113 [
'dropField',
'image',
'img_user',
'patch-drop-image-user-fields.sql' ],
114 [
'dropField',
'oldimage',
'oi_user',
'patch-drop-oldimage-user-fields.sql' ],
115 [
'dropField',
'filearchive',
'fa_user',
'patch-drop-filearchive-user-fields.sql' ],
116 [
'dropField',
'recentchanges',
'rc_user',
'patch-drop-recentchanges-user-fields.sql' ],
117 [
'dropField',
'logging',
'log_user',
'patch-drop-logging-user-fields.sql' ],
118 [
'addIndex',
'user_newtalk',
'un_user_ip',
'patch-rename-mysql-user_newtalk-indexes.sql' ],
121 [
'addTable',
'watchlist_expiry',
'patch-watchlist_expiry.sql' ],
122 [
'modifyField',
'page',
'page_restrictions',
'patch-page_restrictions-null.sql' ],
123 [
'renameIndex',
'ipblocks',
'ipb_address',
'ipb_address_unique',
false,
124 'patch-ipblocks-rename-ipb_address.sql' ],
125 [
'dropField',
'revision',
'rev_user',
'patch-revision-actor-comment-MCR.sql' ],
126 [
'dropField',
'archive',
'ar_text_id',
'patch-archive-MCR.sql' ],
127 [
'doLanguageLinksLengthSync' ],
128 [
'doFixIpbAddressUniqueIndex' ],
129 [
'modifyField',
'actor',
'actor_name',
'patch-actor-actor_name-varbinary.sql' ],
130 [
'modifyField',
'sites',
'site_global_key',
'patch-sites-site_global_key.sql' ],
131 [
'modifyField',
'iwlinks',
'iwl_prefix',
'patch-extend-iwlinks-iwl_prefix.sql' ],
134 [
'modifyField',
'redirect',
'rd_title',
'patch-redirect-rd_title-varbinary.sql' ],
135 [
'modifyField',
'pagelinks',
'pl_title',
'patch-pagelinks-pl_title-varbinary.sql' ],
136 [
'modifyField',
'templatelinks',
'tl_title',
'patch-templatelinks-tl_title-varbinary.sql' ],
137 [
'modifyField',
'imagelinks',
'il_to',
'patch-imagelinks-il_to-varbinary.sql' ],
138 [
'modifyField',
'langlinks',
'll_title',
'patch-langlinks-ll_title-varbinary.sql' ],
139 [
'modifyField',
'iwlinks',
'iwl_title',
'patch-iwlinks-iwl_title-varbinary.sql' ],
140 [
'modifyField',
'category',
'cat_title',
'patch-category-cat_title-varbinary.sql' ],
141 [
'modifyField',
'querycache',
'qc_title',
'patch-querycache-qc_title-varbinary.sql' ],
142 [
'modifyField',
'querycachetwo',
'qcc_title',
'patch-querycachetwo-qcc_title-varbinary.sql' ],
143 [
'modifyField',
'watchlist',
'wl_title',
'patch-watchlist-wl_title-varbinary.sql' ],
144 [
'modifyField',
'user_newtalk',
'user_last_timestamp',
145 'patch-user_newtalk-user_last_timestamp-binary.sql'
147 [
'modifyField',
'protected_titles',
'pt_title',
'patch-protected_titles-pt_title-varbinary.sql' ],
148 [
'dropDefault',
'protected_titles',
'pt_expiry' ],
149 [
'dropDefault',
'ip_changes',
'ipc_rev_timestamp' ],
150 [
'modifyField',
'ipblocks_restrictions',
'ir_type',
'patch-ipblocks_restrictions-ir_type.sql' ],
151 [
'renameIndex',
'watchlist',
'namespace_title',
'wl_namespace_title',
false,
152 'patch-watchlist-namespace_title-rename-index.sql' ],
153 [
'modifyField',
'job',
'job_title',
'patch-job-job_title-varbinary.sql' ],
154 [
'modifyField',
'job',
'job_timestamp',
'patch-job_job_timestamp.sql' ],
155 [
'modifyField',
'job',
'job_token_timestamp',
'patch-job_job_token_timestamp.sql' ],
156 [
'modifyField',
'watchlist',
'wl_notificationtimestamp',
'patch-watchlist-wl_notificationtimestamp.sql' ],
157 [
'modifyField',
'slot_roles',
'role_id',
'patch-slot_roles-role_id.sql' ],
158 [
'modifyField',
'content_models',
'model_id',
'patch-content_models-model_id.sql' ],
159 [
'modifyField',
'categorylinks',
'cl_to',
'patch-categorylinks-cl_to-varbinary.sql' ],
160 [
'modifyField',
'logging',
'log_title',
'patch-logging-log_title-varbinary.sql' ],
161 [
'modifyField',
'uploadstash',
'us_timestamp',
'patch-uploadstash-us_timestamp.sql' ],
162 [
'renameIndex',
'user_properties',
'user_properties_property',
'up_property',
false,
163 'patch-user_properties-rename-index.sql' ],
164 [
'renameIndex',
'sites',
'sites_global_key',
'site_global_key',
false,
'patch-sites-rename-indexes.sql' ],
165 [
'renameIndex',
'logging',
'type_time',
'log_type_time',
false,
'patch-logging-rename-indexes.sql' ],
166 [
'modifyField',
'filearchive',
'fa_name',
'patch-filearchive-fa_name.sql' ],
167 [
'dropDefault',
'filearchive',
'fa_deleted_timestamp' ],
168 [
'dropDefault',
'filearchive',
'fa_timestamp' ],
169 [
'modifyField',
'oldimage',
'oi_name',
'patch-oldimage-oi_name-varbinary.sql' ],
170 [
'dropDefault',
'oldimage',
'oi_timestamp' ],
171 [
'modifyField',
'objectcache',
'exptime',
'patch-objectcache-exptime-notnull.sql' ],
172 [
'dropDefault',
'ipblocks',
'ipb_timestamp' ],
173 [
'dropDefault',
'ipblocks',
'ipb_expiry' ],
174 [
'renameIndex',
'archive',
'name_title_timestamp',
'ar_name_title_timestamp',
false,
175 'patch-archive-rename-name_title_timestamp-index.sql' ],
176 [
'modifyField',
'image',
'img_name',
'patch-image-img_name-varbinary.sql' ],
177 [
'dropDefault',
'image',
'img_timestamp' ],
178 [
'modifyField',
'image',
'img_timestamp',
'patch-image-img_timestamp.sql' ],
179 [
'renameIndex',
'site_identifiers',
'site_ids_key',
'si_key',
false,
180 'patch-site_identifiers-rename-indexes.sql' ],
181 [
'modifyField',
'recentchanges',
'rc_title',
'patch-recentchanges-rc_title-varbinary.sql' ],
182 [
'dropDefault',
'recentchanges',
'rc_timestamp' ],
183 [
'modifyField',
'recentchanges',
'rc_timestamp',
'patch-recentchanges-rc_timestamp.sql' ],
184 [
'modifyField',
'recentchanges',
'rc_id',
'patch-recentchanges-rc_id.sql' ],
185 [
'renameIndex',
'recentchanges',
'new_name_timestamp',
'rc_new_name_timestamp',
false,
186 'patch-recentchanges-rc_new_name_timestamp.sql' ],
187 [
'dropDefault',
'archive',
'ar_timestamp' ],
188 [
'modifyField',
'archive',
'ar_title',
'patch-archive-ar_title-varbinary.sql' ],
189 [
'modifyField',
'page',
'page_title',
'patch-page-page_title-varbinary.sql' ],
190 [
'dropDefault',
'page',
'page_touched' ],
191 [
'modifyField',
'user',
'user_name',
'patch-user_table-updates.sql' ],
194 [
'renameIndex',
'revision',
'page_timestamp',
'rev_page_timestamp',
false,
195 'patch-revision-rename-index.sql' ],
196 [
'addField',
'objectcache',
'modtoken',
'patch-objectcache-modtoken.sql' ],
197 [
'dropDefault',
'revision',
'rev_timestamp' ],
198 [
'addIndex',
'oldimage',
'oi_timestamp',
'patch-oldimage-oi_timestamp.sql' ],
199 [
'renameIndex',
'page',
'name_title',
'page_name_title',
false,
'patch-page-rename-name_title-index.sql' ],
200 [
'renameIndex',
'change_tag',
'change_tag_rc_tag_id',
'ct_rc_tag_id',
false,
201 'patch-change_tag-rename-indexes.sql' ],
204 [
'doConvertDjvuMetadata' ],
205 [
'dropField',
'page_restrictions',
'pr_user',
'patch-drop-page_restrictions-pr_user.sql' ],
206 [
'modifyField',
'filearchive',
'fa_id',
'patch-filearchive-fa_id.sql' ],
207 [
'modifyField',
'image',
'img_major_mime',
'patch-image-img_major_mime-default.sql' ],
208 [
'addTable',
'linktarget',
'patch-linktarget.sql' ],
209 [
'dropIndex',
'revision',
'rev_page_id',
'patch-drop-rev_page_id.sql' ],
210 [
'modifyField',
'page_restrictions',
'pr_page',
'patch-page_restrictions-pr_page.sql' ],
211 [
'modifyField',
'page_props',
'pp_page',
'patch-page_props-pp_page.sql' ],
212 [
'modifyField',
'ipblocks_restrictions',
'ir_value',
'patch-ipblocks_restrictions-ir_value.sql' ],
213 [
'addField',
'templatelinks',
'tl_target_id',
'patch-templatelinks-target_id.sql' ],
216 [
'addTable',
'user_autocreate_serial',
'patch-user_autocreate_serial.sql' ],
217 [
'modifyField',
'ipblocks_restrictions',
'ir_ipb_id',
'patch-ipblocks_restrictions-ir_ipb_id.sql' ],
218 [
'modifyField',
'ipblocks',
'ipb_id',
'patch-ipblocks-ipb_id.sql' ],
219 [
'modifyField',
'user',
'user_editcount',
'patch-user-user_editcount.sql' ],
220 [
'runMaintenance', MigrateRevisionActorTemp::class ],
221 [
'dropTable',
'revision_actor_temp' ],
222 [
'runMaintenance', UpdateRestrictions::class ],
223 [
'dropField',
'page',
'page_restrictions',
'patch-page-drop-page_restrictions.sql' ],
224 [
'migrateTemplatelinks' ],
225 [
'modifyField',
'templatelinks',
'tl_namespace',
'patch-templatelinks-tl_title-nullable.sql' ],
226 [
'dropField',
'templatelinks',
'tl_title',
'patch-templatelinks-drop-tl_title.sql' ],
239 protected function checkBin( $table, $field, $patchFile ) {
240 if ( !$this->
doTable( $table ) ) {
245 $fieldInfo = $this->db->fieldInfo( $table, $field );
246 if ( $fieldInfo->isBinary() ) {
247 $this->
output(
"...$table table has correct $field encoding.\n" );
249 $this->
applyPatch( $patchFile,
false,
"Fixing $field encoding on $table table" );
262 $info = $this->db->indexInfo( $table, $index, __METHOD__ );
264 foreach ( $info as $row ) {
265 if ( $row->Column_name == $field ) {
266 $this->
output(
"...index $index on table $table includes field $field.\n" );
271 $this->
output(
"...index $index on table $table has no field $field; added.\n" );
278 [
'table' =>
'l10n_cache',
'field' =>
'lc_lang',
'file' =>
'patch-l10n_cache-lc_lang-35.sql' ],
279 [
'table' =>
'langlinks',
'field' =>
'll_lang',
'file' =>
'patch-langlinks-ll_lang-35.sql' ],
280 [
'table' =>
'sites',
'field' =>
'site_language',
'file' =>
'patch-sites-site_language-35.sql' ],
283 foreach ( $sync as
$s ) {
284 $table = $this->db->tableName(
$s[
'table'] );
285 $field =
$s[
'field'];
286 $res = $this->db->query(
"SHOW COLUMNS FROM $table LIKE '$field'", __METHOD__ );
287 $row =
$res->fetchObject();
289 if ( $row && $row->Type !==
"varbinary(35)" ) {
293 "Updating length of $field in $table"
296 $this->
output(
"...$field is up-to-date.\n" );
302 if ( !$this->
doTable(
'ipblocks' ) ) {
306 if ( !$this->
indexHasField(
'ipblocks',
'ipb_address_unique',
'ipb_anon_only' ) ) {
307 $this->
output(
"...ipb_address_unique index up-to-date.\n" );
312 'patch-ipblocks-fix-ipb_address_unique.sql',
314 'Removing ipb_anon_only column from ipb_address_unique index'
323 $vars[
'wgDBTableOptions'] = str_replace(
326 $vars[
'wgDBTableOptions']
340 $updateKey =
"$table-$field-dropDefault";
346 $info = $this->db->fieldInfo( $table, $field );
347 if ( $info && $info->defaultValue() !==
false ) {
348 $this->
output(
"Removing '$table.$field' default value.\n" );
349 $table = $this->db->tableName( $table );
350 $ret = $this->db->query(
"ALTER TABLE $table ALTER COLUMN $field DROP DEFAULT", __METHOD__ );
367 $info = $this->db->fieldInfo( $table, $field );
368 if ( $info && $info->defaultValue() !== $default ) {
369 $this->
output(
"Changing '$table.$field' default value.\n" );
370 $table = $this->db->tableName( $table );
372 "ALTER TABLE $table ALTER COLUMN $field SET DEFAULT "
373 . $this->db->addQuotes( $default ), __METHOD__
Class for handling database updates.
updateRowExists( $key)
Helper function: check if the given key is present in the updatelog table.
output( $str)
Output some text.
insertUpdateRow( $key, $val=null)
Helper function: Add a key to the updatelog table.
applyPatch( $path, $isFullPath=false, $msg=null)
Applies a SQL patch.
doTable( $name)
Returns whether updates should be executed on the database table $name.
dropDefault( $table, $field)
Drop a default value from a field.
getSchemaVars()
Get appropriate schema variables in the current database connection.
setDefault( $table, $field, $default)
Set a default value for a field.
checkBin( $table, $field, $patchFile)
MW 1.4 betas were missing the 'binary' marker from logging.log_title, which caused a MySQL collation ...
getCoreUpdateList()
Get an array of updates to perform on the database.
indexHasField( $table, $index, $field)
Check whether an index contain a field.
doLanguageLinksLengthSync()
doFixIpbAddressUniqueIndex()
$wgDBTableOptions
Config variable stub for the DBTableOptions setting, for use by phpdoc and IDEs.
foreach( $mmfl['setupFiles'] as $fileName) if($queue) if(empty( $mmfl['quiet'])) $s