Index: branches/REL1_13/phase3/maintenance/postgres/archives/patch-ipb_address_unique.sql |
— | — | @@ -0,0 +1,2 @@ |
| 2 | +DROP INDEX IF EXISTS ipb_address; |
| 3 | +CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only); |
Property changes on: branches/REL1_13/phase3/maintenance/postgres/archives/patch-ipb_address_unique.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 4 | + native |
Index: branches/REL1_13/phase3/maintenance/postgres/tables.sql |
— | — | @@ -240,9 +240,8 @@ |
241 | 241 | ipb_range_end TEXT, |
242 | 242 | ipb_deleted SMALLINT NOT NULL DEFAULT 0, |
243 | 243 | ipb_block_email SMALLINT NOT NULL DEFAULT 0 |
244 | | - |
245 | 244 | ); |
246 | | -CREATE INDEX ipb_address ON ipblocks (ipb_address); |
| 245 | +CREATE UNIQUE INDEX ipb_address_unique ON ipblocks (ipb_address,ipb_user,ipb_auto,ipb_anon_only); |
247 | 246 | CREATE INDEX ipb_user ON ipblocks (ipb_user); |
248 | 247 | CREATE INDEX ipb_range ON ipblocks (ipb_range_start,ipb_range_end); |
249 | 248 | |
Index: branches/REL1_13/phase3/maintenance/updaters.inc |
— | — | @@ -1663,7 +1663,7 @@ |
1664 | 1664 | $wgDatabase->query("CREATE UNIQUE INDEX pagelink_unique ON pagelinks (pl_from,pl_namespace,pl_title)"); |
1665 | 1665 | } |
1666 | 1666 | else |
1667 | | - echo "... index \"pagelink_unique_index\" aready exists\n"; |
| 1667 | + echo "... index \"pagelink_unique_index\" already exists\n"; |
1668 | 1668 | |
1669 | 1669 | if (pg_fkey_deltype("revision_rev_user_fkey") == 'r') { |
1670 | 1670 | echo "... constraint \"revision_rev_user_fkey\" is ON DELETE RESTRICT\n"; |
— | — | @@ -1673,6 +1673,14 @@ |
1674 | 1674 | dbsource(archive('patch-revision_rev_user_fkey.sql')); |
1675 | 1675 | } |
1676 | 1676 | |
| 1677 | + # Fix ipb_address index |
| 1678 | + if (pg_index_exists('ipblocks', 'ipb_address_unique' )) { |
| 1679 | + echo "... have ipb_address_unique\n"; |
| 1680 | + } else { |
| 1681 | + echo "Adding ipb_address_unique index\n"; |
| 1682 | + dbsource(archive('patch-ipb_address_unique.sql')); |
| 1683 | + } |
| 1684 | + |
1677 | 1685 | global $wgExtNewTables, $wgExtPGNewFields, $wgExtNewIndexes; |
1678 | 1686 | # Add missing extension tables |
1679 | 1687 | foreach ( $wgExtNewTables as $nt ) { |
Index: branches/REL1_13/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -72,6 +72,7 @@ |
73 | 73 | var $mInsertId = NULL; |
74 | 74 | var $mLastResult = NULL; |
75 | 75 | var $numeric_version = NULL; |
| 76 | + var $mAffectedRows = NULL; |
76 | 77 | |
77 | 78 | function DatabasePostgres($server = false, $user = false, $password = false, $dbName = false, |
78 | 79 | $failFunction = false, $flags = 0 ) |
— | — | @@ -546,9 +547,11 @@ |
547 | 548 | |
548 | 549 | function doQuery( $sql ) { |
549 | 550 | if (function_exists('mb_convert_encoding')) { |
550 | | - return $this->mLastResult=pg_query( $this->mConn , mb_convert_encoding($sql,'UTF-8') ); |
| 551 | + $sql = mb_convert_encoding($sql,'UTF-8'); |
551 | 552 | } |
552 | | - return $this->mLastResult=pg_query( $this->mConn , $sql); |
| 553 | + $this->mLastResult = pg_query( $this->mConn, $sql); |
| 554 | + $this->mAffectedRows = NULL; // use pg_affected_rows(mLastResult) |
| 555 | + return $this->mLastResult; |
553 | 556 | } |
554 | 557 | |
555 | 558 | function queryIgnore( $sql, $fname = '' ) { |
— | — | @@ -641,9 +644,12 @@ |
642 | 645 | } |
643 | 646 | |
644 | 647 | function affectedRows() { |
645 | | - if( !isset( $this->mLastResult ) or ! $this->mLastResult ) |
| 648 | + if ( !is_null( $this->mAffectedRows ) ) { |
| 649 | + // Forced result for simulated queries |
| 650 | + return $this->mAffectedRows; |
| 651 | + } |
| 652 | + if( empty( $this->mLastResult ) ) |
646 | 653 | return 0; |
647 | | - |
648 | 654 | return pg_affected_rows( $this->mLastResult ); |
649 | 655 | } |
650 | 656 | |
— | — | @@ -809,7 +815,6 @@ |
810 | 816 | |
811 | 817 | $sql .= '(' . $this->makeList( $args ) . ')'; |
812 | 818 | $res = (bool)$this->query( $sql, $fname, $ignore ); |
813 | | - |
814 | 819 | if ( $ignore ) { |
815 | 820 | $bar = pg_last_error(); |
816 | 821 | if ($bar != false) { |
— | — | @@ -821,13 +826,15 @@ |
822 | 827 | } |
823 | 828 | } |
824 | 829 | } |
825 | | - |
826 | 830 | if ( $ignore ) { |
827 | 831 | $olde = error_reporting( $olde ); |
828 | 832 | if ($didbegin) { |
829 | 833 | $this->commit(); |
830 | 834 | } |
831 | 835 | |
| 836 | + // Set the affected row count for the whole operation |
| 837 | + $this->mAffectedRows = $numrowsinserted; |
| 838 | + |
832 | 839 | // IGNORE always returns true |
833 | 840 | return true; |
834 | 841 | } |
— | — | @@ -1271,6 +1278,8 @@ |
1272 | 1279 | function addQuotes( $s ) { |
1273 | 1280 | if ( is_null( $s ) ) { |
1274 | 1281 | return 'NULL'; |
| 1282 | + } else if ( is_bool( $s ) ) { |
| 1283 | + return intval( $s ); |
1275 | 1284 | } else if ($s instanceof Blob) { |
1276 | 1285 | return "'".$s->fetch($s)."'"; |
1277 | 1286 | } |
Index: branches/REL1_13/phase3/RELEASE-NOTES |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | |
7 | 7 | == MediaWiki 1.13.1 == |
8 | 8 | |
9 | | -September 4, 2008 |
| 9 | +September 6, 2008 |
10 | 10 | |
11 | 11 | This is a bugfix release of the Summer 2008 snapshot release of MediaWiki. |
12 | 12 | |
— | — | @@ -26,6 +26,7 @@ |
27 | 27 | performance for installations without memcached. |
28 | 28 | * (bug 13770) Fixed DOM module detection for installations with both dom |
29 | 29 | and domxml. |
| 30 | +* (bug 15148) Fixed Special:BlockIP for PostgreSQL |
30 | 31 | * Localisation updates, Achinese (ace) added. |
31 | 32 | |
32 | 33 | == Changes since 1.13.0rc2 == |