MediaWiki
REL1_22
|
00001 <?php 00031 class PostgresUpdater extends DatabaseUpdater { 00032 00036 protected $db; 00037 00043 protected function getCoreUpdateList() { 00044 return array( 00045 # rename tables 1.7.3 00046 # r15791 Change reserved word table names "user" and "text" 00047 array( 'renameTable', 'user', 'mwuser' ), 00048 array( 'renameTable', 'text', 'pagecontent' ), 00049 array( 'renameIndex', 'mwuser', 'user_pkey', 'mwuser_pkey' ), 00050 array( 'renameIndex', 'mwuser', 'user_user_name_key', 'mwuser_user_name_key' ), 00051 array( 'renameIndex', 'pagecontent', 'text_pkey', 'pagecontent_pkey' ), 00052 00053 # renamed sequences 00054 array( 'renameSequence', 'ipblocks_ipb_id_val', 'ipblocks_ipb_id_seq' ), 00055 array( 'renameSequence', 'rev_rev_id_val', 'revision_rev_id_seq' ), 00056 array( 'renameSequence', 'text_old_id_val', 'text_old_id_seq' ), 00057 array( 'renameSequence', 'rc_rc_id_seq', 'recentchanges_rc_id_seq' ), 00058 array( 'renameSequence', 'log_log_id_seq', 'logging_log_id_seq' ), 00059 array( 'renameSequence', 'pr_id_val', 'page_restrictions_pr_id_seq' ), 00060 array( 'renameSequence', 'us_id_seq', 'uploadstash_us_id_seq' ), 00061 00062 # since r58263 00063 array( 'renameSequence', 'category_id_seq', 'category_cat_id_seq' ), 00064 00065 # new sequences if not renamed above 00066 array( 'addSequence', 'logging', false, 'logging_log_id_seq' ), 00067 array( 'addSequence', 'page_restrictions', false, 'page_restrictions_pr_id_seq' ), 00068 array( 'addSequence', 'filearchive', 'fa_id', 'filearchive_fa_id_seq' ), 00069 array( 'addSequence', 'archive', false, 'archive_ar_id_seq' ), 00070 array( 'addSequence', 'externallinks', false, 'externallinks_el_id_seq' ), 00071 00072 # new tables 00073 array( 'addTable', 'category', 'patch-category.sql' ), 00074 array( 'addTable', 'page', 'patch-page.sql' ), 00075 array( 'addTable', 'querycachetwo', 'patch-querycachetwo.sql' ), 00076 array( 'addTable', 'page_props', 'patch-page_props.sql' ), 00077 array( 'addTable', 'page_restrictions', 'patch-page_restrictions.sql' ), 00078 array( 'addTable', 'profiling', 'patch-profiling.sql' ), 00079 array( 'addTable', 'protected_titles', 'patch-protected_titles.sql' ), 00080 array( 'addTable', 'redirect', 'patch-redirect.sql' ), 00081 array( 'addTable', 'updatelog', 'patch-updatelog.sql' ), 00082 array( 'addTable', 'change_tag', 'patch-change_tag.sql' ), 00083 array( 'addTable', 'tag_summary', 'patch-tag_summary.sql' ), 00084 array( 'addTable', 'valid_tag', 'patch-valid_tag.sql' ), 00085 array( 'addTable', 'user_properties', 'patch-user_properties.sql' ), 00086 array( 'addTable', 'log_search', 'patch-log_search.sql' ), 00087 array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ), 00088 array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ), 00089 array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ), 00090 array( 'addTable', 'msg_resource_links', 'patch-msg_resource_links.sql' ), 00091 array( 'addTable', 'module_deps', 'patch-module_deps.sql' ), 00092 array( 'addTable', 'uploadstash', 'patch-uploadstash.sql' ), 00093 array( 'addTable', 'user_former_groups', 'patch-user_former_groups.sql' ), 00094 array( 'addTable', 'sites', 'patch-sites.sql' ), 00095 00096 # Needed before new field 00097 array( 'convertArchive2' ), 00098 00099 # new fields 00100 array( 'addPgField', 'updatelog', 'ul_value', 'TEXT' ), 00101 array( 'addPgField', 'archive', 'ar_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), 00102 array( 'addPgField', 'archive', 'ar_len', 'INTEGER' ), 00103 array( 'addPgField', 'archive', 'ar_page_id', 'INTEGER' ), 00104 array( 'addPgField', 'archive', 'ar_parent_id', 'INTEGER' ), 00105 array( 'addPgField', 'archive', 'ar_content_model', 'TEXT' ), 00106 array( 'addPgField', 'archive', 'ar_content_format', 'TEXT' ), 00107 array( 'addPgField', 'categorylinks', 'cl_sortkey_prefix', "TEXT NOT NULL DEFAULT ''" ), 00108 array( 'addPgField', 'categorylinks', 'cl_collation', "TEXT NOT NULL DEFAULT 0" ), 00109 array( 'addPgField', 'categorylinks', 'cl_type', "TEXT NOT NULL DEFAULT 'page'" ), 00110 array( 'addPgField', 'image', 'img_sha1', "TEXT NOT NULL DEFAULT ''" ), 00111 array( 'addPgField', 'ipblocks', 'ipb_allow_usertalk', 'SMALLINT NOT NULL DEFAULT 0' ), 00112 array( 'addPgField', 'ipblocks', 'ipb_anon_only', 'SMALLINT NOT NULL DEFAULT 0' ), 00113 array( 'addPgField', 'ipblocks', 'ipb_by_text', "TEXT NOT NULL DEFAULT ''" ), 00114 array( 'addPgField', 'ipblocks', 'ipb_block_email', 'SMALLINT NOT NULL DEFAULT 0' ), 00115 array( 'addPgField', 'ipblocks', 'ipb_create_account', 'SMALLINT NOT NULL DEFAULT 1' ), 00116 array( 'addPgField', 'ipblocks', 'ipb_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), 00117 array( 'addPgField', 'ipblocks', 'ipb_enable_autoblock', 'SMALLINT NOT NULL DEFAULT 1' ), 00118 array( 'addPgField', 'ipblocks', 'ipb_parent_block_id', 00119 'INTEGER DEFAULT NULL REFERENCES ipblocks(ipb_id) ' . 00120 'ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED' ), 00121 array( 'addPgField', 'filearchive', 'fa_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), 00122 array( 'addPgField', 'filearchive', 'fa_sha1', "TEXT NOT NULL DEFAULT ''" ), 00123 array( 'addPgField', 'logging', 'log_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), 00124 array( 'addPgField', 'logging', 'log_id', 00125 "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('logging_log_id_seq')" ), 00126 array( 'addPgField', 'logging', 'log_params', 'TEXT' ), 00127 array( 'addPgField', 'mwuser', 'user_editcount', 'INTEGER' ), 00128 array( 'addPgField', 'mwuser', 'user_newpass_time', 'TIMESTAMPTZ' ), 00129 array( 'addPgField', 'oldimage', 'oi_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), 00130 array( 'addPgField', 'oldimage', 'oi_major_mime', "TEXT NOT NULL DEFAULT 'unknown'" ), 00131 array( 'addPgField', 'oldimage', 'oi_media_type', 'TEXT' ), 00132 array( 'addPgField', 'oldimage', 'oi_metadata', "BYTEA NOT NULL DEFAULT ''" ), 00133 array( 'addPgField', 'oldimage', 'oi_minor_mime', "TEXT NOT NULL DEFAULT 'unknown'" ), 00134 array( 'addPgField', 'oldimage', 'oi_sha1', "TEXT NOT NULL DEFAULT ''" ), 00135 array( 'addPgField', 'page', 'page_content_model', 'TEXT' ), 00136 array( 'addPgField', 'page_restrictions', 'pr_id', 00137 "INTEGER NOT NULL UNIQUE DEFAULT nextval('page_restrictions_pr_id_seq')" ), 00138 array( 'addPgField', 'profiling', 'pf_memory', 'NUMERIC(18,10) NOT NULL DEFAULT 0' ), 00139 array( 'addPgField', 'recentchanges', 'rc_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), 00140 array( 'addPgField', 'recentchanges', 'rc_log_action', 'TEXT' ), 00141 array( 'addPgField', 'recentchanges', 'rc_log_type', 'TEXT' ), 00142 array( 'addPgField', 'recentchanges', 'rc_logid', 'INTEGER NOT NULL DEFAULT 0' ), 00143 array( 'addPgField', 'recentchanges', 'rc_new_len', 'INTEGER' ), 00144 array( 'addPgField', 'recentchanges', 'rc_old_len', 'INTEGER' ), 00145 array( 'addPgField', 'recentchanges', 'rc_params', 'TEXT' ), 00146 array( 'addPgField', 'redirect', 'rd_interwiki', 'TEXT NULL' ), 00147 array( 'addPgField', 'redirect', 'rd_fragment', 'TEXT NULL' ), 00148 array( 'addPgField', 'revision', 'rev_deleted', 'SMALLINT NOT NULL DEFAULT 0' ), 00149 array( 'addPgField', 'revision', 'rev_len', 'INTEGER' ), 00150 array( 'addPgField', 'revision', 'rev_parent_id', 'INTEGER DEFAULT NULL' ), 00151 array( 'addPgField', 'revision', 'rev_content_model', 'TEXT' ), 00152 array( 'addPgField', 'revision', 'rev_content_format', 'TEXT' ), 00153 array( 'addPgField', 'site_stats', 'ss_active_users', "INTEGER DEFAULT '-1'" ), 00154 array( 'addPgField', 'user_newtalk', 'user_last_timestamp', 'TIMESTAMPTZ' ), 00155 array( 'addPgField', 'logging', 'log_user_text', "TEXT NOT NULL DEFAULT ''" ), 00156 array( 'addPgField', 'logging', 'log_page', 'INTEGER' ), 00157 array( 'addPgField', 'interwiki', 'iw_api', "TEXT NOT NULL DEFAULT ''" ), 00158 array( 'addPgField', 'interwiki', 'iw_wikiid', "TEXT NOT NULL DEFAULT ''" ), 00159 array( 'addPgField', 'revision', 'rev_sha1', "TEXT NOT NULL DEFAULT ''" ), 00160 array( 'addPgField', 'archive', 'ar_sha1', "TEXT NOT NULL DEFAULT ''" ), 00161 array( 'addPgField', 'uploadstash', 'us_chunk_inx', "INTEGER NULL" ), 00162 array( 'addPgField', 'job', 'job_timestamp', "TIMESTAMPTZ" ), 00163 array( 'addPgField', 'job', 'job_random', "INTEGER NOT NULL DEFAULT 0" ), 00164 array( 'addPgField', 'job', 'job_attempts', "INTEGER NOT NULL DEFAULT 0" ), 00165 array( 'addPgField', 'job', 'job_token', "TEXT NOT NULL DEFAULT ''" ), 00166 array( 'addPgField', 'job', 'job_token_timestamp', "TIMESTAMPTZ" ), 00167 array( 'addPgField', 'job', 'job_sha1', "TEXT NOT NULL DEFAULT ''" ), 00168 array( 'addPgField', 'archive', 'ar_id', 00169 "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('archive_ar_id_seq')" ), 00170 array( 'addPgField', 'externallinks', 'el_id', 00171 "INTEGER NOT NULL PRIMARY KEY DEFAULT nextval('externallinks_el_id_seq')" ), 00172 array( 'addPgField', 'uploadstash', 'us_props', "BYTEA" ), 00173 00174 # type changes 00175 array( 'changeField', 'archive', 'ar_deleted', 'smallint', '' ), 00176 array( 'changeField', 'archive', 'ar_minor_edit', 'smallint', 00177 'ar_minor_edit::smallint DEFAULT 0' ), 00178 array( 'changeField', 'filearchive', 'fa_deleted', 'smallint', '' ), 00179 array( 'changeField', 'filearchive', 'fa_height', 'integer', '' ), 00180 array( 'changeField', 'filearchive', 'fa_metadata', 'bytea', "decode(fa_metadata,'escape')" ), 00181 array( 'changeField', 'filearchive', 'fa_size', 'integer', '' ), 00182 array( 'changeField', 'filearchive', 'fa_width', 'integer', '' ), 00183 array( 'changeField', 'filearchive', 'fa_storage_group', 'text', '' ), 00184 array( 'changeField', 'filearchive', 'fa_storage_key', 'text', '' ), 00185 array( 'changeField', 'image', 'img_metadata', 'bytea', "decode(img_metadata,'escape')" ), 00186 array( 'changeField', 'image', 'img_size', 'integer', '' ), 00187 array( 'changeField', 'image', 'img_width', 'integer', '' ), 00188 array( 'changeField', 'image', 'img_height', 'integer', '' ), 00189 array( 'changeField', 'interwiki', 'iw_local', 'smallint', 'iw_local::smallint' ), 00190 array( 'changeField', 'interwiki', 'iw_trans', 'smallint', 'iw_trans::smallint DEFAULT 0' ), 00191 array( 'changeField', 'ipblocks', 'ipb_auto', 'smallint', 'ipb_auto::smallint DEFAULT 0' ), 00192 array( 'changeField', 'ipblocks', 'ipb_anon_only', 'smallint', 00193 "CASE WHEN ipb_anon_only=' ' THEN 0 ELSE ipb_anon_only::smallint END DEFAULT 0" ), 00194 array( 'changeField', 'ipblocks', 'ipb_create_account', 'smallint', 00195 "CASE WHEN ipb_create_account=' ' THEN 0 ELSE ipb_create_account::smallint END DEFAULT 1" ), 00196 array( 'changeField', 'ipblocks', 'ipb_enable_autoblock', 'smallint', 00197 "CASE WHEN ipb_enable_autoblock=' ' THEN 0 ELSE ipb_enable_autoblock::smallint END DEFAULT 1" ), 00198 array( 'changeField', 'ipblocks', 'ipb_block_email', 'smallint', 00199 "CASE WHEN ipb_block_email=' ' THEN 0 ELSE ipb_block_email::smallint END DEFAULT 0" ), 00200 array( 'changeField', 'ipblocks', 'ipb_address', 'text', 'ipb_address::text' ), 00201 array( 'changeField', 'ipblocks', 'ipb_deleted', 'smallint', 'ipb_deleted::smallint DEFAULT 0' ), 00202 array( 'changeField', 'mwuser', 'user_token', 'text', '' ), 00203 array( 'changeField', 'mwuser', 'user_email_token', 'text', '' ), 00204 array( 'changeField', 'objectcache', 'keyname', 'text', '' ), 00205 array( 'changeField', 'oldimage', 'oi_height', 'integer', '' ), 00206 array( 'changeField', 'oldimage', 'oi_metadata', 'bytea', "decode(img_metadata,'escape')" ), 00207 array( 'changeField', 'oldimage', 'oi_size', 'integer', '' ), 00208 array( 'changeField', 'oldimage', 'oi_width', 'integer', '' ), 00209 array( 'changeField', 'page', 'page_is_redirect', 'smallint', 00210 'page_is_redirect::smallint DEFAULT 0' ), 00211 array( 'changeField', 'page', 'page_is_new', 'smallint', 'page_is_new::smallint DEFAULT 0' ), 00212 array( 'changeField', 'querycache', 'qc_value', 'integer', '' ), 00213 array( 'changeField', 'querycachetwo', 'qcc_value', 'integer', '' ), 00214 array( 'changeField', 'recentchanges', 'rc_bot', 'smallint', 'rc_bot::smallint DEFAULT 0' ), 00215 array( 'changeField', 'recentchanges', 'rc_deleted', 'smallint', '' ), 00216 array( 'changeField', 'recentchanges', 'rc_minor', 'smallint', 'rc_minor::smallint DEFAULT 0' ), 00217 array( 'changeField', 'recentchanges', 'rc_new', 'smallint', 'rc_new::smallint DEFAULT 0' ), 00218 array( 'changeField', 'recentchanges', 'rc_type', 'smallint', 'rc_type::smallint DEFAULT 0' ), 00219 array( 'changeField', 'recentchanges', 'rc_patrolled', 'smallint', 00220 'rc_patrolled::smallint DEFAULT 0' ), 00221 array( 'changeField', 'revision', 'rev_deleted', 'smallint', 'rev_deleted::smallint DEFAULT 0' ), 00222 array( 'changeField', 'revision', 'rev_minor_edit', 'smallint', 00223 'rev_minor_edit::smallint DEFAULT 0' ), 00224 array( 'changeField', 'templatelinks', 'tl_namespace', 'smallint', 'tl_namespace::smallint' ), 00225 array( 'changeField', 'user_newtalk', 'user_ip', 'text', 'host(user_ip)' ), 00226 array( 'changeField', 'uploadstash', 'us_image_bits', 'smallint', '' ), 00227 array( 'changeField', 'profiling', 'pf_time', 'float', '' ), 00228 array( 'changeField', 'profiling', 'pf_memory', 'float', '' ), 00229 00230 # null changes 00231 array( 'changeNullableField', 'oldimage', 'oi_bits', 'NULL' ), 00232 array( 'changeNullableField', 'oldimage', 'oi_timestamp', 'NULL' ), 00233 array( 'changeNullableField', 'oldimage', 'oi_major_mime', 'NULL' ), 00234 array( 'changeNullableField', 'oldimage', 'oi_minor_mime', 'NULL' ), 00235 array( 'changeNullableField', 'image', 'img_metadata', 'NOT NULL' ), 00236 array( 'changeNullableField', 'filearchive', 'fa_metadata', 'NOT NULL' ), 00237 array( 'changeNullableField', 'recentchanges', 'rc_cur_id', 'NULL' ), 00238 00239 array( 'checkOiDeleted' ), 00240 00241 # New indexes 00242 array( 'addPgIndex', 'archive', 'archive_user_text', '(ar_user_text)' ), 00243 array( 'addPgIndex', 'image', 'img_sha1', '(img_sha1)' ), 00244 array( 'addPgIndex', 'ipblocks', 'ipb_parent_block_id', '(ipb_parent_block_id)' ), 00245 array( 'addPgIndex', 'oldimage', 'oi_sha1', '(oi_sha1)' ), 00246 array( 'addPgIndex', 'page', 'page_mediawiki_title', '(page_title) WHERE page_namespace = 8' ), 00247 array( 'addPgIndex', 'pagelinks', 'pagelinks_title', '(pl_title)' ), 00248 array( 'addPgIndex', 'page_props', 'pp_propname_page', '(pp_propname, pp_page)' ), 00249 array( 'addPgIndex', 'revision', 'rev_text_id_idx', '(rev_text_id)' ), 00250 array( 'addPgIndex', 'recentchanges', 'rc_timestamp_bot', '(rc_timestamp) WHERE rc_bot = 0' ), 00251 array( 'addPgIndex', 'templatelinks', 'templatelinks_from', '(tl_from)' ), 00252 array( 'addPgIndex', 'watchlist', 'wl_user', '(wl_user)' ), 00253 array( 'addPgIndex', 'logging', 'logging_user_type_time', 00254 '(log_user, log_type, log_timestamp)' ), 00255 array( 'addPgIndex', 'logging', 'logging_page_id_time', '(log_page,log_timestamp)' ), 00256 array( 'addPgIndex', 'iwlinks', 'iwl_prefix_from_title', '(iwl_prefix, iwl_from, iwl_title)' ), 00257 array( 'addPgIndex', 'iwlinks', 'iwl_prefix_title_from', '(iwl_prefix, iwl_title, iwl_from)' ), 00258 array( 'addPgIndex', 'job', 'job_timestamp_idx', '(job_timestamp)' ), 00259 array( 'addPgIndex', 'job', 'job_sha1', '(job_sha1)' ), 00260 array( 'addPgIndex', 'job', 'job_cmd_token', '(job_cmd, job_token, job_random)' ), 00261 array( 'addPgIndex', 'job', 'job_cmd_token_id', '(job_cmd, job_token, job_id)' ), 00262 array( 'addPgIndex', 'filearchive', 'fa_sha1', '(fa_sha1)' ), 00263 00264 array( 'checkIndex', 'pagelink_unique', array( 00265 array( 'pl_from', 'int4_ops', 'btree', 0 ), 00266 array( 'pl_namespace', 'int2_ops', 'btree', 0 ), 00267 array( 'pl_title', 'text_ops', 'btree', 0 ), 00268 ), 00269 'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' ), 00270 array( 'checkIndex', 'cl_sortkey', array( 00271 array( 'cl_to', 'text_ops', 'btree', 0 ), 00272 array( 'cl_sortkey', 'text_ops', 'btree', 0 ), 00273 array( 'cl_from', 'int4_ops', 'btree', 0 ), 00274 ), 00275 'CREATE INDEX cl_sortkey ON "categorylinks" ' . 00276 'USING "btree" ("cl_to", "cl_sortkey", "cl_from")' ), 00277 array( 'checkIndex', 'iwl_prefix_title_from', array( 00278 array( 'iwl_prefix', 'text_ops', 'btree', 0 ), 00279 array( 'iwl_title', 'text_ops', 'btree', 0 ), 00280 array( 'iwl_from', 'int4_ops', 'btree', 0 ), 00281 ), 00282 'CREATE INDEX iwl_prefix_title_from ON "iwlinks" ' . 00283 'USING "btree" ("iwl_prefix", "iwl_title", "iwl_from")' ), 00284 array( 'checkIndex', 'logging_times', array( 00285 array( 'log_timestamp', 'timestamptz_ops', 'btree', 0 ), 00286 ), 00287 'CREATE INDEX "logging_times" ON "logging" USING "btree" ("log_timestamp")' ), 00288 array( 'dropIndex', 'oldimage', 'oi_name' ), 00289 array( 'checkIndex', 'oi_name_archive_name', array( 00290 array( 'oi_name', 'text_ops', 'btree', 0 ), 00291 array( 'oi_archive_name', 'text_ops', 'btree', 0 ), 00292 ), 00293 'CREATE INDEX "oi_name_archive_name" ON "oldimage" ' . 00294 'USING "btree" ("oi_name", "oi_archive_name")' ), 00295 array( 'checkIndex', 'oi_name_timestamp', array( 00296 array( 'oi_name', 'text_ops', 'btree', 0 ), 00297 array( 'oi_timestamp', 'timestamptz_ops', 'btree', 0 ), 00298 ), 00299 'CREATE INDEX "oi_name_timestamp" ON "oldimage" ' . 00300 'USING "btree" ("oi_name", "oi_timestamp")' ), 00301 array( 'checkIndex', 'page_main_title', array( 00302 array( 'page_title', 'text_pattern_ops', 'btree', 0 ), 00303 ), 00304 'CREATE INDEX "page_main_title" ON "page" ' . 00305 'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 0)' ), 00306 array( 'checkIndex', 'page_mediawiki_title', array( 00307 array( 'page_title', 'text_pattern_ops', 'btree', 0 ), 00308 ), 00309 'CREATE INDEX "page_mediawiki_title" ON "page" ' . 00310 'USING "btree" ("page_title" "text_pattern_ops") WHERE ("page_namespace" = 8)' ), 00311 array( 'checkIndex', 'page_project_title', array( 00312 array( 'page_title', 'text_pattern_ops', 'btree', 0 ), 00313 ), 00314 'CREATE INDEX "page_project_title" ON "page" ' . 00315 'USING "btree" ("page_title" "text_pattern_ops") ' . 00316 'WHERE ("page_namespace" = 4)' ), 00317 array( 'checkIndex', 'page_talk_title', array( 00318 array( 'page_title', 'text_pattern_ops', 'btree', 0 ), 00319 ), 00320 'CREATE INDEX "page_talk_title" ON "page" ' . 00321 'USING "btree" ("page_title" "text_pattern_ops") ' . 00322 'WHERE ("page_namespace" = 1)' ), 00323 array( 'checkIndex', 'page_user_title', array( 00324 array( 'page_title', 'text_pattern_ops', 'btree', 0 ), 00325 ), 00326 'CREATE INDEX "page_user_title" ON "page" ' . 00327 'USING "btree" ("page_title" "text_pattern_ops") WHERE ' . 00328 '("page_namespace" = 2)' ), 00329 array( 'checkIndex', 'page_utalk_title', array( 00330 array( 'page_title', 'text_pattern_ops', 'btree', 0 ), 00331 ), 00332 'CREATE INDEX "page_utalk_title" ON "page" ' . 00333 'USING "btree" ("page_title" "text_pattern_ops") ' . 00334 'WHERE ("page_namespace" = 3)' ), 00335 array( 'checkIndex', 'ts2_page_text', array( 00336 array( 'textvector', 'tsvector_ops', 'gist', 0 ), 00337 ), 00338 'CREATE INDEX "ts2_page_text" ON "pagecontent" USING "gist" ("textvector")' ), 00339 array( 'checkIndex', 'ts2_page_title', array( 00340 array( 'titlevector', 'tsvector_ops', 'gist', 0 ), 00341 ), 00342 'CREATE INDEX "ts2_page_title" ON "page" USING "gist" ("titlevector")' ), 00343 00344 array( 'checkOiNameConstraint' ), 00345 array( 'checkPageDeletedTrigger' ), 00346 array( 'checkRevUserFkey' ), 00347 array( 'dropIndex', 'ipblocks', 'ipb_address' ), 00348 array( 'checkIndex', 'ipb_address_unique', array( 00349 array( 'ipb_address', 'text_ops', 'btree', 0 ), 00350 array( 'ipb_user', 'int4_ops', 'btree', 0 ), 00351 array( 'ipb_auto', 'int2_ops', 'btree', 0 ), 00352 array( 'ipb_anon_only', 'int2_ops', 'btree', 0 ), 00353 ), 00354 'CREATE UNIQUE INDEX ipb_address_unique ' . 00355 'ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only)' ), 00356 00357 array( 'checkIwlPrefix' ), 00358 00359 # All FK columns should be deferred 00360 array( 'changeFkeyDeferrable', 'archive', 'ar_user', 'mwuser(user_id) ON DELETE SET NULL' ), 00361 array( 'changeFkeyDeferrable', 'categorylinks', 'cl_from', 'page(page_id) ON DELETE CASCADE' ), 00362 array( 'changeFkeyDeferrable', 'externallinks', 'el_from', 'page(page_id) ON DELETE CASCADE' ), 00363 array( 'changeFkeyDeferrable', 'filearchive', 'fa_deleted_user', 00364 'mwuser(user_id) ON DELETE SET NULL' ), 00365 array( 'changeFkeyDeferrable', 'filearchive', 'fa_user', 'mwuser(user_id) ON DELETE SET NULL' ), 00366 array( 'changeFkeyDeferrable', 'image', 'img_user', 'mwuser(user_id) ON DELETE SET NULL' ), 00367 array( 'changeFkeyDeferrable', 'imagelinks', 'il_from', 'page(page_id) ON DELETE CASCADE' ), 00368 array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_by', 'mwuser(user_id) ON DELETE CASCADE' ), 00369 array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_user', 'mwuser(user_id) ON DELETE SET NULL' ), 00370 array( 'changeFkeyDeferrable', 'ipblocks', 'ipb_parent_block_id', 00371 'ipblocks(ipb_id) ON DELETE SET NULL' ), 00372 array( 'changeFkeyDeferrable', 'langlinks', 'll_from', 'page(page_id) ON DELETE CASCADE' ), 00373 array( 'changeFkeyDeferrable', 'logging', 'log_user', 'mwuser(user_id) ON DELETE SET NULL' ), 00374 array( 'changeFkeyDeferrable', 'oldimage', 'oi_name', 00375 'image(img_name) ON DELETE CASCADE ON UPDATE CASCADE' ), 00376 array( 'changeFkeyDeferrable', 'oldimage', 'oi_user', 'mwuser(user_id) ON DELETE SET NULL' ), 00377 array( 'changeFkeyDeferrable', 'pagelinks', 'pl_from', 'page(page_id) ON DELETE CASCADE' ), 00378 array( 'changeFkeyDeferrable', 'page_props', 'pp_page', 'page (page_id) ON DELETE CASCADE' ), 00379 array( 'changeFkeyDeferrable', 'page_restrictions', 'pr_page', 00380 'page(page_id) ON DELETE CASCADE' ), 00381 array( 'changeFkeyDeferrable', 'protected_titles', 'pt_user', 00382 'mwuser(user_id) ON DELETE SET NULL' ), 00383 array( 'changeFkeyDeferrable', 'recentchanges', 'rc_cur_id', 00384 'page(page_id) ON DELETE SET NULL' ), 00385 array( 'changeFkeyDeferrable', 'recentchanges', 'rc_user', 00386 'mwuser(user_id) ON DELETE SET NULL' ), 00387 array( 'changeFkeyDeferrable', 'redirect', 'rd_from', 'page(page_id) ON DELETE CASCADE' ), 00388 array( 'changeFkeyDeferrable', 'revision', 'rev_page', 'page (page_id) ON DELETE CASCADE' ), 00389 array( 'changeFkeyDeferrable', 'revision', 'rev_user', 'mwuser(user_id) ON DELETE RESTRICT' ), 00390 array( 'changeFkeyDeferrable', 'templatelinks', 'tl_from', 'page(page_id) ON DELETE CASCADE' ), 00391 array( 'changeFkeyDeferrable', 'user_groups', 'ug_user', 'mwuser(user_id) ON DELETE CASCADE' ), 00392 array( 'changeFkeyDeferrable', 'user_newtalk', 'user_id', 'mwuser(user_id) ON DELETE CASCADE' ), 00393 array( 'changeFkeyDeferrable', 'user_properties', 'up_user', 00394 'mwuser(user_id) ON DELETE CASCADE' ), 00395 array( 'changeFkeyDeferrable', 'watchlist', 'wl_user', 'mwuser(user_id) ON DELETE CASCADE' ), 00396 00397 # r81574 00398 array( 'addInterwikiType' ), 00399 # end 00400 array( 'tsearchFixes' ), 00401 ); 00402 } 00403 00404 protected function getOldGlobalUpdates() { 00405 global $wgExtNewTables, $wgExtPGNewFields, $wgExtPGAlteredFields, $wgExtNewIndexes; 00406 00407 $updates = array(); 00408 00409 # Add missing extension tables 00410 foreach ( $wgExtNewTables as $tableRecord ) { 00411 $updates[] = array( 00412 'addTable', $tableRecord[0], $tableRecord[1], true 00413 ); 00414 } 00415 00416 # Add missing extension fields 00417 foreach ( $wgExtPGNewFields as $fieldRecord ) { 00418 $updates[] = array( 00419 'addPgField', $fieldRecord[0], $fieldRecord[1], 00420 $fieldRecord[2] 00421 ); 00422 } 00423 00424 # Change altered columns 00425 foreach ( $wgExtPGAlteredFields as $fieldRecord ) { 00426 $updates[] = array( 00427 'changeField', $fieldRecord[0], $fieldRecord[1], 00428 $fieldRecord[2] 00429 ); 00430 } 00431 00432 # Add missing extension indexes 00433 foreach ( $wgExtNewIndexes as $fieldRecord ) { 00434 $updates[] = array( 00435 'addPgExtIndex', $fieldRecord[0], $fieldRecord[1], 00436 $fieldRecord[2] 00437 ); 00438 } 00439 00440 return $updates; 00441 } 00442 00443 protected function describeTable( $table ) { 00444 $q = <<<END 00445 SELECT attname, attnum FROM pg_namespace, pg_class, pg_attribute 00446 WHERE pg_class.relnamespace = pg_namespace.oid 00447 AND attrelid=pg_class.oid AND attnum > 0 00448 AND relname=%s AND nspname=%s 00449 END; 00450 $res = $this->db->query( sprintf( $q, 00451 $this->db->addQuotes( $table ), 00452 $this->db->addQuotes( $this->db->getCoreSchema() ) ) ); 00453 if ( !$res ) { 00454 return null; 00455 } 00456 00457 $cols = array(); 00458 foreach ( $res as $r ) { 00459 $cols[] = array( 00460 "name" => $r[0], 00461 "ord" => $r[1], 00462 ); 00463 } 00464 00465 return $cols; 00466 } 00467 00468 function describeIndex( $idx ) { 00469 // first fetch the key (which is a list of columns ords) and 00470 // the table the index applies to (an oid) 00471 $q = <<<END 00472 SELECT indkey, indrelid FROM pg_namespace, pg_class, pg_index 00473 WHERE nspname=%s 00474 AND pg_class.relnamespace = pg_namespace.oid 00475 AND relname=%s 00476 AND indexrelid=pg_class.oid 00477 END; 00478 $res = $this->db->query( 00479 sprintf( 00480 $q, 00481 $this->db->addQuotes( $this->db->getCoreSchema() ), 00482 $this->db->addQuotes( $idx ) 00483 ) 00484 ); 00485 if ( !$res ) { 00486 return null; 00487 } 00488 if ( !( $r = $this->db->fetchRow( $res ) ) ) { 00489 return null; 00490 } 00491 00492 $indkey = $r[0]; 00493 $relid = intval( $r[1] ); 00494 $indkeys = explode( ' ', $indkey ); 00495 00496 $colnames = array(); 00497 foreach ( $indkeys as $rid ) { 00498 $query = <<<END 00499 SELECT attname FROM pg_class, pg_attribute 00500 WHERE attrelid=$relid 00501 AND attnum=%d 00502 AND attrelid=pg_class.oid 00503 END; 00504 $r2 = $this->db->query( sprintf( $query, $rid ) ); 00505 if ( !$r2 ) { 00506 return null; 00507 } 00508 if ( !( $row2 = $this->db->fetchRow( $r2 ) ) ) { 00509 return null; 00510 } 00511 $colnames[] = $row2[0]; 00512 } 00513 00514 return $colnames; 00515 } 00516 00517 function fkeyDeltype( $fkey ) { 00518 $q = <<<END 00519 SELECT confdeltype FROM pg_constraint, pg_namespace 00520 WHERE connamespace=pg_namespace.oid 00521 AND nspname=%s 00522 AND conname=%s; 00523 END; 00524 $r = $this->db->query( 00525 sprintf( 00526 $q, 00527 $this->db->addQuotes( $this->db->getCoreSchema() ), 00528 $this->db->addQuotes( $fkey ) 00529 ) 00530 ); 00531 if ( !( $row = $this->db->fetchRow( $r ) ) ) { 00532 return null; 00533 } 00534 00535 return $row[0]; 00536 } 00537 00538 function ruleDef( $table, $rule ) { 00539 $q = <<<END 00540 SELECT definition FROM pg_rules 00541 WHERE schemaname = %s 00542 AND tablename = %s 00543 AND rulename = %s 00544 END; 00545 $r = $this->db->query( 00546 sprintf( 00547 $q, 00548 $this->db->addQuotes( $this->db->getCoreSchema() ), 00549 $this->db->addQuotes( $table ), 00550 $this->db->addQuotes( $rule ) 00551 ) 00552 ); 00553 $row = $this->db->fetchRow( $r ); 00554 if ( !$row ) { 00555 return null; 00556 } 00557 $d = $row[0]; 00558 00559 return $d; 00560 } 00561 00562 protected function addSequence( $table, $pkey, $ns ) { 00563 if ( !$this->db->sequenceExists( $ns ) ) { 00564 $this->output( "Creating sequence $ns\n" ); 00565 $this->db->query( "CREATE SEQUENCE $ns" ); 00566 if ( $pkey !== false ) { 00567 $this->setDefault( $table, $pkey, '"nextval"(\'"' . $ns . '"\'::"regclass")' ); 00568 } 00569 } 00570 } 00571 00572 protected function renameSequence( $old, $new ) { 00573 if ( $this->db->sequenceExists( $new ) ) { 00574 $this->output( "...sequence $new already exists.\n" ); 00575 00576 return; 00577 } 00578 if ( $this->db->sequenceExists( $old ) ) { 00579 $this->output( "Renaming sequence $old to $new\n" ); 00580 $this->db->query( "ALTER SEQUENCE $old RENAME TO $new" ); 00581 } 00582 } 00583 00584 protected function renameTable( $old, $new, $patch = false ) { 00585 if ( $this->db->tableExists( $old ) ) { 00586 $this->output( "Renaming table $old to $new\n" ); 00587 $old = $this->db->realTableName( $old, "quoted" ); 00588 $new = $this->db->realTableName( $new, "quoted" ); 00589 $this->db->query( "ALTER TABLE $old RENAME TO $new" ); 00590 if ( $patch !== false ) { 00591 $this->applyPatch( $patch ); 00592 } 00593 } 00594 } 00595 00596 protected function renameIndex( 00597 $table, $old, $new, $skipBothIndexExistWarning = false, $a = false, $b = false 00598 ) { 00599 // First requirement: the table must exist 00600 if ( !$this->db->tableExists( $table, __METHOD__ ) ) { 00601 $this->output( "...skipping: '$table' table doesn't exist yet.\n" ); 00602 00603 return; 00604 } 00605 00606 // Second requirement: the new index must be missing 00607 if ( $this->db->indexExists( $table, $new, __METHOD__ ) ) { 00608 $this->output( "...index $new already set on $table table.\n" ); 00609 if ( !$skipBothIndexExistWarning 00610 && $this->db->indexExists( $table, $old, __METHOD__ ) 00611 ) { 00612 $this->output( "...WARNING: $old still exists, despite it has been " . 00613 "renamed into $new (which also exists).\n" . 00614 " $old should be manually removed if not needed anymore.\n" ); 00615 } 00616 00617 return; 00618 } 00619 00620 // Third requirement: the old index must exist 00621 if ( !$this->db->indexExists( $table, $old, __METHOD__ ) ) { 00622 $this->output( "...skipping: index $old doesn't exist.\n" ); 00623 00624 return; 00625 } 00626 00627 $this->db->query( "ALTER INDEX $old RENAME TO $new" ); 00628 } 00629 00630 protected function addPgField( $table, $field, $type ) { 00631 $fi = $this->db->fieldInfo( $table, $field ); 00632 if ( !is_null( $fi ) ) { 00633 $this->output( "...column '$table.$field' already exists\n" ); 00634 00635 return; 00636 } else { 00637 $this->output( "Adding column '$table.$field'\n" ); 00638 $this->db->query( "ALTER TABLE $table ADD $field $type" ); 00639 } 00640 } 00641 00642 protected function changeField( $table, $field, $newtype, $default ) { 00643 $fi = $this->db->fieldInfo( $table, $field ); 00644 if ( is_null( $fi ) ) { 00645 $this->output( "...ERROR: expected column $table.$field to exist\n" ); 00646 exit( 1 ); 00647 } 00648 00649 if ( $fi->type() === $newtype ) { 00650 $this->output( "...column '$table.$field' is already of type '$newtype'\n" ); 00651 } else { 00652 $this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" ); 00653 $sql = "ALTER TABLE $table ALTER $field TYPE $newtype"; 00654 if ( strlen( $default ) ) { 00655 $res = array(); 00656 if ( preg_match( '/DEFAULT (.+)/', $default, $res ) ) { 00657 $sqldef = "ALTER TABLE $table ALTER $field SET DEFAULT $res[1]"; 00658 $this->db->query( $sqldef ); 00659 $default = preg_replace( '/\s*DEFAULT .+/', '', $default ); 00660 } 00661 $sql .= " USING $default"; 00662 } 00663 $this->db->query( $sql ); 00664 } 00665 } 00666 00667 protected function setDefault( $table, $field, $default ) { 00668 00669 $info = $this->db->fieldInfo( $table, $field ); 00670 if ( $info->defaultValue() !== $default ) { 00671 $this->output( "Changing '$table.$field' default value\n" ); 00672 $this->db->query( "ALTER TABLE $table ALTER $field SET DEFAULT " . $default ); 00673 } 00674 } 00675 00676 protected function changeNullableField( $table, $field, $null ) { 00677 $fi = $this->db->fieldInfo( $table, $field ); 00678 if ( is_null( $fi ) ) { 00679 $this->output( "...ERROR: expected column $table.$field to exist\n" ); 00680 exit( 1 ); 00681 } 00682 if ( $fi->isNullable() ) { 00683 # # It's NULL - does it need to be NOT NULL? 00684 if ( 'NOT NULL' === $null ) { 00685 $this->output( "Changing '$table.$field' to not allow NULLs\n" ); 00686 $this->db->query( "ALTER TABLE $table ALTER $field SET NOT NULL" ); 00687 } else { 00688 $this->output( "...column '$table.$field' is already set as NULL\n" ); 00689 } 00690 } else { 00691 # # It's NOT NULL - does it need to be NULL? 00692 if ( 'NULL' === $null ) { 00693 $this->output( "Changing '$table.$field' to allow NULLs\n" ); 00694 $this->db->query( "ALTER TABLE $table ALTER $field DROP NOT NULL" ); 00695 } else { 00696 $this->output( "...column '$table.$field' is already set as NOT NULL\n" ); 00697 } 00698 } 00699 } 00700 00701 public function addPgIndex( $table, $index, $type ) { 00702 if ( $this->db->indexExists( $table, $index ) ) { 00703 $this->output( "...index '$index' on table '$table' already exists\n" ); 00704 } else { 00705 $this->output( "Creating index '$index' on table '$table' $type\n" ); 00706 $this->db->query( "CREATE INDEX $index ON $table $type" ); 00707 } 00708 } 00709 00710 public function addPgExtIndex( $table, $index, $type ) { 00711 if ( $this->db->indexExists( $table, $index ) ) { 00712 $this->output( "...index '$index' on table '$table' already exists\n" ); 00713 } else { 00714 if ( preg_match( '/^\(/', $type ) ) { 00715 $this->output( "Creating index '$index' on table '$table'\n" ); 00716 $this->db->query( "CREATE INDEX $index ON $table $type" ); 00717 } else { 00718 $this->applyPatch( $type, true, "Creating index '$index' on table '$table'" ); 00719 } 00720 } 00721 } 00722 00723 protected function changeFkeyDeferrable( $table, $field, $clause ) { 00724 $fi = $this->db->fieldInfo( $table, $field ); 00725 if ( is_null( $fi ) ) { 00726 $this->output( "WARNING! Column '$table.$field' does not exist but it should! " . 00727 "Please report this.\n" ); 00728 00729 return; 00730 } 00731 if ( $fi->is_deferred() && $fi->is_deferrable() ) { 00732 return; 00733 } 00734 $this->output( "Altering column '$table.$field' to be DEFERRABLE INITIALLY DEFERRED\n" ); 00735 $conname = $fi->conname(); 00736 if ( $fi->conname() ) { 00737 $conclause = "CONSTRAINT \"$conname\""; 00738 $command = "ALTER TABLE $table DROP CONSTRAINT $conname"; 00739 $this->db->query( $command ); 00740 } else { 00741 $this->output( "Column '$table.$field' does not have a foreign key " . 00742 "constraint, will be added\n" ); 00743 $conclause = ""; 00744 } 00745 $command = 00746 "ALTER TABLE $table ADD $conclause " . 00747 "FOREIGN KEY ($field) REFERENCES $clause DEFERRABLE INITIALLY DEFERRED"; 00748 $this->db->query( $command ); 00749 } 00750 00751 protected function convertArchive2() { 00752 if ( $this->db->tableExists( "archive2" ) ) { 00753 if ( $this->db->ruleExists( 'archive', 'archive_insert' ) ) { 00754 $this->output( "Dropping rule 'archive_insert'\n" ); 00755 $this->db->query( 'DROP RULE archive_insert ON archive' ); 00756 } 00757 if ( $this->db->ruleExists( 'archive', 'archive_delete' ) ) { 00758 $this->output( "Dropping rule 'archive_delete'\n" ); 00759 $this->db->query( 'DROP RULE archive_delete ON archive' ); 00760 } 00761 $this->applyPatch( 00762 'patch-remove-archive2.sql', 00763 false, 00764 "Converting 'archive2' back to normal archive table" 00765 ); 00766 } else { 00767 $this->output( "...obsolete table 'archive2' does not exist\n" ); 00768 } 00769 } 00770 00771 protected function checkOiDeleted() { 00772 if ( $this->db->fieldInfo( 'oldimage', 'oi_deleted' )->type() !== 'smallint' ) { 00773 $this->output( "Changing 'oldimage.oi_deleted' to type 'smallint'\n" ); 00774 $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT" ); 00775 $this->db->query( 00776 "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" ); 00777 $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted SET DEFAULT 0" ); 00778 } else { 00779 $this->output( "...column 'oldimage.oi_deleted' is already of type 'smallint'\n" ); 00780 } 00781 } 00782 00783 protected function checkOiNameConstraint() { 00784 if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascaded" ) ) { 00785 $this->output( "...table 'oldimage' has correct cascading delete/update " . 00786 "foreign key to image\n" ); 00787 } else { 00788 if ( $this->db->hasConstraint( "oldimage_oi_name_fkey" ) ) { 00789 $this->db->query( 00790 "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" ); 00791 } 00792 if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascade" ) ) { 00793 $this->db->query( 00794 "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey_cascade" ); 00795 } 00796 $this->output( "Making foreign key on table 'oldimage' (to image) a cascade delete/update\n" ); 00797 $this->db->query( 00798 "ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascaded " . 00799 "FOREIGN KEY (oi_name) REFERENCES image(img_name) " . 00800 "ON DELETE CASCADE ON UPDATE CASCADE" ); 00801 } 00802 } 00803 00804 protected function checkPageDeletedTrigger() { 00805 if ( !$this->db->triggerExists( 'page', 'page_deleted' ) ) { 00806 $this->applyPatch( 00807 'patch-page_deleted.sql', 00808 false, 00809 "Adding function and trigger 'page_deleted' to table 'page'" 00810 ); 00811 } else { 00812 $this->output( "...table 'page' has 'page_deleted' trigger\n" ); 00813 } 00814 } 00815 00816 protected function dropIndex( $table, $index, $patch = '', $fullpath = false ) { 00817 if ( $this->db->indexExists( $table, $index ) ) { 00818 $this->output( "Dropping obsolete index '$index'\n" ); 00819 $this->db->query( "DROP INDEX \"" . $index . "\"" ); 00820 } 00821 } 00822 00823 protected function checkIndex( $index, $should_be, $good_def ) { 00824 $pu = $this->db->indexAttributes( $index ); 00825 if ( !empty( $pu ) && $pu != $should_be ) { 00826 $this->output( "Dropping obsolete version of index '$index'\n" ); 00827 $this->db->query( "DROP INDEX \"" . $index . "\"" ); 00828 $pu = array(); 00829 } else { 00830 $this->output( "...no need to drop index '$index'\n" ); 00831 } 00832 00833 if ( empty( $pu ) ) { 00834 $this->output( "Creating index '$index'\n" ); 00835 $this->db->query( $good_def ); 00836 } else { 00837 $this->output( "...index '$index' exists\n" ); 00838 } 00839 } 00840 00841 protected function checkRevUserFkey() { 00842 if ( $this->fkeyDeltype( 'revision_rev_user_fkey' ) == 'r' ) { 00843 $this->output( "...constraint 'revision_rev_user_fkey' is ON DELETE RESTRICT\n" ); 00844 } else { 00845 $this->applyPatch( 00846 'patch-revision_rev_user_fkey.sql', 00847 false, 00848 "Changing constraint 'revision_rev_user_fkey' to ON DELETE RESTRICT" 00849 ); 00850 } 00851 } 00852 00853 protected function checkIwlPrefix() { 00854 if ( $this->db->indexExists( 'iwlinks', 'iwl_prefix' ) ) { 00855 $this->applyPatch( 00856 'patch-rename-iwl_prefix.sql', 00857 false, 00858 "Replacing index 'iwl_prefix' with 'iwl_prefix_title_from'" 00859 ); 00860 } 00861 } 00862 00863 protected function addInterwikiType() { 00864 $this->applyPatch( 'patch-add_interwiki.sql', false, "Refreshing add_interwiki()" ); 00865 } 00866 00867 protected function tsearchFixes() { 00868 # Tweak the page_title tsearch2 trigger to filter out slashes 00869 # This is create or replace, so harmless to call if not needed 00870 $this->applyPatch( 'patch-ts2pagetitle.sql', false, "Refreshing ts2_page_title()" ); 00871 00872 # If the server is 8.3 or higher, rewrite the tsearch2 triggers 00873 # in case they have the old 'default' versions 00874 # Gather version numbers in case we need them 00875 if ( $this->db->getServerVersion() >= 8.3 ) { 00876 $this->applyPatch( 'patch-tsearch2funcs.sql', false, "Rewriting tsearch2 triggers" ); 00877 } 00878 } 00879 }