Index: trunk/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -87,6 +87,16 @@ |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
| 91 | + * Output some text. Right now this is a wrapper for wfOut, but hopefully |
| 92 | + * that function can go away some day :) |
| 93 | + * |
| 94 | + * @param $str String: Text to output |
| 95 | + */ |
| 96 | + protected function output( $str ) { |
| 97 | + wfOut( $str ); |
| 98 | + } |
| 99 | + |
| 100 | + /** |
91 | 101 | * Add a new update coming from an extension. This should be called by |
92 | 102 | * extensions while executing the LoadExtensionSchemaUpdates hook. |
93 | 103 | * |
— | — | @@ -272,11 +282,11 @@ |
273 | 283 | */ |
274 | 284 | protected function addTable( $name, $patch, $fullpath = false ) { |
275 | 285 | if ( $this->db->tableExists( $name ) ) { |
276 | | - wfOut( "...$name table already exists.\n" ); |
| 286 | + $this->output( "...$name table already exists.\n" ); |
277 | 287 | } else { |
278 | | - wfOut( "Creating $name table..." ); |
| 288 | + $this->output( "Creating $name table..." ); |
279 | 289 | $this->applyPatch( $patch, $fullpath ); |
280 | | - wfOut( "ok\n" ); |
| 290 | + $this->output( "ok\n" ); |
281 | 291 | } |
282 | 292 | } |
283 | 293 | |
— | — | @@ -289,13 +299,13 @@ |
290 | 300 | */ |
291 | 301 | protected function addField( $table, $field, $patch, $fullpath = false ) { |
292 | 302 | if ( !$this->db->tableExists( $table ) ) { |
293 | | - wfOut( "...$table table does not exist, skipping new field patch\n" ); |
| 303 | + $this->output( "...$table table does not exist, skipping new field patch\n" ); |
294 | 304 | } elseif ( $this->db->fieldExists( $table, $field ) ) { |
295 | | - wfOut( "...have $field field in $table table.\n" ); |
| 305 | + $this->output( "...have $field field in $table table.\n" ); |
296 | 306 | } else { |
297 | | - wfOut( "Adding $field field to table $table..." ); |
| 307 | + $this->output( "Adding $field field to table $table..." ); |
298 | 308 | $this->applyPatch( $patch, $fullpath ); |
299 | | - wfOut( "ok\n" ); |
| 309 | + $this->output( "ok\n" ); |
300 | 310 | } |
301 | 311 | } |
302 | 312 | |
— | — | @@ -308,11 +318,11 @@ |
309 | 319 | */ |
310 | 320 | function addIndex( $table, $index, $patch, $fullpath = false ) { |
311 | 321 | if ( $this->db->indexExists( $table, $index ) ) { |
312 | | - wfOut( "...$index key already set on $table table.\n" ); |
| 322 | + $this->output( "...$index key already set on $table table.\n" ); |
313 | 323 | } else { |
314 | | - wfOut( "Adding $index key to table $table... " ); |
| 324 | + $this->output( "Adding $index key to table $table... " ); |
315 | 325 | $this->applyPatch( $patch, $fullpath ); |
316 | | - wfOut( "ok\n" ); |
| 326 | + $this->output( "ok\n" ); |
317 | 327 | } |
318 | 328 | } |
319 | 329 | |
— | — | @@ -326,11 +336,11 @@ |
327 | 337 | */ |
328 | 338 | function dropField( $table, $field, $patch, $fullpath = false ) { |
329 | 339 | if ( $this->db->fieldExists( $table, $field ) ) { |
330 | | - wfOut( "Table $table contains $field field. Dropping... " ); |
| 340 | + $this->output( "Table $table contains $field field. Dropping... " ); |
331 | 341 | $this->applyPatch( $patch, $fullpath ); |
332 | | - wfOut( "ok\n" ); |
| 342 | + $this->output( "ok\n" ); |
333 | 343 | } else { |
334 | | - wfOut( "...$table table does not contain $field field.\n" ); |
| 344 | + $this->output( "...$table table does not contain $field field.\n" ); |
335 | 345 | } |
336 | 346 | } |
337 | 347 | |
— | — | @@ -344,11 +354,11 @@ |
345 | 355 | */ |
346 | 356 | function dropIndex( $table, $index, $patch, $fullpath = false ) { |
347 | 357 | if ( $this->db->indexExists( $table, $index ) ) { |
348 | | - wfOut( "Dropping $index from table $table... " ); |
| 358 | + $this->output( "Dropping $index from table $table... " ); |
349 | 359 | $this->applyPatch( $patch, $fullpath ); |
350 | | - wfOut( "ok\n" ); |
| 360 | + $this->output( "ok\n" ); |
351 | 361 | } else { |
352 | | - wfOut( "...$index key doesn't exist.\n" ); |
| 362 | + $this->output( "...$index key doesn't exist.\n" ); |
353 | 363 | } |
354 | 364 | } |
355 | 365 | |
— | — | @@ -362,13 +372,13 @@ |
363 | 373 | */ |
364 | 374 | public function modifyField( $table, $field, $patch, $fullpath = false ) { |
365 | 375 | if ( !$this->db->tableExists( $table ) ) { |
366 | | - wfOut( "...$table table does not exist, skipping modify field patch\n" ); |
| 376 | + $this->output( "...$table table does not exist, skipping modify field patch\n" ); |
367 | 377 | } elseif ( !$this->db->fieldExists( $table, $field ) ) { |
368 | | - wfOut( "...$field field does not exist in $table table, skipping modify field patch\n" ); |
| 378 | + $this->output( "...$field field does not exist in $table table, skipping modify field patch\n" ); |
369 | 379 | } else { |
370 | | - wfOut( "Modifying $field field of table $table..." ); |
| 380 | + $this->output( "Modifying $field field of table $table..." ); |
371 | 381 | $this->applyPatch( $patch, $fullpath ); |
372 | | - wfOut( "ok\n" ); |
| 382 | + $this->output( "ok\n" ); |
373 | 383 | } |
374 | 384 | } |
375 | 385 | |
— | — | @@ -378,23 +388,23 @@ |
379 | 389 | protected function purgeCache() { |
380 | 390 | # We can't guarantee that the user will be able to use TRUNCATE, |
381 | 391 | # but we know that DELETE is available to us |
382 | | - wfOut( "Purging caches..." ); |
| 392 | + $this->output( "Purging caches..." ); |
383 | 393 | $this->db->delete( 'objectcache', '*', __METHOD__ ); |
384 | | - wfOut( "done.\n" ); |
| 394 | + $this->output( "done.\n" ); |
385 | 395 | } |
386 | 396 | |
387 | 397 | /** |
388 | 398 | * Check the site_stats table is not properly populated. |
389 | 399 | */ |
390 | 400 | protected function checkStats() { |
391 | | - wfOut( "Checking site_stats row..." ); |
| 401 | + $this->output( "Checking site_stats row..." ); |
392 | 402 | $row = $this->db->selectRow( 'site_stats', '*', array( 'ss_row_id' => 1 ), __METHOD__ ); |
393 | 403 | if ( $row === false ) { |
394 | | - wfOut( "data is missing! rebuilding...\n" ); |
| 404 | + $this->output( "data is missing! rebuilding...\n" ); |
395 | 405 | } elseif ( isset( $row->site_stats ) && $row->ss_total_pages == -1 ) { |
396 | | - wfOut( "missing ss_total_pages, rebuilding...\n" ); |
| 406 | + $this->output( "missing ss_total_pages, rebuilding...\n" ); |
397 | 407 | } else { |
398 | | - wfOut( "done.\n" ); |
| 408 | + $this->output( "done.\n" ); |
399 | 409 | return; |
400 | 410 | } |
401 | 411 | SiteStatsInit::doAllAndCommit( false ); |
— | — | @@ -414,33 +424,33 @@ |
415 | 425 | array( 'ss_row_id' => 1 ), __METHOD__, array( 'LIMIT' => 1 ) |
416 | 426 | ); |
417 | 427 | } |
418 | | - wfOut( "...ss_active_users user count set...\n" ); |
| 428 | + $this->output( "...ss_active_users user count set...\n" ); |
419 | 429 | } |
420 | 430 | |
421 | 431 | protected function doLogSearchPopulation() { |
422 | 432 | if ( $this->updateRowExists( 'populate log_search' ) ) { |
423 | | - wfOut( "...log_search table already populated.\n" ); |
| 433 | + $this->output( "...log_search table already populated.\n" ); |
424 | 434 | return; |
425 | 435 | } |
426 | 436 | |
427 | | - wfOut( |
| 437 | + $this->output( |
428 | 438 | "Populating log_search table, printing progress markers. For large\n" . |
429 | 439 | "databases, you may want to hit Ctrl-C and do this manually with\n" . |
430 | 440 | "maintenance/populateLogSearch.php.\n" ); |
431 | 441 | $task = new PopulateLogSearch(); |
432 | 442 | $task->execute(); |
433 | | - wfOut( "Done populating log_search table.\n" ); |
| 443 | + $this->output( "Done populating log_search table.\n" ); |
434 | 444 | } |
435 | 445 | |
436 | 446 | function doUpdateTranscacheField() { |
437 | 447 | if ( $this->updateRowExists( 'convert transcache field' ) ) { |
438 | | - wfOut( "...transcache tc_time already converted.\n" ); |
| 448 | + $this->output( "...transcache tc_time already converted.\n" ); |
439 | 449 | return; |
440 | 450 | } |
441 | 451 | |
442 | | - wfOut( "Converting tc_time from UNIX epoch to MediaWiki timestamp... " ); |
| 452 | + $this->output( "Converting tc_time from UNIX epoch to MediaWiki timestamp... " ); |
443 | 453 | $this->applyPatch( 'patch-tc-timestamp.sql' ); |
444 | | - wfOut( "ok\n" ); |
| 454 | + $this->output( "ok\n" ); |
445 | 455 | } |
446 | 456 | |
447 | 457 | protected function doCollationUpdate() { |
— | — | @@ -451,7 +461,7 @@ |
452 | 462 | 'cl_collation != ' . $this->db->addQuotes( $wgCategoryCollation ), |
453 | 463 | __METHOD__ |
454 | 464 | ) == 0 ) { |
455 | | - wfOut( "...collations up-to-date.\n" ); |
| 465 | + $this->output( "...collations up-to-date.\n" ); |
456 | 466 | return; |
457 | 467 | } |
458 | 468 | |
Index: trunk/phase3/includes/installer/MysqlUpdater.php |
— | — | @@ -188,11 +188,11 @@ |
189 | 189 | $flags = explode( ' ', mysql_field_flags( $res->result, 0 ) ); |
190 | 190 | |
191 | 191 | if ( in_array( 'binary', $flags ) ) { |
192 | | - wfOut( "...$table table has correct $field encoding.\n" ); |
| 192 | + $this->output( "...$table table has correct $field encoding.\n" ); |
193 | 193 | } else { |
194 | | - wfOut( "Fixing $field encoding on $table table... " ); |
| 194 | + $this->output( "Fixing $field encoding on $table table... " ); |
195 | 195 | $this->db->applyPatch( $patchFile ); |
196 | | - wfOut( "ok\n" ); |
| 196 | + $this->output( "ok\n" ); |
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
— | — | @@ -209,12 +209,12 @@ |
210 | 210 | if ( $info ) { |
211 | 211 | foreach ( $info as $row ) { |
212 | 212 | if ( $row->Column_name == $field ) { |
213 | | - wfOut( "...index $index on table $table includes field $field\n" ); |
| 213 | + $this->output( "...index $index on table $table includes field $field\n" ); |
214 | 214 | return true; |
215 | 215 | } |
216 | 216 | } |
217 | 217 | } |
218 | | - wfOut( "...index $index on table $table has no field $field; adding\n" ); |
| 218 | + $this->output( "...index $index on table $table has no field $field; adding\n" ); |
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | |
— | — | @@ -225,16 +225,16 @@ |
226 | 226 | global $IP; |
227 | 227 | |
228 | 228 | if ( $this->db->tableExists( "interwiki" ) ) { |
229 | | - wfOut( "...already have interwiki table\n" ); |
| 229 | + $this->output( "...already have interwiki table\n" ); |
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | | - wfOut( 'Creating interwiki table...' ); |
| 233 | + $this->output( 'Creating interwiki table...' ); |
234 | 234 | $this->applyPatch( 'patch-interwiki.sql' ); |
235 | | - wfOut( "ok\n" ); |
236 | | - wfOut( 'Adding default interwiki definitions...' ); |
| 235 | + $this->output( "ok\n" ); |
| 236 | + $this->output( 'Adding default interwiki definitions...' ); |
237 | 237 | $this->applyPatch( "$IP/maintenance/interwiki.sql", true ); |
238 | | - wfOut( "ok\n" ); |
| 238 | + $this->output( "ok\n" ); |
239 | 239 | } |
240 | 240 | |
241 | 241 | /** |
— | — | @@ -243,13 +243,13 @@ |
244 | 244 | protected function doIndexUpdate() { |
245 | 245 | $meta = $this->db->fieldInfo( 'recentchanges', 'rc_timestamp' ); |
246 | 246 | if ( $meta->isMultipleKey() ) { |
247 | | - wfOut( "...indexes seem up to 20031107 standards\n" ); |
| 247 | + $this->output( "...indexes seem up to 20031107 standards\n" ); |
248 | 248 | return; |
249 | 249 | } |
250 | 250 | |
251 | | - wfOut( "Updating indexes to 20031107..." ); |
| 251 | + $this->output( "Updating indexes to 20031107..." ); |
252 | 252 | $this->applyPatch( 'patch-indexes.sql', true ); |
253 | | - wfOut( "ok\n" ); |
| 253 | + $this->output( "ok\n" ); |
254 | 254 | } |
255 | 255 | |
256 | 256 | protected function doOldLinksUpdate() { |
— | — | @@ -260,14 +260,14 @@ |
261 | 261 | protected function doFixAncientImagelinks() { |
262 | 262 | $info = $this->db->fieldInfo( 'imagelinks', 'il_from' ); |
263 | 263 | if ( !$info || $info->type() !== 'string' ) { |
264 | | - wfOut( "...il_from OK\n" ); |
| 264 | + $this->output( "...il_from OK\n" ); |
265 | 265 | return; |
266 | 266 | } |
267 | 267 | |
268 | | - wfOut( "Fixing ancient broken imagelinks table.\n" ); |
269 | | - wfOut( "NOTE: you will have to run maintenance/refreshLinks.php after this.\n" ); |
| 268 | + $this->output( "Fixing ancient broken imagelinks table.\n" ); |
| 269 | + $this->output( "NOTE: you will have to run maintenance/refreshLinks.php after this.\n" ); |
270 | 270 | $this->applyPatch( 'patch-fix-il_from.sql' ); |
271 | | - wfOut( "ok\n" ); |
| 271 | + $this->output( "ok\n" ); |
272 | 272 | } |
273 | 273 | |
274 | 274 | /** |
— | — | @@ -277,11 +277,11 @@ |
278 | 278 | $talk = $this->db->selectField( 'watchlist', 'count(*)', 'wl_namespace & 1', __METHOD__ ); |
279 | 279 | $nontalk = $this->db->selectField( 'watchlist', 'count(*)', 'NOT (wl_namespace & 1)', __METHOD__ ); |
280 | 280 | if ( $talk == $nontalk ) { |
281 | | - wfOut( "...watchlist talk page rows already present\n" ); |
| 281 | + $this->output( "...watchlist talk page rows already present\n" ); |
282 | 282 | return; |
283 | 283 | } |
284 | 284 | |
285 | | - wfOut( "Adding missing watchlist talk page rows... " ); |
| 285 | + $this->output( "Adding missing watchlist talk page rows... " ); |
286 | 286 | $this->db->insertSelect( 'watchlist', 'watchlist', |
287 | 287 | array( |
288 | 288 | 'wl_user' => 'wl_user', |
— | — | @@ -289,18 +289,18 @@ |
290 | 290 | 'wl_title' => 'wl_title', |
291 | 291 | 'wl_notificationtimestamp' => 'wl_notificationtimestamp' |
292 | 292 | ), array( 'NOT (wl_namespace & 1)' ), __METHOD__, 'IGNORE' ); |
293 | | - wfOut( "ok\n" ); |
| 293 | + $this->output( "ok\n" ); |
294 | 294 | } |
295 | 295 | |
296 | 296 | function doSchemaRestructuring() { |
297 | 297 | if ( $this->db->tableExists( 'page' ) ) { |
298 | | - wfOut( "...page table already exists.\n" ); |
| 298 | + $this->output( "...page table already exists.\n" ); |
299 | 299 | return; |
300 | 300 | } |
301 | 301 | |
302 | | - wfOut( "...converting from cur/old to page/revision/text DB structure.\n" ); |
303 | | - wfOut( wfTimestamp( TS_DB ) ); |
304 | | - wfOut( "......checking for duplicate entries.\n" ); |
| 302 | + $this->output( "...converting from cur/old to page/revision/text DB structure.\n" ); |
| 303 | + $this->output( wfTimestamp( TS_DB ) ); |
| 304 | + $this->output( "......checking for duplicate entries.\n" ); |
305 | 305 | |
306 | 306 | list ( $cur, $old, $page, $revision, $text ) = $this->db->tableNamesN( 'cur', 'old', 'page', 'revision', 'text' ); |
307 | 307 | |
— | — | @@ -308,15 +308,15 @@ |
309 | 309 | FROM $cur GROUP BY cur_title, cur_namespace HAVING c>1", __METHOD__ ); |
310 | 310 | |
311 | 311 | if ( $rows->numRows() > 0 ) { |
312 | | - wfOut( wfTimestamp( TS_DB ) ); |
313 | | - wfOut( "......<b>Found duplicate entries</b>\n" ); |
314 | | - wfOut( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) ); |
| 312 | + $this->output( wfTimestamp( TS_DB ) ); |
| 313 | + $this->output( "......<b>Found duplicate entries</b>\n" ); |
| 314 | + $this->output( sprintf( "<b> %-60s %3s %5s</b>\n", 'Title', 'NS', 'Count' ) ); |
315 | 315 | foreach ( $rows as $row ) { |
316 | 316 | if ( ! isset( $duplicate[$row->cur_namespace] ) ) { |
317 | 317 | $duplicate[$row->cur_namespace] = array(); |
318 | 318 | } |
319 | 319 | $duplicate[$row->cur_namespace][] = $row->cur_title; |
320 | | - wfOut( sprintf( " %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) ); |
| 320 | + $this->output( sprintf( " %-60s %3s %5s\n", $row->cur_title, $row->cur_namespace, $row->c ) ); |
321 | 321 | } |
322 | 322 | $sql = "SELECT cur_title, cur_namespace, cur_id, cur_timestamp FROM $cur WHERE "; |
323 | 323 | $firstCond = true; |
— | — | @@ -356,13 +356,13 @@ |
357 | 357 | } |
358 | 358 | $sql = "DELETE FROM $cur WHERE cur_id IN ( " . join( ',', $deleteId ) . ')'; |
359 | 359 | $rows = $this->db->query( $sql, __METHOD__ ); |
360 | | - wfOut( wfTimestamp( TS_DB ) ); |
361 | | - wfOut( "......<b>Deleted</b> " . $this->db->affectedRows() . " records.\n" ); |
| 360 | + $this->output( wfTimestamp( TS_DB ) ); |
| 361 | + $this->output( "......<b>Deleted</b> " . $this->db->affectedRows() . " records.\n" ); |
362 | 362 | } |
363 | 363 | |
364 | 364 | |
365 | | - wfOut( wfTimestamp( TS_DB ) ); |
366 | | - wfOut( "......Creating tables.\n" ); |
| 365 | + $this->output( wfTimestamp( TS_DB ) ); |
| 366 | + $this->output( "......Creating tables.\n" ); |
367 | 367 | $this->db->query( "CREATE TABLE $page ( |
368 | 368 | page_id int(8) unsigned NOT NULL auto_increment, |
369 | 369 | page_namespace int NOT NULL, |
— | — | @@ -400,26 +400,26 @@ |
401 | 401 | INDEX usertext_timestamp (rev_user_text,rev_timestamp) |
402 | 402 | ) ENGINE=InnoDB", __METHOD__ ); |
403 | 403 | |
404 | | - wfOut( wfTimestamp( TS_DB ) ); |
405 | | - wfOut( "......Locking tables.\n" ); |
| 404 | + $this->output( wfTimestamp( TS_DB ) ); |
| 405 | + $this->output( "......Locking tables.\n" ); |
406 | 406 | $this->db->query( "LOCK TABLES $page WRITE, $revision WRITE, $old WRITE, $cur WRITE", __METHOD__ ); |
407 | 407 | |
408 | 408 | $maxold = intval( $this->db->selectField( 'old', 'max(old_id)', '', __METHOD__ ) ); |
409 | | - wfOut( wfTimestamp( TS_DB ) ); |
410 | | - wfOut( "......maxold is {$maxold}\n" ); |
| 409 | + $this->output( wfTimestamp( TS_DB ) ); |
| 410 | + $this->output( "......maxold is {$maxold}\n" ); |
411 | 411 | |
412 | | - wfOut( wfTimestamp( TS_DB ) ); |
| 412 | + $this->output( wfTimestamp( TS_DB ) ); |
413 | 413 | global $wgLegacySchemaConversion; |
414 | 414 | if ( $wgLegacySchemaConversion ) { |
415 | 415 | // Create HistoryBlobCurStub entries. |
416 | 416 | // Text will be pulled from the leftover 'cur' table at runtime. |
417 | | - wfOut( "......Moving metadata from cur; using blob references to text in cur table.\n" ); |
| 417 | + $this->output( "......Moving metadata from cur; using blob references to text in cur table.\n" ); |
418 | 418 | $cur_text = "concat('O:18:\"historyblobcurstub\":1:{s:6:\"mCurId\";i:',cur_id,';}')"; |
419 | 419 | $cur_flags = "'object'"; |
420 | 420 | } else { |
421 | 421 | // Copy all cur text in immediately: this may take longer but avoids |
422 | 422 | // having to keep an extra table around. |
423 | | - wfOut( "......Moving text from cur.\n" ); |
| 423 | + $this->output( "......Moving text from cur.\n" ); |
424 | 424 | $cur_text = 'cur_text'; |
425 | 425 | $cur_flags = "''"; |
426 | 426 | } |
— | — | @@ -428,16 +428,16 @@ |
429 | 429 | SELECT cur_namespace, cur_title, $cur_text, cur_comment, cur_user, cur_user_text, cur_timestamp, cur_minor_edit, $cur_flags |
430 | 430 | FROM $cur", __METHOD__ ); |
431 | 431 | |
432 | | - wfOut( wfTimestamp( TS_DB ) ); |
433 | | - wfOut( "......Setting up revision table.\n" ); |
| 432 | + $this->output( wfTimestamp( TS_DB ) ); |
| 433 | + $this->output( "......Setting up revision table.\n" ); |
434 | 434 | $this->db->query( "INSERT INTO $revision (rev_id, rev_page, rev_comment, rev_user, rev_user_text, rev_timestamp, |
435 | 435 | rev_minor_edit) |
436 | 436 | SELECT old_id, cur_id, old_comment, old_user, old_user_text, |
437 | 437 | old_timestamp, old_minor_edit |
438 | 438 | FROM $old,$cur WHERE old_namespace=cur_namespace AND old_title=cur_title", __METHOD__ ); |
439 | 439 | |
440 | | - wfOut( wfTimestamp( TS_DB ) ); |
441 | | - wfOut( "......Setting up page table.\n" ); |
| 440 | + $this->output( wfTimestamp( TS_DB ) ); |
| 441 | + $this->output( "......Setting up page table.\n" ); |
442 | 442 | $this->db->query( "INSERT INTO $page (page_id, page_namespace, page_title, page_restrictions, page_counter, |
443 | 443 | page_is_redirect, page_is_new, page_random, page_touched, page_latest, page_len) |
444 | 444 | SELECT cur_id, cur_namespace, cur_title, cur_restrictions, cur_counter, cur_is_redirect, cur_is_new, |
— | — | @@ -445,16 +445,16 @@ |
446 | 446 | FROM $cur,$revision |
447 | 447 | WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}", __METHOD__ ); |
448 | 448 | |
449 | | - wfOut( wfTimestamp( TS_DB ) ); |
450 | | - wfOut( "......Unlocking tables.\n" ); |
| 449 | + $this->output( wfTimestamp( TS_DB ) ); |
| 450 | + $this->output( "......Unlocking tables.\n" ); |
451 | 451 | $this->db->query( "UNLOCK TABLES", __METHOD__ ); |
452 | 452 | |
453 | | - wfOut( wfTimestamp( TS_DB ) ); |
454 | | - wfOut( "......Renaming old.\n" ); |
| 453 | + $this->output( wfTimestamp( TS_DB ) ); |
| 454 | + $this->output( "......Renaming old.\n" ); |
455 | 455 | $this->db->query( "ALTER TABLE $old RENAME TO $text", __METHOD__ ); |
456 | 456 | |
457 | | - wfOut( wfTimestamp( TS_DB ) ); |
458 | | - wfOut( "...done.\n" ); |
| 457 | + $this->output( wfTimestamp( TS_DB ) ); |
| 458 | + $this->output( "...done.\n" ); |
459 | 459 | } |
460 | 460 | |
461 | 461 | protected function doNamespaceSize() { |
— | — | @@ -474,24 +474,24 @@ |
475 | 475 | $info = $this->db->fetchObject( $result ); |
476 | 476 | |
477 | 477 | if ( substr( $info->Type, 0, 3 ) == 'int' ) { |
478 | | - wfOut( "...$field is already a full int ($info->Type).\n" ); |
| 478 | + $this->output( "...$field is already a full int ($info->Type).\n" ); |
479 | 479 | } else { |
480 | | - wfOut( "Promoting $field from $info->Type to int... " ); |
| 480 | + $this->output( "Promoting $field from $info->Type to int... " ); |
481 | 481 | $this->db->query( "ALTER TABLE $tablename MODIFY $field int NOT NULL", __METHOD__ ); |
482 | | - wfOut( "ok\n" ); |
| 482 | + $this->output( "ok\n" ); |
483 | 483 | } |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | 487 | protected function doPagelinksUpdate() { |
488 | 488 | if ( $this->db->tableExists( 'pagelinks' ) ) { |
489 | | - wfOut( "...already have pagelinks table.\n" ); |
| 489 | + $this->output( "...already have pagelinks table.\n" ); |
490 | 490 | return; |
491 | 491 | } |
492 | 492 | |
493 | | - wfOut( "Converting links and brokenlinks tables to pagelinks... " ); |
| 493 | + $this->output( "Converting links and brokenlinks tables to pagelinks... " ); |
494 | 494 | $this->applyPatch( 'patch-pagelinks.sql' ); |
495 | | - wfOut( "ok\n" ); |
| 495 | + $this->output( "ok\n" ); |
496 | 496 | |
497 | 497 | global $wgContLang; |
498 | 498 | foreach ( MWNamespace::getCanonicalNamespaces() as $ns => $name ) { |
— | — | @@ -499,7 +499,7 @@ |
500 | 500 | continue; |
501 | 501 | } |
502 | 502 | |
503 | | - wfOut( "Cleaning up broken links for namespace $ns... " ); |
| 503 | + $this->output( "Cleaning up broken links for namespace $ns... " ); |
504 | 504 | |
505 | 505 | $pagelinks = $this->db->tableName( 'pagelinks' ); |
506 | 506 | $name = $wgContLang->getNsText( $ns ); |
— | — | @@ -513,23 +513,23 @@ |
514 | 514 | AND pl_title LIKE '$likeprefix:%'"; |
515 | 515 | |
516 | 516 | $this->db->query( $sql, __METHOD__ ); |
517 | | - wfOut( "ok\n" ); |
| 517 | + $this->output( "ok\n" ); |
518 | 518 | } |
519 | 519 | } |
520 | 520 | |
521 | 521 | protected function doUserUniqueUpdate() { |
522 | 522 | $duper = new UserDupes( $this->db ); |
523 | 523 | if ( $duper->hasUniqueIndex() ) { |
524 | | - wfOut( "...already have unique user_name index.\n" ); |
| 524 | + $this->output( "...already have unique user_name index.\n" ); |
525 | 525 | return; |
526 | 526 | } |
527 | 527 | |
528 | 528 | if ( !$duper->clearDupes() ) { |
529 | | - wfOut( "WARNING: This next step will probably fail due to unfixed duplicates...\n" ); |
| 529 | + $this->output( "WARNING: This next step will probably fail due to unfixed duplicates...\n" ); |
530 | 530 | } |
531 | | - wfOut( "Adding unique index on user_name... " ); |
| 531 | + $this->output( "Adding unique index on user_name... " ); |
532 | 532 | $this->applyPatch( 'patch-user_nameindex.sql' ); |
533 | | - wfOut( "ok\n" ); |
| 533 | + $this->output( "ok\n" ); |
534 | 534 | } |
535 | 535 | |
536 | 536 | protected function doUserGroupsUpdate() { |
— | — | @@ -538,42 +538,42 @@ |
539 | 539 | if ( $info->type() == 'int' ) { |
540 | 540 | $oldug = $this->db->tableName( 'user_groups' ); |
541 | 541 | $newug = $this->db->tableName( 'user_groups_bogus' ); |
542 | | - wfOut( "user_groups table exists but is in bogus intermediate format. Renaming to $newug... " ); |
| 542 | + $this->output( "user_groups table exists but is in bogus intermediate format. Renaming to $newug... " ); |
543 | 543 | $this->db->query( "ALTER TABLE $oldug RENAME TO $newug", __METHOD__ ); |
544 | | - wfOut( "ok\n" ); |
| 544 | + $this->output( "ok\n" ); |
545 | 545 | |
546 | | - wfOut( "Re-adding fresh user_groups table... " ); |
| 546 | + $this->output( "Re-adding fresh user_groups table... " ); |
547 | 547 | $this->applyPatch( 'patch-user_groups.sql' ); |
548 | | - wfOut( "ok\n" ); |
| 548 | + $this->output( "ok\n" ); |
549 | 549 | |
550 | | - wfOut( "***\n" ); |
551 | | - wfOut( "*** WARNING: You will need to manually fix up user permissions in the user_groups\n" ); |
552 | | - wfOut( "*** table. Old 1.5 alpha versions did some pretty funky stuff...\n" ); |
553 | | - wfOut( "***\n" ); |
| 550 | + $this->output( "***\n" ); |
| 551 | + $this->output( "*** WARNING: You will need to manually fix up user permissions in the user_groups\n" ); |
| 552 | + $this->output( "*** table. Old 1.5 alpha versions did some pretty funky stuff...\n" ); |
| 553 | + $this->output( "***\n" ); |
554 | 554 | } else { |
555 | | - wfOut( "...user_groups table exists and is in current format.\n" ); |
| 555 | + $this->output( "...user_groups table exists and is in current format.\n" ); |
556 | 556 | } |
557 | 557 | return; |
558 | 558 | } |
559 | 559 | |
560 | | - wfOut( "Adding user_groups table... " ); |
| 560 | + $this->output( "Adding user_groups table... " ); |
561 | 561 | $this->applyPatch( 'patch-user_groups.sql' ); |
562 | | - wfOut( "ok\n" ); |
| 562 | + $this->output( "ok\n" ); |
563 | 563 | |
564 | 564 | if ( !$this->db->tableExists( 'user_rights' ) ) { |
565 | 565 | if ( $this->db->fieldExists( 'user', 'user_rights' ) ) { |
566 | | - wfOut( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." ); |
| 566 | + $this->output( "Upgrading from a 1.3 or older database? Breaking out user_rights for conversion..." ); |
567 | 567 | $this->db->applyPatch( 'patch-user_rights.sql' ); |
568 | | - wfOut( "ok\n" ); |
| 568 | + $this->output( "ok\n" ); |
569 | 569 | } else { |
570 | | - wfOut( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" ); |
571 | | - wfOut( "*** You may need to manually configure some sysops by manipulating\n" ); |
572 | | - wfOut( "*** the user_groups table.\n" ); |
| 570 | + $this->output( "*** WARNING: couldn't locate user_rights table or field for upgrade.\n" ); |
| 571 | + $this->output( "*** You may need to manually configure some sysops by manipulating\n" ); |
| 572 | + $this->output( "*** the user_groups table.\n" ); |
573 | 573 | return; |
574 | 574 | } |
575 | 575 | } |
576 | 576 | |
577 | | - wfOut( "Converting user_rights table to user_groups... " ); |
| 577 | + $this->output( "Converting user_rights table to user_groups... " ); |
578 | 578 | $result = $this->db->select( 'user_rights', |
579 | 579 | array( 'ur_user', 'ur_rights' ), |
580 | 580 | array( "ur_rights != ''" ), |
— | — | @@ -592,7 +592,7 @@ |
593 | 593 | __METHOD__ ); |
594 | 594 | } |
595 | 595 | } |
596 | | - wfOut( "ok\n" ); |
| 596 | + $this->output( "ok\n" ); |
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
— | — | @@ -602,13 +602,13 @@ |
603 | 603 | protected function doWatchlistNull() { |
604 | 604 | $info = $this->db->fieldInfo( 'watchlist', 'wl_notificationtimestamp' ); |
605 | 605 | if ( $info->nullable() ) { |
606 | | - wfOut( "...wl_notificationtimestamp is already nullable.\n" ); |
| 606 | + $this->output( "...wl_notificationtimestamp is already nullable.\n" ); |
607 | 607 | return; |
608 | 608 | } |
609 | 609 | |
610 | | - wfOut( "Making wl_notificationtimestamp nullable... " ); |
| 610 | + $this->output( "Making wl_notificationtimestamp nullable... " ); |
611 | 611 | $this->applyPatch( 'patch-watchlist-null.sql' ); |
612 | | - wfOut( "ok\n" ); |
| 612 | + $this->output( "ok\n" ); |
613 | 613 | } |
614 | 614 | |
615 | 615 | /** |
— | — | @@ -617,24 +617,24 @@ |
618 | 618 | * @see bug 3946 |
619 | 619 | */ |
620 | 620 | protected function doPageRandomUpdate() { |
621 | | - wfOut( "Setting page_random to a random value on rows where it equals 0..." ); |
| 621 | + $this->output( "Setting page_random to a random value on rows where it equals 0..." ); |
622 | 622 | |
623 | 623 | $page = $this->db->tableName( 'page' ); |
624 | 624 | $this->db->query( "UPDATE $page SET page_random = RAND() WHERE page_random = 0", __METHOD__ ); |
625 | 625 | $rows = $this->db->affectedRows(); |
626 | 626 | |
627 | | - wfOut( "changed $rows rows\n" ); |
| 627 | + $this->output( "changed $rows rows\n" ); |
628 | 628 | } |
629 | 629 | |
630 | 630 | protected function doTemplatelinksUpdate() { |
631 | 631 | if ( $this->db->tableExists( 'templatelinks' ) ) { |
632 | | - wfOut( "...templatelinks table already exists\n" ); |
| 632 | + $this->output( "...templatelinks table already exists\n" ); |
633 | 633 | return; |
634 | 634 | } |
635 | 635 | |
636 | | - wfOut( "Creating templatelinks table...\n" ); |
| 636 | + $this->output( "Creating templatelinks table...\n" ); |
637 | 637 | $this->applyPatch( 'patch-templatelinks.sql' ); |
638 | | - wfOut( "Populating...\n" ); |
| 638 | + $this->output( "Populating...\n" ); |
639 | 639 | if ( wfGetLB()->getServerCount() > 1 ) { |
640 | 640 | // Slow, replication-friendly update |
641 | 641 | $res = $this->db->select( 'pagelinks', array( 'pl_from', 'pl_namespace', 'pl_title' ), |
— | — | @@ -666,7 +666,7 @@ |
667 | 667 | ), __METHOD__ |
668 | 668 | ); |
669 | 669 | } |
670 | | - wfOut( "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n" ); |
| 670 | + $this->output( "Done. Please run maintenance/refreshLinks.php for a more thorough templatelinks update.\n" ); |
671 | 671 | } |
672 | 672 | |
673 | 673 | protected function doBacklinkingIndicesUpdate() { |
— | — | @@ -675,7 +675,7 @@ |
676 | 676 | !$this->indexHasField( 'imagelinks', 'il_to', 'il_from' ) ) |
677 | 677 | { |
678 | 678 | $this->applyPatch( 'patch-backlinkindexes.sql' ); |
679 | | - wfOut( "...backlinking indices updated\n" ); |
| 679 | + $this->output( "...backlinking indices updated\n" ); |
680 | 680 | } |
681 | 681 | } |
682 | 682 | |
— | — | @@ -686,16 +686,16 @@ |
687 | 687 | */ |
688 | 688 | protected function doRestrictionsUpdate() { |
689 | 689 | if ( $this->db->tableExists( 'page_restrictions' ) ) { |
690 | | - wfOut( "...page_restrictions table already exists.\n" ); |
| 690 | + $this->output( "...page_restrictions table already exists.\n" ); |
691 | 691 | return; |
692 | 692 | } |
693 | 693 | |
694 | | - wfOut( "Creating page_restrictions table..." ); |
| 694 | + $this->output( "Creating page_restrictions table..." ); |
695 | 695 | $this->applyPatch( 'patch-page_restrictions.sql' ); |
696 | 696 | $this->applyPatch( 'patch-page_restrictions_sortkey.sql' ); |
697 | | - wfOut( "ok\n" ); |
| 697 | + $this->output( "ok\n" ); |
698 | 698 | |
699 | | - wfOut( "Migrating old restrictions to new table...\n" ); |
| 699 | + $this->output( "Migrating old restrictions to new table...\n" ); |
700 | 700 | $task = new UpdateRestrictions(); |
701 | 701 | $task->execute(); |
702 | 702 | } |
— | — | @@ -703,17 +703,17 @@ |
704 | 704 | protected function doCategorylinksIndicesUpdate() { |
705 | 705 | if ( !$this->indexHasField( 'categorylinks', 'cl_sortkey', 'cl_from' ) ) { |
706 | 706 | $this->applyPatch( 'patch-categorylinksindex.sql' ); |
707 | | - wfOut( "...categorylinks indices updated\n" ); |
| 707 | + $this->output( "...categorylinks indices updated\n" ); |
708 | 708 | } |
709 | 709 | } |
710 | 710 | |
711 | 711 | protected function doCategoryPopulation() { |
712 | 712 | if ( $this->updateRowExists( 'populate category' ) ) { |
713 | | - wfOut( "...category table already populated.\n" ); |
| 713 | + $this->output( "...category table already populated.\n" ); |
714 | 714 | return; |
715 | 715 | } |
716 | 716 | |
717 | | - wfOut( |
| 717 | + $this->output( |
718 | 718 | "Populating category table, printing progress markers. " . |
719 | 719 | "For large databases, you\n" . |
720 | 720 | "may want to hit Ctrl-C and do this manually with maintenance/\n" . |
— | — | @@ -721,12 +721,12 @@ |
722 | 722 | ); |
723 | 723 | $task = new PopulateCategory(); |
724 | 724 | $task->execute(); |
725 | | - wfOut( "Done populating category table.\n" ); |
| 725 | + $this->output( "Done populating category table.\n" ); |
726 | 726 | } |
727 | 727 | |
728 | 728 | protected function doPopulateParentId() { |
729 | 729 | if ( $this->updateRowExists( 'populate rev_parent_id' ) ) { |
730 | | - wfOut( "...rev_parent_id column already populated.\n" ); |
| 730 | + $this->output( "...rev_parent_id column already populated.\n" ); |
731 | 731 | return; |
732 | 732 | } |
733 | 733 | |
— | — | @@ -738,11 +738,11 @@ |
739 | 739 | if ( !$this->db->tableExists( 'profiling' ) ) { |
740 | 740 | // Simply ignore |
741 | 741 | } elseif ( $this->db->fieldExists( 'profiling', 'pf_memory' ) ) { |
742 | | - wfOut( "...profiling table has pf_memory field.\n" ); |
| 742 | + $this->output( "...profiling table has pf_memory field.\n" ); |
743 | 743 | } else { |
744 | | - wfOut( "Adding pf_memory field to table profiling..." ); |
| 744 | + $this->output( "Adding pf_memory field to table profiling..." ); |
745 | 745 | $this->applyPatch( 'patch-profiling-memory.sql' ); |
746 | | - wfOut( "ok\n" ); |
| 746 | + $this->output( "ok\n" ); |
747 | 747 | } |
748 | 748 | } |
749 | 749 | |
— | — | @@ -750,47 +750,47 @@ |
751 | 751 | $info = $this->db->indexInfo( 'filearchive', 'fa_user_timestamp', __METHOD__ ); |
752 | 752 | if ( !$info ) { |
753 | 753 | $this->applyPatch( 'patch-filearchive-user-index.sql' ); |
754 | | - wfOut( "...filearchive indices updated\n" ); |
| 754 | + $this->output( "...filearchive indices updated\n" ); |
755 | 755 | } |
756 | 756 | } |
757 | 757 | |
758 | 758 | protected function doUniquePlTlIl() { |
759 | 759 | $info = $this->db->indexInfo( 'pagelinks', 'pl_namespace' ); |
760 | 760 | if ( is_array( $info ) && !$info[0]->Non_unique ) { |
761 | | - wfOut( "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n" ); |
| 761 | + $this->output( "...pl_namespace, tl_namespace, il_to indices are already UNIQUE.\n" ); |
762 | 762 | return; |
763 | 763 | } |
764 | 764 | |
765 | | - wfOut( "Making pl_namespace, tl_namespace and il_to indices UNIQUE... " ); |
| 765 | + $this->output( "Making pl_namespace, tl_namespace and il_to indices UNIQUE... " ); |
766 | 766 | $this->applyPatch( 'patch-pl-tl-il-unique.sql' ); |
767 | | - wfOut( "ok\n" ); |
| 767 | + $this->output( "ok\n" ); |
768 | 768 | } |
769 | 769 | |
770 | 770 | protected function renameEuWikiId() { |
771 | 771 | if ( $this->db->fieldExists( 'external_user', 'eu_local_id' ) ) { |
772 | | - wfOut( "...eu_wiki_id already renamed to eu_local_id.\n" ); |
| 772 | + $this->output( "...eu_wiki_id already renamed to eu_local_id.\n" ); |
773 | 773 | return; |
774 | 774 | } |
775 | 775 | |
776 | | - wfOut( "Renaming eu_wiki_id -> eu_local_id... " ); |
| 776 | + $this->output( "Renaming eu_wiki_id -> eu_local_id... " ); |
777 | 777 | $this->applyPatch( 'patch-eu_local_id.sql' ); |
778 | | - wfOut( "ok\n" ); |
| 778 | + $this->output( "ok\n" ); |
779 | 779 | } |
780 | 780 | |
781 | 781 | protected function doUpdateMimeMinorField() { |
782 | 782 | if ( $this->updateRowExists( 'mime_minor_length' ) ) { |
783 | | - wfOut( "...*_mime_minor fields are already long enough.\n" ); |
| 783 | + $this->output( "...*_mime_minor fields are already long enough.\n" ); |
784 | 784 | return; |
785 | 785 | } |
786 | 786 | |
787 | | - wfOut( "Altering all *_mime_minor fields to 100 bytes in size ... " ); |
| 787 | + $this->output( "Altering all *_mime_minor fields to 100 bytes in size ... " ); |
788 | 788 | $this->applyPatch( 'patch-mime_minor_length.sql' ); |
789 | | - wfOut( "ok\n" ); |
| 789 | + $this->output( "ok\n" ); |
790 | 790 | } |
791 | 791 | |
792 | 792 | protected function doPopulateRevLen() { |
793 | 793 | if ( $this->updateRowExists( 'populate rev_len' ) ) { |
794 | | - wfOut( "...rev_len column already populated.\n" ); |
| 794 | + $this->output( "...rev_len column already populated.\n" ); |
795 | 795 | return; |
796 | 796 | } |
797 | 797 | |
— | — | @@ -800,12 +800,12 @@ |
801 | 801 | |
802 | 802 | protected function doClFieldsUpdate() { |
803 | 803 | if ( $this->updateRowExists( 'cl_fields_update' ) ) { |
804 | | - wfOut( "...categorylinks up-to-date.\n" ); |
| 804 | + $this->output( "...categorylinks up-to-date.\n" ); |
805 | 805 | return; |
806 | 806 | } |
807 | 807 | |
808 | | - wfOut( 'Updating categorylinks (again)...' ); |
| 808 | + $this->output( 'Updating categorylinks (again)...' ); |
809 | 809 | $this->applyPatch( 'patch-categorylinks-better-collation2.sql' ); |
810 | | - wfOut( "done.\n" ); |
| 810 | + $this->output( "done.\n" ); |
811 | 811 | } |
812 | 812 | } |
Index: trunk/phase3/includes/installer/PostgresUpdater.php |
— | — | @@ -387,14 +387,14 @@ |
388 | 388 | |
389 | 389 | protected function addSequence( $ns ) { |
390 | 390 | if ( !$this->db->sequenceExists( $ns ) ) { |
391 | | - wfOut( "Creating sequence $ns\n" ); |
| 391 | + $this->output( "Creating sequence $ns\n" ); |
392 | 392 | $this->db->query( "CREATE SEQUENCE $ns" ); |
393 | 393 | } |
394 | 394 | } |
395 | 395 | |
396 | 396 | protected function renameSequence( $old, $new ) { |
397 | 397 | if ( $this->db->sequenceExists( $old ) ) { |
398 | | - wfOut( "Renaming sequence $old to $new\n" ); |
| 398 | + $this->output( "Renaming sequence $old to $new\n" ); |
399 | 399 | $this->db->query( "ALTER SEQUENCE $old RENAME TO $new" ); |
400 | 400 | } |
401 | 401 | } |
— | — | @@ -402,10 +402,10 @@ |
403 | 403 | protected function addPgField( $table, $field, $type ) { |
404 | 404 | $fi = $this->db->fieldInfo( $table, $field ); |
405 | 405 | if ( !is_null( $fi ) ) { |
406 | | - wfOut( "... column \"$table.$field\" already exists\n" ); |
| 406 | + $this->output( "... column \"$table.$field\" already exists\n" ); |
407 | 407 | return; |
408 | 408 | } else { |
409 | | - wfOut( "Adding column \"$table.$field\"\n" ); |
| 409 | + $this->output( "Adding column \"$table.$field\"\n" ); |
410 | 410 | $this->db->query( "ALTER TABLE $table ADD $field $type" ); |
411 | 411 | } |
412 | 412 | } |
— | — | @@ -413,14 +413,14 @@ |
414 | 414 | protected function changeField( $table, $field, $newtype, $default ) { |
415 | 415 | $fi = $this->db->fieldInfo( $table, $field ); |
416 | 416 | if ( is_null( $fi ) ) { |
417 | | - wfOut( "... error: expected column $table.$field to exist\n" ); |
| 417 | + $this->output( "... error: expected column $table.$field to exist\n" ); |
418 | 418 | exit( 1 ); |
419 | 419 | } |
420 | 420 | |
421 | 421 | if ( $fi->type() === $newtype ) |
422 | | - wfOut( "... column \"$table.$field\" is already of type \"$newtype\"\n" ); |
| 422 | + $this->output( "... column \"$table.$field\" is already of type \"$newtype\"\n" ); |
423 | 423 | else { |
424 | | - wfOut( "Changing column type of \"$table.$field\" from \"{$fi->type()}\" to \"$newtype\"\n" ); |
| 424 | + $this->output( "Changing column type of \"$table.$field\" from \"{$fi->type()}\" to \"$newtype\"\n" ); |
425 | 425 | $sql = "ALTER TABLE $table ALTER $field TYPE $newtype"; |
426 | 426 | if ( strlen( $default ) ) { |
427 | 427 | $res = array(); |
— | — | @@ -439,43 +439,43 @@ |
440 | 440 | protected function changeNullableField( $table, $field, $null ) { |
441 | 441 | $fi = $this->db->fieldInfo( $table, $field ); |
442 | 442 | if ( is_null( $fi ) ) { |
443 | | - wfOut( "... error: expected column $table.$field to exist\n" ); |
| 443 | + $this->output( "... error: expected column $table.$field to exist\n" ); |
444 | 444 | exit( 1 ); |
445 | 445 | } |
446 | 446 | if ( $fi->nullable() ) { |
447 | 447 | # # It's NULL - does it need to be NOT NULL? |
448 | 448 | if ( 'NOT NULL' === $null ) { |
449 | | - wfOut( "Changing \"$table.$field\" to not allow NULLs\n" ); |
| 449 | + $this->output( "Changing \"$table.$field\" to not allow NULLs\n" ); |
450 | 450 | $this->db->query( "ALTER TABLE $table ALTER $field SET NOT NULL" ); |
451 | 451 | } else { |
452 | | - wfOut( "... column \"$table.$field\" is already set as NULL\n" ); |
| 452 | + $this->output( "... column \"$table.$field\" is already set as NULL\n" ); |
453 | 453 | } |
454 | 454 | } else { |
455 | 455 | # # It's NOT NULL - does it need to be NULL? |
456 | 456 | if ( 'NULL' === $null ) { |
457 | | - wfOut( "Changing \"$table.$field\" to allow NULLs\n" ); |
| 457 | + $this->output( "Changing \"$table.$field\" to allow NULLs\n" ); |
458 | 458 | $this->db->query( "ALTER TABLE $table ALTER $field DROP NOT NULL" ); |
459 | 459 | } |
460 | 460 | else { |
461 | | - wfOut( "... column \"$table.$field\" is already set as NOT NULL\n" ); |
| 461 | + $this->output( "... column \"$table.$field\" is already set as NOT NULL\n" ); |
462 | 462 | } |
463 | 463 | } |
464 | 464 | } |
465 | 465 | |
466 | 466 | public function addPgIndex( $table, $index, $type ) { |
467 | 467 | if ( $this->db->indexExists( $table, $index ) ) { |
468 | | - wfOut( "... index \"$index\" on table \"$table\" already exists\n" ); |
| 468 | + $this->output( "... index \"$index\" on table \"$table\" already exists\n" ); |
469 | 469 | } else { |
470 | | - wfOut( "Creating index \"$index\" on table \"$table\" $type\n" ); |
| 470 | + $this->output( "Creating index \"$index\" on table \"$table\" $type\n" ); |
471 | 471 | $this->db->query( "CREATE INDEX $index ON $table $type" ); |
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | 475 | public function addPgExtIndex( $table, $index, $type ) { |
476 | 476 | if ( $this->db->indexExists( $table, $index ) ) { |
477 | | - wfOut( "... index \"$index\" on table \"$table\" already exists\n" ); |
| 477 | + $this->output( "... index \"$index\" on table \"$table\" already exists\n" ); |
478 | 478 | } else { |
479 | | - wfOut( "Creating index \"$index\" on table \"$table\"\n" ); |
| 479 | + $this->output( "Creating index \"$index\" on table \"$table\"\n" ); |
480 | 480 | if ( preg_match( '/^\(/', $type ) ) { |
481 | 481 | $this->db->query( "CREATE INDEX $index ON $table $type" ); |
482 | 482 | } else { |
— | — | @@ -487,13 +487,13 @@ |
488 | 488 | protected function changeFkeyDeferrable( $table, $field, $clause ) { |
489 | 489 | $fi = $this->db->fieldInfo( $table, $field ); |
490 | 490 | if ( is_null( $fi ) ) { |
491 | | - wfOut( "WARNING! Column \"$table.$field\" does not exist but it should! Please report this.\n" ); |
| 491 | + $this->output( "WARNING! Column \"$table.$field\" does not exist but it should! Please report this.\n" ); |
492 | 492 | return; |
493 | 493 | } |
494 | 494 | if ( $fi->is_deferred() && $fi->is_deferrable() ) { |
495 | 495 | return; |
496 | 496 | } |
497 | | - wfOut( "Altering column \"$table.$field\" to be DEFERRABLE INITIALLY DEFERRED\n" ); |
| 497 | + $this->output( "Altering column \"$table.$field\" to be DEFERRABLE INITIALLY DEFERRED\n" ); |
498 | 498 | $conname = $fi->conname(); |
499 | 499 | $command = "ALTER TABLE $table DROP CONSTRAINT $conname"; |
500 | 500 | $this->db->query( $command ); |
— | — | @@ -528,11 +528,11 @@ |
529 | 529 | } |
530 | 530 | |
531 | 531 | if ( strpos( $search_path, $wgDBmwschema ) === false ) { |
532 | | - wfOut( "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n" ); |
| 532 | + $this->output( "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n" ); |
533 | 533 | $search_path = "$wgDBmwschema, $search_path"; |
534 | 534 | } |
535 | 535 | if ( strpos( $search_path, $wgDBts2schema ) === false ) { |
536 | | - wfOut( "Adding in schema \"$wgDBts2schema\" to search_path for user \"$wgDBuser\"\n" ); |
| 536 | + $this->output( "Adding in schema \"$wgDBts2schema\" to search_path for user \"$wgDBuser\"\n" ); |
537 | 537 | $search_path = "$search_path, $wgDBts2schema"; |
538 | 538 | } |
539 | 539 | $search_path = str_replace( ', ,', ',', $search_path ); |
— | — | @@ -541,7 +541,7 @@ |
542 | 542 | $this->db->doQuery( "SET search_path = $search_path" ); |
543 | 543 | } else { |
544 | 544 | $path = $conf['search_path']; |
545 | | - wfOut( "... search_path for user \"$wgDBuser\" looks correct ($path)\n" ); |
| 545 | + $this->output( "... search_path for user \"$wgDBuser\" looks correct ($path)\n" ); |
546 | 546 | } |
547 | 547 | |
548 | 548 | $goodconf = array( |
— | — | @@ -552,46 +552,46 @@ |
553 | 553 | |
554 | 554 | foreach ( $goodconf as $key => $value ) { |
555 | 555 | if ( !array_key_exists( $key, $conf ) or $conf[$key] !== $value ) { |
556 | | - wfOut( "Setting $key to '$value' for user \"$wgDBuser\"\n" ); |
| 556 | + $this->output( "Setting $key to '$value' for user \"$wgDBuser\"\n" ); |
557 | 557 | $this->db->doQuery( "ALTER USER $wgDBuser SET $key = '$value'" ); |
558 | 558 | $this->db->doQuery( "SET $key = '$value'" ); |
559 | 559 | } else { |
560 | | - wfOut( "... default value of \"$key\" is correctly set to \"$value\" for user \"$wgDBuser\"\n" ); |
| 560 | + $this->output( "... default value of \"$key\" is correctly set to \"$value\" for user \"$wgDBuser\"\n" ); |
561 | 561 | } |
562 | 562 | } |
563 | 563 | } |
564 | 564 | |
565 | 565 | protected function convertArchive2() { |
566 | 566 | if ( $this->db->tableExists( "archive2" ) ) { |
567 | | - wfOut( "Converting \"archive2\" back to normal archive table\n" ); |
| 567 | + $this->output( "Converting \"archive2\" back to normal archive table\n" ); |
568 | 568 | if ( $this->db->ruleExists( 'archive', 'archive_insert' ) ) { |
569 | | - wfOut( "Dropping rule \"archive_insert\"\n" ); |
| 569 | + $this->output( "Dropping rule \"archive_insert\"\n" ); |
570 | 570 | $this->db->query( 'DROP RULE archive_insert ON archive' ); |
571 | 571 | } |
572 | 572 | if ( $this->db->ruleExists( 'archive', 'archive_delete' ) ) { |
573 | | - wfOut( "Dropping rule \"archive_delete\"\n" ); |
| 573 | + $this->output( "Dropping rule \"archive_delete\"\n" ); |
574 | 574 | $this->db->query( 'DROP RULE archive_delete ON archive' ); |
575 | 575 | } |
576 | 576 | $this->applyPatch( 'patch-remove-archive2.sql' ); |
577 | 577 | } else { |
578 | | - wfOut( "... obsolete table \"archive2\" does not exist\n" ); |
| 578 | + $this->output( "... obsolete table \"archive2\" does not exist\n" ); |
579 | 579 | } |
580 | 580 | } |
581 | 581 | |
582 | 582 | protected function checkOiDeleted() { |
583 | 583 | if ( $this->db->fieldInfo( 'oldimage', 'oi_deleted' )->type() !== 'smallint' ) { |
584 | | - wfOut( "Changing \"oldimage.oi_deleted\" to type \"smallint\"\n" ); |
| 584 | + $this->output( "Changing \"oldimage.oi_deleted\" to type \"smallint\"\n" ); |
585 | 585 | $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT" ); |
586 | 586 | $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" ); |
587 | 587 | $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted SET DEFAULT 0" ); |
588 | 588 | } else { |
589 | | - wfOut( "... column \"oldimage.oi_deleted\" is already of type \"smallint\"\n" ); |
| 589 | + $this->output( "... column \"oldimage.oi_deleted\" is already of type \"smallint\"\n" ); |
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
593 | 593 | protected function checkOiNameConstraint() { |
594 | 594 | if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascaded" ) ) { |
595 | | - wfOut( "... table \"oldimage\" has correct cascading delete/update foreign key to image\n" ); |
| 595 | + $this->output( "... table \"oldimage\" has correct cascading delete/update foreign key to image\n" ); |
596 | 596 | } else { |
597 | 597 | if ( $this->db->hasConstraint( "oldimage_oi_name_fkey" ) ) { |
598 | 598 | $this->db->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" ); |
— | — | @@ -599,7 +599,7 @@ |
600 | 600 | if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascade" ) ) { |
601 | 601 | $this->db->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey_cascade" ); |
602 | 602 | } |
603 | | - wfOut( "Making foreign key on table \"oldimage\" (to image) a cascade delete/update\n" ); |
| 603 | + $this->output( "Making foreign key on table \"oldimage\" (to image) a cascade delete/update\n" ); |
604 | 604 | $this->db->query( "ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascaded " . |
605 | 605 | "FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE ON UPDATE CASCADE" ); |
606 | 606 | } |
— | — | @@ -607,66 +607,66 @@ |
608 | 608 | |
609 | 609 | protected function checkPageDeletedTrigger() { |
610 | 610 | if ( !$this->db->triggerExists( 'page', 'page_deleted' ) ) { |
611 | | - wfOut( "Adding function and trigger \"page_deleted\" to table \"page\"\n" ); |
| 611 | + $this->output( "Adding function and trigger \"page_deleted\" to table \"page\"\n" ); |
612 | 612 | $this->applyPatch( 'patch-page_deleted.sql' ); |
613 | 613 | } else { |
614 | | - wfOut( "... table \"page\" has \"page_deleted\" trigger\n" ); |
| 614 | + $this->output( "... table \"page\" has \"page_deleted\" trigger\n" ); |
615 | 615 | } |
616 | 616 | } |
617 | 617 | |
618 | 618 | protected function checkRcCurIdNullable(){ |
619 | 619 | $fi = $this->db->fieldInfo( 'recentchanges', 'rc_cur_id' ); |
620 | 620 | if ( !$fi->nullable() ) { |
621 | | - wfOut( "Removing NOT NULL constraint from \"recentchanges.rc_cur_id\"\n" ); |
| 621 | + $this->output( "Removing NOT NULL constraint from \"recentchanges.rc_cur_id\"\n" ); |
622 | 622 | $this->applyPatch( 'patch-rc_cur_id-not-null.sql' ); |
623 | 623 | } else { |
624 | | - wfOut( "... column \"recentchanges.rc_cur_id\" has a NOT NULL constraint\n" ); |
| 624 | + $this->output( "... column \"recentchanges.rc_cur_id\" has a NOT NULL constraint\n" ); |
625 | 625 | } |
626 | 626 | } |
627 | 627 | |
628 | 628 | protected function checkPagelinkUniqueIndex() { |
629 | 629 | $pu = $this->describeIndex( 'pagelink_unique' ); |
630 | 630 | if ( !is_null( $pu ) && ( $pu[0] != 'pl_from' || $pu[1] != 'pl_namespace' || $pu[2] != 'pl_title' ) ) { |
631 | | - wfOut( "Dropping obsolete version of index \"pagelink_unique index\"\n" ); |
| 631 | + $this->output( "Dropping obsolete version of index \"pagelink_unique index\"\n" ); |
632 | 632 | $this->db->query( 'DROP INDEX pagelink_unique' ); |
633 | 633 | $pu = null; |
634 | 634 | } else { |
635 | | - wfOut( "... obsolete version of index \"pagelink_unique index\" does not exist\n" ); |
| 635 | + $this->output( "... obsolete version of index \"pagelink_unique index\" does not exist\n" ); |
636 | 636 | } |
637 | 637 | |
638 | 638 | if ( is_null( $pu ) ) { |
639 | | - wfOut( "Creating index \"pagelink_unique index\"\n" ); |
| 639 | + $this->output( "Creating index \"pagelink_unique index\"\n" ); |
640 | 640 | $this->db->query( 'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' ); |
641 | 641 | } else { |
642 | | - wfOut( "... index \"pagelink_unique_index\" already exists\n" ); |
| 642 | + $this->output( "... index \"pagelink_unique_index\" already exists\n" ); |
643 | 643 | } |
644 | 644 | } |
645 | 645 | |
646 | 646 | protected function checkRevUserFkey() { |
647 | 647 | if ( $this->fkeyDeltype( 'revision_rev_user_fkey' ) == 'r' ) { |
648 | | - wfOut( "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n" ); |
| 648 | + $this->output( "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n" ); |
649 | 649 | } else { |
650 | | - wfOut( "Changing constraint \"revision_rev_user_fkey\" to ON DELETE RESTRICT\n" ); |
| 650 | + $this->output( "Changing constraint \"revision_rev_user_fkey\" to ON DELETE RESTRICT\n" ); |
651 | 651 | $this->applyPatch( 'patch-revision_rev_user_fkey.sql' ); |
652 | 652 | } |
653 | 653 | } |
654 | 654 | |
655 | 655 | protected function checkIpbAdress() { |
656 | 656 | if ( $this->db->indexExists( 'ipblocks', 'ipb_address' ) ) { |
657 | | - wfOut( "Removing deprecated index 'ipb_address'...\n" ); |
| 657 | + $this->output( "Removing deprecated index 'ipb_address'...\n" ); |
658 | 658 | $this->db->query( 'DROP INDEX ipb_address' ); |
659 | 659 | } |
660 | 660 | if ( $this->db->indexExists( 'ipblocks', 'ipb_address_unique' ) ) { |
661 | | - wfOut( "... have ipb_address_unique\n" ); |
| 661 | + $this->output( "... have ipb_address_unique\n" ); |
662 | 662 | } else { |
663 | | - wfOut( "Adding ipb_address_unique index\n" ); |
| 663 | + $this->output( "Adding ipb_address_unique index\n" ); |
664 | 664 | $this->applyPatch( 'patch-ipb_address_unique.sql' ); |
665 | 665 | } |
666 | 666 | } |
667 | 667 | |
668 | 668 | protected function checkIwlPrefix() { |
669 | 669 | if ( $this->db->indexExists( 'iwlinks', 'iwl_prefix' ) ) { |
670 | | - wfOut( "Replacing index 'iwl_prefix' with 'iwl_prefix_from_title'...\n" ); |
| 670 | + $this->output( "Replacing index 'iwl_prefix' with 'iwl_prefix_from_title'...\n" ); |
671 | 671 | $this->applyPatch( 'patch-rename-iwl_prefix.sql' ); |
672 | 672 | } |
673 | 673 | } |
Index: trunk/phase3/includes/installer/SqliteUpdater.php |
— | — | @@ -57,27 +57,27 @@ |
58 | 58 | protected function sqliteInitialIndexes() { |
59 | 59 | // initial-indexes.sql fails if the indexes are already present, so we perform a quick check if our database is newer. |
60 | 60 | if ( $this->updateRowExists( 'initial_indexes' ) || $this->db->indexExists( 'user', 'user_name' ) ) { |
61 | | - wfOut( "...have initial indexes\n" ); |
| 61 | + $this->output( "...have initial indexes\n" ); |
62 | 62 | return; |
63 | 63 | } |
64 | | - wfOut( "Adding initial indexes..." ); |
| 64 | + $this->output( "Adding initial indexes..." ); |
65 | 65 | $this->applyPatch( 'initial-indexes.sql' ); |
66 | | - wfOut( "done\n" ); |
| 66 | + $this->output( "done\n" ); |
67 | 67 | } |
68 | 68 | |
69 | 69 | protected function sqliteSetupSearchindex() { |
70 | 70 | $module = $this->db->getFulltextSearchModule(); |
71 | 71 | $fts3tTable = $this->updateRowExists( 'fts3' ); |
72 | 72 | if ( $fts3tTable && !$module ) { |
73 | | - wfOut( '...PHP is missing FTS3 support, downgrading tables...' ); |
| 73 | + $this->output( '...PHP is missing FTS3 support, downgrading tables...' ); |
74 | 74 | $this->applyPatch( 'searchindex-no-fts.sql' ); |
75 | | - wfOut( "done\n" ); |
| 75 | + $this->output( "done\n" ); |
76 | 76 | } elseif ( !$fts3tTable && $module == 'FTS3' ) { |
77 | | - wfOut( '...adding FTS3 search capabilities...' ); |
| 77 | + $this->output( '...adding FTS3 search capabilities...' ); |
78 | 78 | $this->applyPatch( 'searchindex-fts3.sql' ); |
79 | | - wfOut( "done\n" ); |
| 79 | + $this->output( "done\n" ); |
80 | 80 | } else { |
81 | | - wfOut( "...fulltext search table appears to be in order.\n" ); |
| 81 | + $this->output( "...fulltext search table appears to be in order.\n" ); |
82 | 82 | } |
83 | 83 | } |
84 | 84 | } |