MediaWiki REL1_40
SqliteUpdater.php
Go to the documentation of this file.
1<?php
32
33 protected function getCoreUpdateList() {
34 return [
35 // 1.35
36 [ 'addField', 'revision', 'rev_actor', 'patch-revision-actor-comment-MCR.sql' ],
37 [ 'addTable', 'watchlist_expiry', 'patch-watchlist_expiry.sql' ],
38 [ 'modifyfield', 'filearchive', 'fa_actor', 'patch-filearchive-drop-fa_actor-DEFAULT.sql' ],
39 [ 'modifyfield', 'recentchanges', 'rc_actor', 'patch-recentchanges-drop-rc_actor-DEFAULT.sql' ],
40 [ 'modifyfield', 'logging', 'log_actor', 'patch-logging-drop-log_actor-DEFAULT.sql' ],
41 [ 'modifyField', 'page', 'page_restrictions', 'patch-page_restrictions-null.sql' ],
42 [ 'renameIndex', 'ipblocks', 'ipb_address', 'ipb_address_unique', false,
43 'patch-ipblocks-rename-ipb_address.sql' ],
44 [ 'dropField', 'archive', 'ar_text_id', 'patch-archive-MCR.sql' ],
45 [ 'doFixIpbAddressUniqueIndex' ],
46 [ 'modifyField', 'actor', 'actor_name', 'patch-actor-actor_name-varbinary.sql' ],
47
48 // 1.36
49 [ 'modifyField', 'content', 'content_id', 'patch-content-content_id-fix_not_null.sql' ],
50 [ 'modifyField', 'redirect', 'rd_title', 'patch-redirect-rd_title-varbinary.sql' ],
51 [ 'modifyField', 'pagelinks', 'pl_title', 'patch-pagelinks-pl_title-varbinary.sql' ],
52 [ 'modifyField', 'templatelinks', 'tl_title', 'patch-templatelinks-tl_title-varbinary.sql' ],
53 [ 'modifyField', 'imagelinks', 'il_to', 'patch-imagelinks-il_to-varbinary.sql' ],
54 [ 'modifyField', 'langlinks', 'll_title', 'patch-langlinks-ll_title-varbinary.sql' ],
55 [ 'modifyField', 'iwlinks', 'iwl_title', 'patch-iwlinks-iwl_title-varbinary.sql' ],
56 [ 'modifyField', 'category', 'cat_title', 'patch-category-cat_title-varbinary.sql' ],
57 [ 'modifyField', 'querycache', 'qc_title', 'patch-querycache-qc_title-varbinary.sql' ],
58 [ 'modifyField', 'querycachetwo', 'qcc_title', 'patch-querycachetwo-qcc_title-varbinary.sql' ],
59 [ 'modifyField', 'watchlist', 'wl_title', 'patch-watchlist-wl_title-varbinary.sql' ],
60 [ 'modifyField', 'protected_titles', 'pt_title', 'patch-protected_titles-pt_title-varbinary.sql' ],
61 [ 'modifyField', 'protected_titles', 'pt_expiry', 'patch-protected_titles-pt_expiry-drop-default.sql' ],
62 [ 'modifyField', 'ip_changes', 'ipc_rev_timestamp', 'patch-ip_changes-pc_rev_timestamp-drop-default.sql' ],
63 [ 'renameIndex', 'watchlist', 'namespace_title', 'wl_namespace_title', false,
64 'patch-watchlist-namespace_title-rename-index.sql' ],
65 [ 'modifyField', 'job', 'job_title', 'patch-job-job_title-varbinary.sql' ],
66 [ 'modifyField', 'slot_roles', 'role_id', 'patch-slot_roles-role_id-fix_not_null.sql' ],
67 [ 'modifyField', 'content_models', 'model_id', 'patch-content_models-model_id-fix_not_null.sql' ],
68 [ 'modifyField', 'categorylinks', 'cl_to', 'patch-categorylinks-cl_to-varbinary.sql' ],
69 [ 'modifyField', 'logging', 'log_title', 'patch-logging-log_title-varbinary.sql' ],
70 [ 'renameIndex', 'user_properties', 'user_properties_property', 'up_property', false,
71 'patch-user_properties-rename-index.sql' ],
72 [ 'renameIndex', 'sites', 'sites_global_key', 'site_global_key', false, 'patch-sites-rename-indexes.sql' ],
73 [ 'renameIndex', 'logging', 'type_time', 'log_type_time', false, 'patch-logging-rename-indexes.sql' ],
74 [ 'modifyField', 'filearchive', 'fa_name', 'patch-filearchive-fa_name.sql' ],
75 [ 'modifyField', 'oldimage', 'oi_name', 'patch-oldimage-oi_name-varbinary.sql' ],
76 [ 'modifyField', 'objectcache', 'exptime', 'patch-objectcache-exptime-notnull.sql' ],
77 [ 'modifyField', 'ipblocks', 'ipb_timestamp', 'patch-ipblocks-ipb_timestamp-drop-default.sql' ],
78 [ 'renameIndex', 'archive', 'name_title_timestamp', 'ar_name_title_timestamp', false,
79 'patch-archive-rename-name_title_timestamp-index.sql' ],
80 [ 'modifyField', 'image', 'img_name', 'patch-image-img_name-varbinary.sql' ],
81 [ 'renameIndex', 'site_identifiers', 'site_ids_key', 'si_key', false,
82 'patch-site_identifiers-rename-indexes.sql' ],
83 [ 'modifyField', 'recentchanges', 'rc_title', 'patch-recentchanges-rc_title-varbinary.sql' ],
84 [ 'renameIndex', 'recentchanges', 'new_name_timestamp', 'rc_new_name_timestamp', false,
85 'patch-recentchanges-rc_new_name_timestamp.sql' ],
86 [ 'modifyField', 'archive', 'ar_title', 'patch-archive-ar_title-varbinary.sql' ],
87 [ 'modifyField', 'page', 'page_title', 'patch-page-page_title-varbinary.sql' ],
88 [ 'modifyField', 'user', 'user_name', 'patch-user_table-updates.sql' ],
89
90 // 1.37
91 [ 'renameIndex', 'revision', 'page_timestamp', 'rev_page_timestamp', false,
92 'patch-revision-rename-index.sql' ],
93 [ 'addField', 'objectcache', 'modtoken', 'patch-objectcache-modtoken.sql' ],
94 [ 'modifyField', 'revision', 'rev_timestamp', 'patch-revision-rev_timestamp-drop-default.sql' ],
95 [ 'addIndex', 'oldimage', 'oi_timestamp', 'patch-oldimage-oi_timestamp.sql' ],
96 [ 'renameIndex', 'page', 'name_title', 'page_name_title', false,
97 'patch-page-rename-name_title-index.sql' ],
98 [ 'renameIndex', 'change_tag', 'change_tag_rc_tag_id', 'ct_rc_tag_id', false,
99 'patch-change_tag-rename-indexes.sql' ],
100
101 // 1.38
102 [ 'doConvertDjvuMetadata' ],
103 [ 'dropField', 'page_restrictions', 'pr_user', 'patch-drop-page_restrictions-pr_user.sql' ],
104 [ 'addTable', 'linktarget', 'patch-linktarget.sql' ],
105 [ 'dropIndex', 'revision', 'rev_page_id', 'patch-drop-rev_page_id.sql' ],
106 [ 'modifyField', 'page_restrictions', 'pr_page', 'patch-page_restrictions-pr_page.sql' ],
107 [ 'modifyField', 'page_props', 'pp_page', 'patch-page_props-pp_page.sql' ],
108 [ 'modifyField', 'ipblocks_restrictions', 'ir_value', 'patch-ipblocks_restrictions-ir_value.sql' ],
109 [ 'addField', 'templatelinks', 'tl_target_id', 'patch-templatelinks-target_id.sql' ],
110
111 // 1.39
112 [ 'addTable', 'user_autocreate_serial', 'patch-user_autocreate_serial.sql' ],
113 [ 'modifyField', 'ipblocks_restrictions', 'ir_ipb_id', 'patch-ipblocks_restrictions-ir_ipb_id.sql' ],
114 [ 'modifyField', 'ipblocks', 'ipb_id', 'patch-ipblocks-ipb_id.sql' ],
115 [ 'modifyField', 'user', 'user_editcount', 'patch-user-user_editcount.sql' ],
116 [ 'runMaintenance', MigrateRevisionActorTemp::class, 'maintenance/migrateRevisionActorTemp.php' ],
117 [ 'dropTable', 'revision_actor_temp' ],
118 [ 'runMaintenance', UpdateRestrictions::class, 'maintenance/updateRestrictions.php' ],
119 [ 'dropField', 'page', 'page_restrictions', 'patch-page-drop-page_restrictions.sql' ],
120 [ 'migrateTemplatelinks' ],
121 [ 'modifyField', 'templatelinks', 'tl_namespace', 'patch-templatelinks-tl_title-nullable.sql' ],
122 [ 'dropField', 'templatelinks', 'tl_title', 'patch-templatelinks-drop-tl_title.sql' ],
123
124 // 1.40
125 [ 'addField', 'externallinks', 'el_to_path', 'patch-externallinks-el_to_path.sql' ],
126 ];
127 }
128
137 protected function indexHasField( $table, $index, $field ) {
138 $info = $this->db->indexInfo( $table, $index, __METHOD__ );
139 if ( $info ) {
140 foreach ( $info as $column ) {
141 if ( $column == $field ) {
142 $this->output( "...index $index on table $table includes field $field.\n" );
143 return true;
144 }
145 }
146 }
147 $this->output( "...index $index on table $table has no field $field; added.\n" );
148
149 return false;
150 }
151
152 protected function doFixIpbAddressUniqueIndex() {
153 if ( !$this->indexHasField( 'ipblocks', 'ipb_address_unique', 'ipb_anon_only' ) ) {
154 $this->output( "...ipb_address_unique index up-to-date.\n" );
155 return;
156 }
157
158 $this->applyPatch(
159 'patch-ipblocks-fix-ipb_address_unique.sql',
160 false,
161 'Removing ipb_anon_only column from ipb_address_unique index'
162 );
163 }
164}
Class for handling database updates.
output( $str)
Output some text.
applyPatch( $path, $isFullPath=false, $msg=null)
Applies a SQL patch.
getCoreUpdateList()
Get an array of updates to perform on the database.
indexHasField( $table, $index, $field)
Check whether an index contain a field.