r68870 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68869‎ | r68870 | r68871 >
Date:06:52, 2 July 2010
Author:reedy
Status:ok
Tags:
Comment:
Remove some whitespace, and fixup if braces in postgres section of updaters.inc

Fix minor message typo also
Modified paths:
  • /trunk/phase3/maintenance/updaters.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/updaters.inc
@@ -283,8 +283,6 @@
284284 }
285285 }
286286
287 -
288 -
289287 function add_field( $table, $field, $patch, $fullpath = false ) {
290288 global $wgDatabase;
291289 if ( !$wgDatabase->tableExists( $table ) ) {
@@ -499,7 +497,6 @@
500498 wfOut( "Done.\n" );
501499 }
502500
503 -
504501 function do_user_update() {
505502 global $wgDatabase;
506503 if ( $wgDatabase->fieldExists( 'user', 'user_emailauthenticationtimestamp' ) ) {
@@ -1177,7 +1174,6 @@
11781175 flush();
11791176 }
11801177
1181 -
11821178 wfOut( "Deleting old default messages (this may take a long time!)..." );
11831179 if ( !defined( 'MW_NO_SETUP' ) ) {
11841180 define( 'MW_NO_SETUP', true );
@@ -1405,8 +1401,6 @@
14061402 }
14071403 }
14081404
1409 -
1410 -
14111405 /***********************************************************************
14121406 * Start PG stuff
14131407 * TODO: merge with above
@@ -1423,8 +1417,9 @@
14241418 $res = $wgDatabase->query( sprintf( $q,
14251419 $wgDatabase->addQuotes( $table ),
14261420 $wgDatabase->addQuotes( $wgDBmwschema ) ) );
1427 - if ( !$res )
 1421+ if ( !$res ) {
14281422 return null;
 1423+ }
14291424
14301425 $cols = array();
14311426 while ( $r = $wgDatabase->fetchRow( $res ) ) {
@@ -1451,8 +1446,9 @@
14521447 $res = $wgDatabase->query( sprintf( $q,
14531448 $wgDatabase->addQuotes( $wgDBmwschema ),
14541449 $wgDatabase->addQuotes( $idx ) ) );
1455 - if ( !$res )
 1450+ if ( !$res ) {
14561451 return null;
 1452+ }
14571453 if ( !( $r = $wgDatabase->fetchRow( $res ) ) ) {
14581454 $wgDatabase->freeResult( $res );
14591455 return null;
@@ -1472,8 +1468,9 @@
14731469 AND attrelid=pg_class.oid
14741470 END;
14751471 $r2 = $wgDatabase->query( sprintf( $query, $rid ) );
1476 - if ( !$r2 )
 1472+ if ( !$r2 ) {
14771473 return null;
 1474+ }
14781475 if ( !( $row2 = $wgDatabase->fetchRow( $r2 ) ) ) {
14791476 $wgDatabase->freeResult( $r2 );
14801477 return null;
@@ -1505,8 +1502,9 @@
15061503 $r = $wgDatabase->query( sprintf( $q,
15071504 $wgDatabase->addQuotes( $wgDBmwschema ),
15081505 $wgDatabase->addQuotes( $fkey ) ) );
1509 - if ( !( $row = $wgDatabase->fetchRow( $r ) ) )
 1506+ if ( !( $row = $wgDatabase->fetchRow( $r ) ) ) {
15101507 return null;
 1508+ }
15111509 return $row[0];
15121510 }
15131511
@@ -1523,8 +1521,9 @@
15241522 $wgDatabase->addQuotes( $table ),
15251523 $wgDatabase->addQuotes( $rule ) ) );
15261524 $row = $wgDatabase->fetchRow( $r );
1527 - if ( !$row )
 1525+ if ( !$row ) {
15281526 return null;
 1527+ }
15291528 $d = $row[0];
15301529 $wgDatabase->freeResult( $r );
15311530 return $d;
@@ -1540,8 +1539,9 @@
15411540 $wgShowExceptionDetails = 1;
15421541
15431542 # Just in case their LocalSettings.php does not have this:
1544 - if ( !isset( $wgDBmwschema ) )
 1543+ if ( !isset( $wgDBmwschema ) ) {
15451544 $wgDBmwschema = 'mediawiki';
 1545+ }
15461546
15471547 # Verify that this user is configured correctly
15481548 $safeuser = $wgDatabase->addQuotes( $wgDBuser );
@@ -1554,8 +1554,7 @@
15551555 }
15561556 if ( !array_key_exists( 'search_path', $conf ) ) {
15571557 $search_path = '';
1558 - }
1559 - else {
 1558+ } else {
15601559 $search_path = $conf['search_path'];
15611560 }
15621561 if ( strpos( $search_path, $wgDBmwschema ) === false ) {
@@ -1570,8 +1569,7 @@
15711570 if ( array_key_exists( 'search_path', $conf ) === false || $search_path != $conf['search_path'] ) {
15721571 $wgDatabase->doQuery( "ALTER USER $wgDBuser SET search_path = $search_path" );
15731572 $wgDatabase->doQuery( "SET search_path = $search_path" );
1574 - }
1575 - else {
 1573+ } else {
15761574 $path = $conf['search_path'];
15771575 wfOut( "... search_path for user \"$wgDBuser\" looks correct ($path)\n" );
15781576 }
@@ -1586,8 +1584,7 @@
15871585 wfOut( "Setting $key to '$value' for user \"$wgDBuser\"\n" );
15881586 $wgDatabase->doQuery( "ALTER USER $wgDBuser SET $key = '$value'" );
15891587 $wgDatabase->doQuery( "SET $key = '$value'" );
1590 - }
1591 - else {
 1588+ } else {
15921589 wfOut( "... default value of \"$key\" is correctly set to \"$value\" for user \"$wgDBuser\"\n" );
15931590 }
15941591 }
@@ -1857,12 +1854,10 @@
18581855 if ( 'NOT NULL' === $nc[2] ) {
18591856 wfOut( "Changing \"$nc[0].$nc[1]\" to not allow NULLs\n" );
18601857 $wgDatabase->query( "ALTER TABLE $nc[0] ALTER $nc[1] SET NOT NULL" );
1861 - }
1862 - else {
 1858+ } else {
18631859 wfOut( "... column \"$nc[0].$nc[1]\" is already set as NULL\n" );
18641860 }
1865 - }
1866 - else {
 1861+ } else {
18671862 # # It's NOT NULL - does it need to be NULL?
18681863 if ( 'NULL' === $nc[2] ) {
18691864 wfOut( "Changing \"$nc[0].$nc[1]\" to allow NULLs\n" );
@@ -1879,11 +1874,10 @@
18801875 $wgDatabase->query( "ALTER TABLE oldimage ALTER oi_deleted DROP DEFAULT" );
18811876 $wgDatabase->query( "ALTER TABLE oldimage ALTER oi_deleted TYPE SMALLINT USING (oi_deleted::smallint)" );
18821877 $wgDatabase->query( "ALTER TABLE oldimage ALTER oi_deleted SET DEFAULT 0" );
1883 - }
1884 - else
 1878+ } else {
18851879 wfOut( "... column \"oldimage.oi_deleted\" is already of type \"smallint\"\n" );
 1880+ }
18861881
1887 -
18881882 foreach ( $newindexes as $ni ) {
18891883 if ( pg_index_exists( $ni[0], $ni[1] ) ) {
18901884 wfOut( "... index \"$ni[1]\" on table \"$ni[0]\" already exists\n" );
@@ -1904,8 +1898,7 @@
19051899
19061900 if ( $wgDatabase->hasConstraint( "oldimage_oi_name_fkey_cascaded" ) ) {
19071901 wfOut( "... table \"oldimage\" has correct cascading delete/update foreign key to image\n" );
1908 - }
1909 - else {
 1902+ } else {
19101903 if ( $wgDatabase->hasConstraint( "oldimage_oi_name_fkey" ) ) {
19111904 $wgDatabase->query( "ALTER TABLE oldimage DROP CONSTRAINT oldimage_oi_name_fkey" );
19121905 }
@@ -1920,38 +1913,37 @@
19211914 if ( !$wgDatabase->triggerExists( "page", "page_deleted" ) ) {
19221915 wfOut( "Adding function and trigger \"page_deleted\" to table \"page\"\n" );
19231916 $wgDatabase->sourceFile( archive( 'patch-page_deleted.sql' ) );
1924 - }
1925 - else
 1917+ } else {
19261918 wfOut( "... table \"page\" has \"page_deleted\" trigger\n" );
 1919+ }
19271920
19281921 $fi = $wgDatabase->fieldInfo( "recentchanges", "rc_cur_id" );
19291922 if ( !$fi->nullable() ) {
19301923 wfOut( "Removing NOT NULL constraint from \"recentchanges.rc_cur_id\"\n" );
19311924 $wgDatabase->sourceFile( archive( 'patch-rc_cur_id-not-null.sql' ) );
1932 - }
1933 - else
 1925+ } else {
19341926 wfOut( "... column \"recentchanges.rc_cur_id\" has a NOT NULL constraint\n" );
 1927+ }
19351928
19361929 $pu = pg_describe_index( "pagelink_unique" );
19371930 if ( !is_null( $pu ) && ( $pu[0] != "pl_from" || $pu[1] != "pl_namespace" || $pu[2] != "pl_title" ) ) {
19381931 wfOut( "Dropping obsolete version of index \"pagelink_unique index\"\n" );
19391932 $wgDatabase->query( "DROP INDEX pagelink_unique" );
19401933 $pu = null;
1941 - }
1942 - else
 1934+ } else {
19431935 wfOut( "... obsolete version of index \"pagelink_unique index\" does not exist\n" );
 1936+ }
19441937
19451938 if ( is_null( $pu ) ) {
19461939 wfOut( "Creating index \"pagelink_unique index\"\n" );
19471940 $wgDatabase->query( "CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)" );
1948 - }
1949 - else
 1941+ } else {
19501942 wfOut( "... index \"pagelink_unique_index\" already exists\n" );
 1943+ }
19511944
19521945 if ( pg_fkey_deltype( "revision_rev_user_fkey" ) == 'r' ) {
19531946 wfOut( "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n" );
1954 - }
1955 - else {
 1947+ } else {
19561948 wfOut( "Changing constraint \"revision_rev_user_fkey\" to ON DELETE RESTRICT\n" );
19571949 $wgDatabase->sourceFile( archive( 'patch-revision_rev_user_fkey.sql' ) );
19581950 }
@@ -1963,8 +1955,7 @@
19641956 }
19651957 if ( pg_index_exists( 'ipblocks', 'ipb_address_unique' ) ) {
19661958 wfOut( "... have ipb_address_unique\n" );
1967 - }
1968 - else {
 1959+ } else {
19691960 wfOut( "Adding ipb_address_unique index\n" );
19701961 $wgDatabase->sourceFile( archive( 'patch-ipb_address_unique.sql' ) );
19711962 }
@@ -2039,7 +2030,7 @@
20402031 if ( $fi->is_deferred() && $fi->is_deferrable() ) {
20412032 continue;
20422033 }
2043 - wfOut( "Altering column \"$dc[0].$dc[1]\" to be DEFERRABLE INITTALLY DEFERRED\n" );
 2034+ wfOut( "Altering column \"$dc[0].$dc[1]\" to be DEFERRABLE INITIALLY DEFERRED\n" );
20442035 $conname = $fi->conname();
20452036 $clause = $dc[2];
20462037 $command = "ALTER TABLE $dc[0] DROP CONSTRAINT $conname";
@@ -2054,7 +2045,8 @@
20552046
20562047 # # If the server is 8.3 or higher, rewrite the tsearch2 triggers
20572048 # # in case they have the old 'default' versions
2058 - if ( $numver >= 8.3 )
 2049+ if ( $numver >= 8.3 ) {
20592050 $wgDatabase->sourceFile( archive( 'patch-tsearch2funcs.sql' ) );
 2051+ }
20602052 return;
20612053 }

Status & tagging log