Index: trunk/phase3/includes/installer/PostgresUpdater.php |
— | — | @@ -404,17 +404,17 @@ |
405 | 405 | protected function renameTable( $old, $new ) { |
406 | 406 | if ( $this->db->tableExists( $old ) ) { |
407 | 407 | $this->output( "Renaming table $old to $new\n" ); |
408 | | - $this->db->query( "ALTER TABLE \"$old\" RENAME TO $new" ); |
| 408 | + $this->db->query( "ALTER TABLE '$old' RENAME TO $new" ); |
409 | 409 | } |
410 | 410 | } |
411 | 411 | |
412 | 412 | protected function addPgField( $table, $field, $type ) { |
413 | 413 | $fi = $this->db->fieldInfo( $table, $field ); |
414 | 414 | if ( !is_null( $fi ) ) { |
415 | | - $this->output( "... column \"$table.$field\" already exists\n" ); |
| 415 | + $this->output( "... column '$table.$field' already exists\n" ); |
416 | 416 | return; |
417 | 417 | } else { |
418 | | - $this->output( "Adding column \"$table.$field\"\n" ); |
| 418 | + $this->output( "Adding column '$table.$field'\n" ); |
419 | 419 | $this->db->query( "ALTER TABLE $table ADD $field $type" ); |
420 | 420 | } |
421 | 421 | } |
— | — | @@ -427,9 +427,9 @@ |
428 | 428 | } |
429 | 429 | |
430 | 430 | if ( $fi->type() === $newtype ) |
431 | | - $this->output( "... column \"$table.$field\" is already of type \"$newtype\"\n" ); |
| 431 | + $this->output( "... column '$table.$field' is already of type '$newtype'\n" ); |
432 | 432 | else { |
433 | | - $this->output( "Changing column type of \"$table.$field\" from \"{$fi->type()}\" to \"$newtype\"\n" ); |
| 433 | + $this->output( "Changing column type of '$table.$field' from '{$fi->type()}' to '$newtype'\n" ); |
434 | 434 | $sql = "ALTER TABLE $table ALTER $field TYPE $newtype"; |
435 | 435 | if ( strlen( $default ) ) { |
436 | 436 | $res = array(); |
— | — | @@ -454,37 +454,37 @@ |
455 | 455 | if ( $fi->isNullable() ) { |
456 | 456 | # # It's NULL - does it need to be NOT NULL? |
457 | 457 | if ( 'NOT NULL' === $null ) { |
458 | | - $this->output( "Changing \"$table.$field\" to not allow NULLs\n" ); |
| 458 | + $this->output( "Changing '$table.$field' to not allow NULLs\n" ); |
459 | 459 | $this->db->query( "ALTER TABLE $table ALTER $field SET NOT NULL" ); |
460 | 460 | } else { |
461 | | - $this->output( "... column \"$table.$field\" is already set as NULL\n" ); |
| 461 | + $this->output( "... column '$table.$field' is already set as NULL\n" ); |
462 | 462 | } |
463 | 463 | } else { |
464 | 464 | # # It's NOT NULL - does it need to be NULL? |
465 | 465 | if ( 'NULL' === $null ) { |
466 | | - $this->output( "Changing \"$table.$field\" to allow NULLs\n" ); |
| 466 | + $this->output( "Changing '$table.$field' to allow NULLs\n" ); |
467 | 467 | $this->db->query( "ALTER TABLE $table ALTER $field DROP NOT NULL" ); |
468 | 468 | } |
469 | 469 | else { |
470 | | - $this->output( "... column \"$table.$field\" is already set as NOT NULL\n" ); |
| 470 | + $this->output( "... column '$table.$field' is already set as NOT NULL\n" ); |
471 | 471 | } |
472 | 472 | } |
473 | 473 | } |
474 | 474 | |
475 | 475 | public function addPgIndex( $table, $index, $type ) { |
476 | 476 | if ( $this->db->indexExists( $table, $index ) ) { |
477 | | - $this->output( "... index \"$index\" on table \"$table\" already exists\n" ); |
| 477 | + $this->output( "... index '$index' on table '$table' already exists\n" ); |
478 | 478 | } else { |
479 | | - $this->output( "Creating index \"$index\" on table \"$table\" $type\n" ); |
| 479 | + $this->output( "Creating index '$index' on table '$table' $type\n" ); |
480 | 480 | $this->db->query( "CREATE INDEX $index ON $table $type" ); |
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
484 | 484 | public function addPgExtIndex( $table, $index, $type ) { |
485 | 485 | if ( $this->db->indexExists( $table, $index ) ) { |
486 | | - $this->output( "... index \"$index\" on table \"$table\" already exists\n" ); |
| 486 | + $this->output( "... index '$index' on table '$table' already exists\n" ); |
487 | 487 | } else { |
488 | | - $this->output( "Creating index \"$index\" on table \"$table\"\n" ); |
| 488 | + $this->output( "Creating index '$index' on table '$table'\n" ); |
489 | 489 | if ( preg_match( '/^\(/', $type ) ) { |
490 | 490 | $this->db->query( "CREATE INDEX $index ON $table $type" ); |
491 | 491 | } else { |
— | — | @@ -496,13 +496,13 @@ |
497 | 497 | protected function changeFkeyDeferrable( $table, $field, $clause ) { |
498 | 498 | $fi = $this->db->fieldInfo( $table, $field ); |
499 | 499 | if ( is_null( $fi ) ) { |
500 | | - $this->output( "WARNING! Column \"$table.$field\" does not exist but it should! Please report this.\n" ); |
| 500 | + $this->output( "WARNING! Column '$table.$field' does not exist but it should! Please report this.\n" ); |
501 | 501 | return; |
502 | 502 | } |
503 | 503 | if ( $fi->is_deferred() && $fi->is_deferrable() ) { |
504 | 504 | return; |
505 | 505 | } |
506 | | - $this->output( "Altering column \"$table.$field\" to be DEFERRABLE INITIALLY DEFERRED\n" ); |
| 506 | + $this->output( "Altering column '$table.$field' to be DEFERRABLE INITIALLY DEFERRED\n" ); |
507 | 507 | $conname = $fi->conname(); |
508 | 508 | $command = "ALTER TABLE $table DROP CONSTRAINT $conname"; |
509 | 509 | $this->db->query( $command ); |
— | — | @@ -516,7 +516,7 @@ |
517 | 517 | protected function checkPgUser() { |
518 | 518 | global $wgDBmwschema, $wgDBuser; |
519 | 519 | |
520 | | - $config = $this->db->selectField( |
| 520 | + $config = $this->db->selectField( |
521 | 521 | 'pg_catalog.pg_user', "array_to_string(useconfig,'*')", |
522 | 522 | array( 'usename' => $wgDBuser ), __METHOD__ ); |
523 | 523 | |
— | — | @@ -533,7 +533,7 @@ |
534 | 534 | } |
535 | 535 | |
536 | 536 | if ( strpos( $search_path, $wgDBmwschema ) === false ) { |
537 | | - $this->output( "Adding in schema \"$wgDBmwschema\" to search_path for user \"$wgDBuser\"\n" ); |
| 537 | + $this->output( "Adding in schema '$wgDBmwschema' to search_path for user '$wgDBuser'\n" ); |
538 | 538 | $search_path = "$wgDBmwschema, $search_path"; |
539 | 539 | } |
540 | 540 | $search_path = str_replace( ', ,', ',', $search_path ); |
— | — | @@ -542,7 +542,7 @@ |
543 | 543 | $this->db->query( "SET search_path = $search_path" ); |
544 | 544 | } else { |
545 | 545 | $path = $conf['search_path']; |
546 | | - $this->output( "... search_path for user \"$wgDBuser\" looks correct ($path)\n" ); |
| 546 | + $this->output( "... search_path for user '$wgDBuser' looks correct ($path)\n" ); |
547 | 547 | } |
548 | 548 | |
549 | 549 | $goodconf = array( |
— | — | @@ -553,46 +553,46 @@ |
554 | 554 | |
555 | 555 | foreach ( $goodconf as $key => $value ) { |
556 | 556 | if ( !array_key_exists( $key, $conf ) or $conf[$key] !== $value ) { |
557 | | - $this->output( "Setting $key to '$value' for user \"$wgDBuser\"\n" ); |
| 557 | + $this->output( "Setting $key to '$value' for user '$wgDBuser'\n" ); |
558 | 558 | $this->db->query( "ALTER USER $wgDBuser SET $key = '$value'" ); |
559 | 559 | $this->db->query( "SET $key = '$value'" ); |
560 | 560 | } else { |
561 | | - $this->output( "... default value of \"$key\" is correctly set to \"$value\" for user \"$wgDBuser\"\n" ); |
| 561 | + $this->output( "... default value of '$key' is correctly set to '$value' for user '$wgDBuser'\n" ); |
562 | 562 | } |
563 | 563 | } |
564 | 564 | } |
565 | 565 | |
566 | 566 | protected function convertArchive2() { |
567 | 567 | if ( $this->db->tableExists( "archive2" ) ) { |
568 | | - $this->output( "Converting \"archive2\" back to normal archive table\n" ); |
| 568 | + $this->output( "Converting 'archive2' back to normal archive table\n" ); |
569 | 569 | if ( $this->db->ruleExists( 'archive', 'archive_insert' ) ) { |
570 | | - $this->output( "Dropping rule \"archive_insert\"\n" ); |
| 570 | + $this->output( "Dropping rule 'archive_insert'\n" ); |
571 | 571 | $this->db->query( 'DROP RULE archive_insert ON archive' ); |
572 | 572 | } |
573 | 573 | if ( $this->db->ruleExists( 'archive', 'archive_delete' ) ) { |
574 | | - $this->output( "Dropping rule \"archive_delete\"\n" ); |
| 574 | + $this->output( "Dropping rule 'archive_delete'\n" ); |
575 | 575 | $this->db->query( 'DROP RULE archive_delete ON archive' ); |
576 | 576 | } |
577 | 577 | $this->applyPatch( 'patch-remove-archive2.sql' ); |
578 | 578 | } else { |
579 | | - $this->output( "... obsolete table \"archive2\" does not exist\n" ); |
| 579 | + $this->output( "... obsolete table 'archive2' does not exist\n" ); |
580 | 580 | } |
581 | 581 | } |
582 | 582 | |
583 | 583 | protected function checkOiDeleted() { |
584 | 584 | if ( $this->db->fieldInfo( 'oldimage', 'oi_deleted' )->type() !== 'smallint' ) { |
585 | | - $this->output( "Changing \"oldimage.oi_deleted\" to type \"smallint\"\n" ); |
| 585 | + $this->output( "Changing 'oldimage.oi_deleted' to type 'smallint'\n" ); |
586 | 586 | $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT" ); |
587 | 587 | $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" ); |
588 | 588 | $this->db->query( "ALTER TABLE oldimage ALTER oi_deleted SET DEFAULT 0" ); |
589 | 589 | } else { |
590 | | - $this->output( "... column \"oldimage.oi_deleted\" is already of type \"smallint\"\n" ); |
| 590 | + $this->output( "... column 'oldimage.oi_deleted' is already of type 'smallint'\n" ); |
591 | 591 | } |
592 | 592 | } |
593 | 593 | |
594 | 594 | protected function checkOiNameConstraint() { |
595 | 595 | if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascaded" ) ) { |
596 | | - $this->output( "... table \"oldimage\" has correct cascading delete/update foreign key to image\n" ); |
| 596 | + $this->output( "... table 'oldimage' has correct cascading delete/update foreign key to image\n" ); |
597 | 597 | } else { |
598 | 598 | if ( $this->db->hasConstraint( "oldimage_oi_name_fkey" ) ) { |
599 | 599 | $this->db->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" ); |
— | — | @@ -600,7 +600,7 @@ |
601 | 601 | if ( $this->db->hasConstraint( "oldimage_oi_name_fkey_cascade" ) ) { |
602 | 602 | $this->db->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey_cascade" ); |
603 | 603 | } |
604 | | - $this->output( "Making foreign key on table \"oldimage\" (to image) a cascade delete/update\n" ); |
| 604 | + $this->output( "Making foreign key on table 'oldimage' (to image) a cascade delete/update\n" ); |
605 | 605 | $this->db->query( "ALTER TABLE oldimage ADD CONSTRAINT oldimage_oi_name_fkey_cascaded " . |
606 | 606 | "FOREIGN KEY (oi_name) REFERENCES image(img_name) ON DELETE CASCADE ON UPDATE CASCADE" ); |
607 | 607 | } |
— | — | @@ -608,46 +608,46 @@ |
609 | 609 | |
610 | 610 | protected function checkPageDeletedTrigger() { |
611 | 611 | if ( !$this->db->triggerExists( 'page', 'page_deleted' ) ) { |
612 | | - $this->output( "Adding function and trigger \"page_deleted\" to table \"page\"\n" ); |
| 612 | + $this->output( "Adding function and trigger 'page_deleted' to table 'page'\n" ); |
613 | 613 | $this->applyPatch( 'patch-page_deleted.sql' ); |
614 | 614 | } else { |
615 | | - $this->output( "... table \"page\" has \"page_deleted\" trigger\n" ); |
| 615 | + $this->output( "... table 'page' has 'page_deleted' trigger\n" ); |
616 | 616 | } |
617 | 617 | } |
618 | 618 | |
619 | 619 | protected function checkRcCurIdNullable(){ |
620 | 620 | $fi = $this->db->fieldInfo( 'recentchanges', 'rc_cur_id' ); |
621 | 621 | if ( !$fi->isNullable() ) { |
622 | | - $this->output( "Removing NOT NULL constraint from \"recentchanges.rc_cur_id\"\n" ); |
| 622 | + $this->output( "Removing NOT NULL constraint from 'recentchanges.rc_cur_id'\n" ); |
623 | 623 | $this->applyPatch( 'patch-rc_cur_id-not-null.sql' ); |
624 | 624 | } else { |
625 | | - $this->output( "... column \"recentchanges.rc_cur_id\" has a NOT NULL constraint\n" ); |
| 625 | + $this->output( "... column 'recentchanges.rc_cur_id' has a NOT NULL constraint\n" ); |
626 | 626 | } |
627 | 627 | } |
628 | 628 | |
629 | 629 | protected function checkPagelinkUniqueIndex() { |
630 | 630 | $pu = $this->describeIndex( 'pagelink_unique' ); |
631 | 631 | if ( !is_null( $pu ) && ( $pu[0] != 'pl_from' || $pu[1] != 'pl_namespace' || $pu[2] != 'pl_title' ) ) { |
632 | | - $this->output( "Dropping obsolete version of index \"pagelink_unique index\"\n" ); |
| 632 | + $this->output( "Dropping obsolete version of index 'pagelink_unique index'\n" ); |
633 | 633 | $this->db->query( 'DROP INDEX pagelink_unique' ); |
634 | 634 | $pu = null; |
635 | 635 | } else { |
636 | | - $this->output( "... obsolete version of index \"pagelink_unique index\" does not exist\n" ); |
| 636 | + $this->output( "... obsolete version of index 'pagelink_unique index' does not exist\n" ); |
637 | 637 | } |
638 | 638 | |
639 | 639 | if ( is_null( $pu ) ) { |
640 | | - $this->output( "Creating index \"pagelink_unique index\"\n" ); |
| 640 | + $this->output( "Creating index 'pagelink_unique index'\n" ); |
641 | 641 | $this->db->query( 'CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)' ); |
642 | 642 | } else { |
643 | | - $this->output( "... index \"pagelink_unique_index\" already exists\n" ); |
| 643 | + $this->output( "... index 'pagelink_unique_index' already exists\n" ); |
644 | 644 | } |
645 | 645 | } |
646 | 646 | |
647 | 647 | protected function checkRevUserFkey() { |
648 | 648 | if ( $this->fkeyDeltype( 'revision_rev_user_fkey' ) == 'r' ) { |
649 | | - $this->output( "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n" ); |
| 649 | + $this->output( "... constraint 'revision_rev_user_fkey' is ON DELETE RESTRICT\n" ); |
650 | 650 | } else { |
651 | | - $this->output( "Changing constraint \"revision_rev_user_fkey\" to ON DELETE RESTRICT\n" ); |
| 651 | + $this->output( "Changing constraint 'revision_rev_user_fkey' to ON DELETE RESTRICT\n" ); |
652 | 652 | $this->applyPatch( 'patch-revision_rev_user_fkey.sql' ); |
653 | 653 | } |
654 | 654 | } |