MediaWiki master
SqliteUpdater.php
Go to the documentation of this file.
1<?php
2
25namespace MediaWiki\Installer;
26
33
42
43 protected function getCoreUpdateList() {
44 return [
45 // 1.36
46 [ 'modifyField', 'content', 'content_id', 'patch-content-content_id-fix_not_null.sql' ],
47 [ 'modifyField', 'redirect', 'rd_title', 'patch-redirect-rd_title-varbinary.sql' ],
48 [ 'modifyField', 'pagelinks', 'pl_title', 'patch-pagelinks-pl_title-varbinary.sql' ],
49 [ 'modifyField', 'templatelinks', 'tl_title', 'patch-templatelinks-tl_title-varbinary.sql' ],
50 [ 'modifyField', 'imagelinks', 'il_to', 'patch-imagelinks-il_to-varbinary.sql' ],
51 [ 'modifyField', 'langlinks', 'll_title', 'patch-langlinks-ll_title-varbinary.sql' ],
52 [ 'modifyField', 'iwlinks', 'iwl_title', 'patch-iwlinks-iwl_title-varbinary.sql' ],
53 [ 'modifyField', 'category', 'cat_title', 'patch-category-cat_title-varbinary.sql' ],
54 [ 'modifyField', 'querycache', 'qc_title', 'patch-querycache-qc_title-varbinary.sql' ],
55 [ 'modifyField', 'querycachetwo', 'qcc_title', 'patch-querycachetwo-qcc_title-varbinary.sql' ],
56 [ 'modifyField', 'watchlist', 'wl_title', 'patch-watchlist-wl_title-varbinary.sql' ],
57 [ 'modifyField', 'protected_titles', 'pt_title', 'patch-protected_titles-pt_title-varbinary.sql' ],
58 [ 'modifyField', 'protected_titles', 'pt_expiry', 'patch-protected_titles-pt_expiry-drop-default.sql' ],
59 [ 'modifyField', 'ip_changes', 'ipc_rev_timestamp', 'patch-ip_changes-pc_rev_timestamp-drop-default.sql' ],
60 [ 'renameIndex', 'watchlist', 'namespace_title', 'wl_namespace_title', false,
61 'patch-watchlist-namespace_title-rename-index.sql' ],
62 [ 'modifyField', 'job', 'job_title', 'patch-job-job_title-varbinary.sql' ],
63 [ 'modifyField', 'slot_roles', 'role_id', 'patch-slot_roles-role_id-fix_not_null.sql' ],
64 [ 'modifyField', 'content_models', 'model_id', 'patch-content_models-model_id-fix_not_null.sql' ],
65 [ 'modifyField', 'categorylinks', 'cl_to', 'patch-categorylinks-cl_to-varbinary.sql' ],
66 [ 'modifyField', 'logging', 'log_title', 'patch-logging-log_title-varbinary.sql' ],
67 [ 'renameIndex', 'user_properties', 'user_properties_property', 'up_property', false,
68 'patch-user_properties-rename-index.sql' ],
69 [ 'renameIndex', 'sites', 'sites_global_key', 'site_global_key', false, 'patch-sites-rename-indexes.sql' ],
70 [ 'renameIndex', 'logging', 'type_time', 'log_type_time', false, 'patch-logging-rename-indexes.sql' ],
71 [ 'modifyField', 'filearchive', 'fa_name', 'patch-filearchive-fa_name.sql' ],
72 [ 'modifyField', 'oldimage', 'oi_name', 'patch-oldimage-oi_name-varbinary.sql' ],
73 [ 'modifyField', 'objectcache', 'exptime', 'patch-objectcache-exptime-notnull.sql' ],
74 [ 'modifyField', 'ipblocks', 'ipb_timestamp', 'patch-ipblocks-ipb_timestamp-drop-default.sql' ],
75 [ 'renameIndex', 'archive', 'name_title_timestamp', 'ar_name_title_timestamp', false,
76 'patch-archive-rename-name_title_timestamp-index.sql' ],
77 [ 'modifyField', 'image', 'img_name', 'patch-image-img_name-varbinary.sql' ],
78 [ 'renameIndex', 'site_identifiers', 'site_ids_key', 'si_key', false,
79 'patch-site_identifiers-rename-indexes.sql' ],
80 [ 'modifyField', 'recentchanges', 'rc_title', 'patch-recentchanges-rc_title-varbinary.sql' ],
81 [ 'renameIndex', 'recentchanges', 'new_name_timestamp', 'rc_new_name_timestamp', false,
82 'patch-recentchanges-rc_new_name_timestamp.sql' ],
83 [ 'modifyField', 'archive', 'ar_title', 'patch-archive-ar_title-varbinary.sql' ],
84 [ 'modifyField', 'page', 'page_title', 'patch-page-page_title-varbinary.sql' ],
85 [ 'modifyField', 'user', 'user_name', 'patch-user_table-updates.sql' ],
86
87 // 1.37
88 [ 'renameIndex', 'revision', 'page_timestamp', 'rev_page_timestamp', false,
89 'patch-revision-rename-index.sql' ],
90 [ 'addField', 'objectcache', 'modtoken', 'patch-objectcache-modtoken.sql' ],
91 [ 'modifyField', 'revision', 'rev_timestamp', 'patch-revision-rev_timestamp-drop-default.sql' ],
92 [ 'addIndex', 'oldimage', 'oi_timestamp', 'patch-oldimage-oi_timestamp.sql' ],
93 [ 'renameIndex', 'page', 'name_title', 'page_name_title', false,
94 'patch-page-rename-name_title-index.sql' ],
95 [ 'renameIndex', 'change_tag', 'change_tag_rc_tag_id', 'ct_rc_tag_id', false,
96 'patch-change_tag-rename-indexes.sql' ],
97
98 // 1.38
99 [ 'doConvertDjvuMetadata' ],
100 [ 'dropField', 'page_restrictions', 'pr_user', 'patch-drop-page_restrictions-pr_user.sql' ],
101 [ 'addTable', 'linktarget', 'patch-linktarget.sql' ],
102 [ 'dropIndex', 'revision', 'rev_page_id', 'patch-drop-rev_page_id.sql' ],
103 [ 'modifyField', 'page_restrictions', 'pr_page', 'patch-page_restrictions-pr_page.sql' ],
104 [ 'modifyField', 'page_props', 'pp_page', 'patch-page_props-pp_page.sql' ],
105 [ 'modifyField', 'ipblocks_restrictions', 'ir_value', 'patch-ipblocks_restrictions-ir_value.sql' ],
106 [ 'addField', 'templatelinks', 'tl_target_id', 'patch-templatelinks-target_id.sql' ],
107
108 // 1.39
109 [ 'addTable', 'user_autocreate_serial', 'patch-user_autocreate_serial.sql' ],
110 [ 'modifyField', 'ipblocks_restrictions', 'ir_ipb_id', 'patch-ipblocks_restrictions-ir_ipb_id.sql' ],
111 [ 'modifyField', 'ipblocks', 'ipb_id', 'patch-ipblocks-ipb_id.sql' ],
112 [ 'modifyField', 'user', 'user_editcount', 'patch-user-user_editcount.sql' ],
113 [ 'runMaintenance', MigrateRevisionActorTemp::class, 'maintenance/migrateRevisionActorTemp.php' ],
114 [ 'dropTable', 'revision_actor_temp' ],
115 [ 'runMaintenance', UpdateRestrictions::class, 'maintenance/updateRestrictions.php' ],
116 [ 'dropField', 'page', 'page_restrictions', 'patch-page-drop-page_restrictions.sql' ],
117 [ 'migrateTemplatelinks' ],
118 [ 'modifyField', 'templatelinks', 'tl_namespace', 'patch-templatelinks-tl_title-nullable.sql' ],
119 [ 'dropField', 'templatelinks', 'tl_title', 'patch-templatelinks-drop-tl_title.sql' ],
120
121 // 1.40
122 [ 'addField', 'externallinks', 'el_to_path', 'patch-externallinks-el_to_path.sql' ],
123
124 // 1.41
125 [ 'addField', 'user', 'user_is_temp', 'patch-user-user_is_temp.sql' ],
126 [ 'runMaintenance', MigrateRevisionCommentTemp::class, 'maintenance/migrateRevisionCommentTemp.php' ],
127 [ 'dropTable', 'revision_comment_temp' ],
128 [ 'runMaintenance', MigrateExternallinks::class, 'maintenance/migrateExternallinks.php' ],
129 [ 'modifyField', 'externallinks', 'el_to', 'patch-externallinks-el_to_default.sql' ],
130 [ 'addField', 'pagelinks', 'pl_target_id', 'patch-pagelinks-target_id.sql' ],
131 [ 'dropField', 'externallinks', 'el_to', 'patch-externallinks-drop-el_to.sql' ],
132 [ 'runMaintenance', FixInconsistentRedirects::class, 'maintenance/fixInconsistentRedirects.php' ],
133 [ 'modifyField', 'image', 'img_size', 'patch-image-img_size_to_bigint.sql' ],
134 [ 'modifyField', 'filearchive', 'fa_size', 'patch-filearchive-fa_size_to_bigint.sql' ],
135 [ 'modifyField', 'oldimage', 'oi_size', 'patch-oldimage-oi_size_to_bigint.sql' ],
136 [ 'modifyField', 'uploadstash', 'us_size', 'patch-uploadstash-us_size_to_bigint.sql' ],
137
138 // 1.42
139 [ 'addField', 'user_autocreate_serial', 'uas_year', 'patch-user_autocreate_serial-uas_year.sql' ],
140 [ 'addTable', 'block_target', 'patch-block_target.sql' ],
141 [ 'dropIndex', 'categorylinks', 'cl_collation_ext', 'patch-drop-cl_collation_ext.sql' ],
142 [ 'runMaintenance', PopulateUserIsTemp::class, 'maintenance/populateUserIsTemp.php' ],
143 [ 'dropIndex', 'sites', 'site_type', 'patch-sites-drop_indexes.sql' ],
144 [ 'dropIndex', 'iwlinks', 'iwl_prefix_from_title', 'patch-iwlinks-drop-iwl_prefix_from_title.sql' ],
145
146 // 1.43
147 [ 'migratePagelinks' ],
148 [ 'modifyField', 'revision', 'rev_id', 'patch-revision-cleanup.sql' ],
149 [ 'modifyField', 'change_tag', 'ct_rc_id', 'patch-change_tag-ct_rc_id.sql' ],
150 ];
151 }
152
161 protected function indexHasField( $table, $index, $field ) {
162 $info = $this->db->indexInfo( $table, $index, __METHOD__ );
163 if ( $info ) {
164 foreach ( $info as $column ) {
165 if ( $column == $field ) {
166 $this->output( "...index $index on table $table includes field $field.\n" );
167 return true;
168 }
169 }
170 }
171 $this->output( "...index $index on table $table has no field $field; added.\n" );
172
173 return false;
174 }
175}
Fix redirect pages with missing or incomplete row in the redirect table.
Class for handling database updates.
indexHasField( $table, $index, $field)
Check whether an index contains a field.
getCoreUpdateList()
Get an array of updates to perform on the database.
Maintenance script that merges the revision_actor_temp table into the revision table.
Maintenance script that merges the revision_comment_temp table into the revision table.
Maintenance script that Fills the user_is_temp column of the user table for users created before MW 1...
Maintenance script that updates page_restrictions table from old page_restriction column.