Index: trunk/phase3/maintenance/archives/patch-rename-iwl_prefix.sql |
— | — | @@ -1,5 +1,4 @@ |
2 | 2 | -- |
| 3 | +-- Recreates the iwl_prefix index for the iwlinks table |
3 | 4 | -- |
4 | | -DROP INDEX /*i*/iwl_prefix ON /*_*/iwlinks; |
5 | | -CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title); |
\ No newline at end of file |
| 5 | +CREATE UNIQUE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from); |
Index: trunk/phase3/maintenance/archives/patch-kill-iwl_pft.sql |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +-- |
| 3 | +-- Kill the old iwl_prefix_from_title index, which may be present on some |
| 4 | +-- installs if they ran update.php between it being added and being renamed |
| 5 | +-- |
| 6 | + |
| 7 | +DROP INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks; |
| 8 | + |
Property changes on: trunk/phase3/maintenance/archives/patch-kill-iwl_pft.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/maintenance/archives/patch-iwlinks.sql |
— | — | @@ -13,4 +13,4 @@ |
14 | 14 | ) /*$wgDBTableOptions*/; |
15 | 15 | |
16 | 16 | CREATE UNIQUE INDEX /*i*/iwl_from ON /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title); |
17 | | -CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title); |
| 17 | +CREATE UNIQUE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from); |
Index: trunk/phase3/maintenance/archives/patch-kill-iwl_prefix.sql |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +-- |
| 3 | +-- Kill the old iwl_prefix index, which may be present on some |
| 4 | +-- installs if they ran update.php between it being added and being renamed |
| 5 | +-- |
| 6 | + |
| 7 | +DROP INDEX /*i*/iwl_prefix ON /*_*/iwlinks; |
| 8 | + |
Index: trunk/phase3/maintenance/sqlite/archives/patch-kill-iwl_pft.sql |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +-- |
| 3 | +-- Kill the old iwl_prefix_from_title index, which may be present on some |
| 4 | +-- installs if they ran update.php between it being added and being renamed |
| 5 | +-- |
| 6 | + |
| 7 | +DROP INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks; |
| 8 | + |
Property changes on: trunk/phase3/maintenance/sqlite/archives/patch-kill-iwl_pft.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/maintenance/sqlite/archives/patch-kill-iwl_prefix.sql |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +-- |
| 3 | +-- Kill the old iwl_prefix index, which may be present on some |
| 4 | +-- installs if they ran update.php between it being added and being renamed |
| 5 | +-- |
| 6 | + |
| 7 | +DROP INDEX /*i*/iwl_prefix ON /*_*/iwlinks; |
| 8 | + |
Property changes on: trunk/phase3/maintenance/sqlite/archives/patch-kill-iwl_prefix.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/maintenance/postgres/archives/patch-kill-iwl_pft.sql |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +-- |
| 3 | +-- Kill the old iwl_prefix_from_title index, which may be present on some |
| 4 | +-- installs if they ran update.php between it being added and being renamed |
| 5 | +-- |
| 6 | + |
| 7 | +DROP INDEX iwl_prefix_from_title; |
| 8 | + |
Property changes on: trunk/phase3/maintenance/postgres/archives/patch-kill-iwl_pft.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/maintenance/postgres/archives/patch-kill-iwl_prefix.sql |
— | — | @@ -0,0 +1,7 @@ |
| 2 | +-- |
| 3 | +-- Kill the old iwl_prefix index, which may be present on some |
| 4 | +-- installs if they ran update.php between it being added and being renamed |
| 5 | +-- |
| 6 | + |
| 7 | +DROP INDEX iwl_prefix; |
| 8 | + |
Property changes on: trunk/phase3/maintenance/postgres/archives/patch-kill-iwl_prefix.sql |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 9 | + native |
Index: trunk/phase3/maintenance/postgres/archives/patch-rename-iwl_prefix.sql |
— | — | @@ -1,2 +1,2 @@ |
2 | 2 | DROP INDEX iwl_prefix; |
3 | | -CREATE INDEX iwl_prefix_from_title ON iwlinks (iwl_prefix, iwl_from, iwl_title); |
\ No newline at end of file |
| 3 | +CREATE UNIQUE INDEX iwl_prefix_title_from ON iwlinks (iwl_prefix, iwl_from, iwl_title); |
Index: trunk/phase3/maintenance/postgres/archives/patch-iwlinks.sql |
— | — | @@ -5,4 +5,4 @@ |
6 | 6 | iwl_title TEXT NOT NULL DEFAULT '' |
7 | 7 | ); |
8 | 8 | CREATE UNIQUE INDEX iwl_from ON iwlinks (iwl_from, iwl_prefix, iwl_title); |
9 | | -CREATE INDEX iwl_prefix ON iwlinks (iwl_prefix, iwl_title); |
| 9 | +CREATE UNIQUE INDEX iwl_prefix_title_from ON iwlinks (iwl_prefix, iwl_title, iwl_from); |
Index: trunk/phase3/maintenance/postgres/tables.sql |
— | — | @@ -625,4 +625,4 @@ |
626 | 626 | iwl_title TEXT NOT NULL DEFAULT '' |
627 | 627 | ); |
628 | 628 | CREATE UNIQUE INDEX iwl_from ON iwlinks (iwl_from, iwl_prefix, iwl_title); |
629 | | -CREATE INDEX iwl_prefix_from_title ON iwlinks (iwl_prefix, iwl_from, iwl_title); |
| 629 | +CREATE UNIQUE INDEX iwl_prefix_title_from ON iwlinks (iwl_prefix, iwl_title, iwl_from); |
Index: trunk/phase3/maintenance/updaters.inc |
— | — | @@ -1508,6 +1508,7 @@ |
1509 | 1509 | array( "watchlist", "wl_user", "(wl_user)" ), |
1510 | 1510 | array( "logging", "logging_user_type_time", "(log_user, log_type, log_timestamp)" ), |
1511 | 1511 | array( "logging", "logging_page_id_time", "(log_page,log_timestamp)" ), |
| 1512 | + array( "iwlinks", "iwl_prefix_title_from", "(iwl_prefix, iwl_title, iwl_from)" ), |
1512 | 1513 | ); |
1513 | 1514 | |
1514 | 1515 | $newrules = array( |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -623,7 +623,7 @@ |
624 | 624 | ) /*$wgDBTableOptions*/; |
625 | 625 | |
626 | 626 | CREATE UNIQUE INDEX /*i*/iwl_from ON /*_*/iwlinks (iwl_from, iwl_prefix, iwl_title); |
627 | | -CREATE INDEX /*i*/iwl_prefix_from_title ON /*_*/iwlinks (iwl_prefix, iwl_from, iwl_title); |
| 627 | +CREATE UNIQUE INDEX /*i*/iwl_prefix_title_from ON /*_*/iwlinks (iwl_prefix, iwl_title, iwl_from); |
628 | 628 | |
629 | 629 | |
630 | 630 | -- |
Index: trunk/phase3/includes/installer/MysqlUpdater.php |
— | — | @@ -149,9 +149,11 @@ |
150 | 150 | ), |
151 | 151 | '1.17' => array( |
152 | 152 | array( 'add_table', 'iwlinks', 'patch-iwlinks.sql' ), |
153 | | - array( 'add_index', 'iwlinks', 'iwl_prefix_from_title', 'patch-rename-iwl_prefix.sql' ), |
| 153 | + array( 'add_index', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ), |
154 | 154 | array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' ), |
155 | 155 | array( 'add_field', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ), |
| 156 | + array( 'drop_index_if_exists', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ), |
| 157 | + array( 'drop_index_if_exists', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ), |
156 | 158 | ), |
157 | 159 | ); |
158 | 160 | } |
Index: trunk/phase3/includes/installer/SqliteUpdater.php |
— | — | @@ -31,9 +31,11 @@ |
32 | 32 | ), |
33 | 33 | '1.17' => array( |
34 | 34 | array( 'add_table', 'iwlinks', 'patch-iwlinks.sql' ), |
35 | | - array( 'add_index', 'iwlinks', 'iwl_prefix_from_title', 'patch-rename-iwl_prefix.sql' ), |
| 35 | + array( 'add_index', 'iwlinks', 'iwl_prefix_title_from', 'patch-rename-iwl_prefix.sql' ), |
36 | 36 | array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' ), |
37 | 37 | array( 'add_field', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ), |
| 38 | + array( 'drop_index_if_exists', 'iwlinks', 'iwl_prefix', 'patch-kill-iwl_prefix.sql' ), |
| 39 | + array( 'drop_index_if_exists', 'iwlinks', 'iwl_prefix_from_title', 'patch-kill-iwl_pft.sql' ), |
38 | 40 | ), |
39 | 41 | ); |
40 | 42 | } |
Index: trunk/phase3/includes/api/ApiQueryIWBacklinks.php |
— | — | @@ -53,15 +53,15 @@ |
54 | 54 | 'original value returned by the previous query', '_badcontinue' ); |
55 | 55 | } |
56 | 56 | |
57 | | - $from = intval( $cont[0] ); |
58 | | - $prefix = $this->getDB()->strencode( $cont[1] ); |
59 | | - $title = $this->getDB()->strencode( $this->titleToKey( $cont[2] ) ); |
| 57 | + $prefix = $this->getDB()->strencode( $cont[0] ); |
| 58 | + $title = $this->getDB()->strencode( $this->titleToKey( $cont[1] ) ); |
| 59 | + $from = intval( $cont[2] ); |
60 | 60 | $this->addWhere( |
61 | | - "iwl_from > $from OR " . |
62 | | - "(iwl_from = $from AND " . |
63 | | - "(iwl_prefix > '$prefix' OR " . |
| 61 | + "iwl_prefix > '$prefix' OR " . |
64 | 62 | "(iwl_prefix = '$prefix' AND " . |
65 | | - "iwl_title >= '$title')))" |
| 63 | + "(iwl_title > '$title' OR " . |
| 64 | + "(iwl_title = '$title' AND " . |
| 65 | + "iwl_from >= $from)))" |
66 | 66 | ); |
67 | 67 | } |
68 | 68 | |
— | — | @@ -73,14 +73,17 @@ |
74 | 74 | |
75 | 75 | if ( isset( $params['prefix'] ) ) { |
76 | 76 | $this->addWhereFld( 'iwl_prefix', $params['prefix'] ); |
| 77 | + if ( isset( $params['title'] ) ) { |
| 78 | + $this->addWhereFld( 'iwl_title', $params['title'] ); |
| 79 | + $this->addOption( 'ORDER BY', 'iwl_from' ); |
| 80 | + } else { |
| 81 | + $this->addOption( 'ORDER BY', 'iwl_title, iwl_from' ); |
| 82 | + } |
| 83 | + } else { |
| 84 | + $this->addOption( 'ORDER BY', 'iwl_prefix, iwl_title, iwl_from' ); |
77 | 85 | } |
78 | | - |
79 | | - if ( isset( $params['title'] ) ) { |
80 | | - $this->addWhereFld( 'iwl_title', $params['title'] ); |
81 | | - } |
82 | 86 | |
83 | 87 | $this->addOption( 'LIMIT', $params['limit'] + 1 ); |
84 | | - $this->addOption( 'ORDER BY', 'iwl_from' ); |
85 | 88 | |
86 | 89 | $db = $this->getDB(); |
87 | 90 | $res = $this->select( __METHOD__ ); |
— | — | @@ -91,7 +94,7 @@ |
92 | 95 | if ( ++ $count > $params['limit'] ) { |
93 | 96 | // We've reached the one extra which shows that there are additional pages to be had. Stop here... |
94 | 97 | // Continue string preserved in case the redirect query doesn't pass the limit |
95 | | - $this->setContinueEnumParameter( 'continue', "{$row->iwl_from}|{$row->iwl_prefix}|{$row->iwl_title}" ); |
| 98 | + $this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" ); |
96 | 99 | break; |
97 | 100 | } |
98 | 101 | |
— | — | @@ -107,7 +110,7 @@ |
108 | 111 | |
109 | 112 | $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $entry ); |
110 | 113 | if ( !$fit ) { |
111 | | - $this->setContinueEnumParameter( 'continue', "{$row->iwl_from}|{$row->iwl_prefix}|{$row->iwl_title}" ); |
| 114 | + $this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" ); |
112 | 115 | break; |
113 | 116 | } |
114 | 117 | } |
— | — | @@ -145,9 +148,9 @@ |
146 | 149 | public function getDescription() { |
147 | 150 | return array( 'Find all pages that link to the given interwiki link.', |
148 | 151 | 'Can be used to find all links with a prefix, or', |
149 | | - 'all links to a title (any prefix).', |
| 152 | + 'all links to a title (with a given prefix).', |
150 | 153 | 'Using neither parameter is effectively "All IW Links"', |
151 | | - ); |
| 154 | + ); |
152 | 155 | } |
153 | 156 | |
154 | 157 | public function getPossibleErrors() { |