Index: branches/iwtransclusion/phase3/maintenance/archives/patch-globaltemplatelinks.sql |
— | — | @@ -9,9 +9,10 @@ |
10 | 10 | -- The page ID of the calling page on the remote wiki |
11 | 11 | gtl_from_page int unsigned NOT NULL, |
12 | 12 | |
13 | | - -- The namespace name of the calling page on the remote wiki |
| 13 | + -- The namespace of the calling page on the remote wiki |
14 | 14 | -- Needed for display purposes, since the foreign namespace ID doesn't necessarily match a local one |
15 | | - gtl_from_namespace varchar(255) NOT NULL, |
| 15 | + -- The link between the namespace and the namespace name is made by the globalnamespaces table |
| 16 | + gtl_from_namespace int NOT NULL, |
16 | 17 | |
17 | 18 | -- The title of the calling page on the remote wiki |
18 | 19 | -- Needed for display purposes |
Index: branches/iwtransclusion/phase3/maintenance/archives/patch-globalnamespaces.sql |
— | — | @@ -0,0 +1,14 @@ |
| 2 | +-- Table listing distant wiki namespace texts. |
| 3 | +CREATE TABLE /*_*/globalnamespaces ( |
| 4 | + -- The wiki ID of the remote wiki |
| 5 | + gn_wiki varchar(64) NOT NULL, |
| 6 | + |
| 7 | + -- The namespace ID of the transcluded page on that wiki |
| 8 | + gn_namespace int NOT NULL, |
| 9 | + |
| 10 | + -- The namespace text of transcluded page |
| 11 | + -- Needed for display purposes, since the local namespace ID doesn't necessarily match a distant one |
| 12 | + gn_namespacetext varchar(255) NOT NULL |
| 13 | + |
| 14 | +) /*$wgDBTableOptions*/; |
| 15 | +CREATE UNIQUE INDEX /*i*/gn_index ON /*_*/globalnamespaces (gn_wiki, gn_namespace, gn_namespacetext); |
Index: branches/iwtransclusion/phase3/maintenance/archives/patch-globalinterwiki.sql |
— | — | @@ -0,0 +1,10 @@ |
| 2 | +-- Table associating distant wiki IDs with their interwiki prefixes. |
| 3 | +CREATE TABLE /*_*/globalinterwiki ( |
| 4 | + -- The wiki ID of the wiki |
| 5 | + giw_wikiid varchar(64) NOT NULL, |
| 6 | + |
| 7 | + -- The interwiki prefix of that wiki |
| 8 | + giw_prefix varchar(32) NOT NULL |
| 9 | + |
| 10 | +) /*$wgDBTableOptions*/; |
| 11 | +CREATE UNIQUE INDEX /*i*/giw_index ON /*_*/globalinterwiki (giw_wikiid, giw_prefix); |
Index: branches/iwtransclusion/phase3/includes/LinksUpdate.php |
— | — | @@ -379,7 +379,9 @@ |
380 | 380 | $dbw->delete( $table, $where, __METHOD__ ); |
381 | 381 | } |
382 | 382 | if ( count( $insertions ) ) { |
383 | | - $dbw->insert( $table, $insertions, __METHOD__, 'IGNORE' ); |
| 383 | + $dbw->insert( 'globaltemplatelinks', $insertions['globaltemplatelinks'], __METHOD__, 'IGNORE' ); |
| 384 | + $dbw->insert( 'globalnamespaces', $insertions['globalnamespaces'], __METHOD__, 'IGNORE' ); |
| 385 | + $dbw->insert( 'globalinterwiki', $insertions['globalinterwiki'], __METHOD__, 'IGNORE' ); |
384 | 386 | } |
385 | 387 | } |
386 | 388 | } |
— | — | @@ -433,16 +435,27 @@ |
434 | 436 | foreach( $this->mDistantTemplates as $prefix => $templatesToNS ) { |
435 | 437 | foreach( $templatesToNS as $ns => $dbkeys ) { |
436 | 438 | $diffs = isset( $existing[$prefix] ) && isset( $existing[$prefix][$ns] ) ? array_diff_key( $dbkeys, $existing[$prefix][$ns] ) : $dbkeys; |
| 439 | + $interwiki = Interwiki::fetch( $prefix ); |
| 440 | + $wikiid = $interwiki->getWikiID( ); |
437 | 441 | foreach ( $diffs as $dbk => $id ) { |
438 | | - $arr[] = array( |
| 442 | + $arr['globaltemplatelinks'][] = array( |
439 | 443 | 'gtl_from_wiki' => wfWikiID( ), |
440 | 444 | 'gtl_from_page' => $this->mId, |
441 | | - 'gtl_from_namespace' => $this->mTitle->getNsText(), |
| 445 | + 'gtl_from_namespace' => $this->mTitle->getNamespace(), |
442 | 446 | 'gtl_from_title' => $this->mTitle->getText(), |
443 | 447 | 'gtl_to_prefix' => $prefix, |
444 | 448 | 'gtl_to_namespace' => $ns, |
445 | 449 | 'gtl_to_title' => $dbk |
446 | 450 | ); |
| 451 | + $arr['globalinterwiki'][] = array( |
| 452 | + 'giw_wikiid' => $wikiid, |
| 453 | + 'giw_prefix' => $prefix |
| 454 | + ); |
| 455 | + $arr['globalnamespaces'][] = array( |
| 456 | + 'gn_wiki' => wfWikiID( ), |
| 457 | + 'gn_namespace' => $this->mTitle->getNamespace(), |
| 458 | + 'gn_namespacetext' => $this->mTitle->getNsText(), |
| 459 | + ); |
447 | 460 | } |
448 | 461 | } |
449 | 462 | } |
Index: branches/iwtransclusion/phase3/includes/BacklinkCache.php |
— | — | @@ -116,10 +116,12 @@ |
117 | 117 | |
118 | 118 | $dbr = $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); |
119 | 119 | $res = $dbr->select( |
120 | | - array( 'globaltemplatelinks' ), |
121 | | - array( 'gtl_from_wiki', 'gtl_from_page' ), |
| 120 | + array( 'globaltemplatelinks', 'globalinterwiki' ), |
| 121 | + array( 'gtl_from_wiki', 'gtl_from_page', 'gtl_from_title', 'giw_prefix' ), |
122 | 122 | array( 'gtl_to_prefix' => $wgLocalInterwiki, 'gtl_to_title' => $this->title->getDBkey( ) ), |
123 | | - __METHOD__ |
| 123 | + __METHOD__, |
| 124 | + null, |
| 125 | + array( 'gtl_from_wiki = giw_wikiid' ) |
124 | 126 | ); |
125 | 127 | return $res; |
126 | 128 | } |
Index: branches/iwtransclusion/phase3/includes/Title.php |
— | — | @@ -3123,7 +3123,7 @@ |
3124 | 3124 | if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) { |
3125 | 3125 | $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase ); |
3126 | 3126 | $dbw2->update( 'globaltemplatelinks', |
3127 | | - array( 'gtl_from_namespace' => $nt->getNsText(), |
| 3127 | + array( 'gtl_from_namespace' => $nt->getNamespace(), |
3128 | 3128 | 'gtl_from_title' => $nt->getText() ), |
3129 | 3129 | array ( 'gtl_from_page' => $pageid ), |
3130 | 3130 | __METHOD__ ); |
Index: branches/iwtransclusion/phase3/includes/HTMLCacheUpdate.php |
— | — | @@ -219,12 +219,18 @@ |
220 | 220 | global $wgUseFileCache, $wgUseSquid, $wgLocalInterwiki; |
221 | 221 | |
222 | 222 | $pagesByWiki = array(); |
| 223 | + $titleArray = array(); |
| 224 | + |
| 225 | + # Sort by WikiID in $pagesByWiki |
| 226 | + # Create the distant titles for Squid in $titleArray |
223 | 227 | foreach ( $distantPageArray as $row ) { |
224 | 228 | $wikiid = $row->gtl_from_wiki; |
225 | 229 | if( !isset( $pagesByWiki[$wikiid] ) ) { |
226 | 230 | $pagesByWiki[$wikiid] = array(); |
227 | 231 | } |
228 | 232 | $pagesByWiki[$wikiid][] = $row->gtl_from_page; |
| 233 | + |
| 234 | + $titleArray[] = Title::makeTitle( $row->gtl_from_namespace, $row->gtl_from_title, '', $row->gil_interwiki ); |
229 | 235 | } |
230 | 236 | |
231 | 237 | foreach ( $pagesByWiki as $wikiid => $pages ) { |
— | — | @@ -239,6 +245,12 @@ |
240 | 246 | ); |
241 | 247 | } |
242 | 248 | } |
| 249 | + |
| 250 | + # Update squid |
| 251 | + if ( $wgUseSquid ) { |
| 252 | + $u = SquidUpdate::newFromTitles( $titleArray ); |
| 253 | + $u->doUpdate(); |
| 254 | + } |
243 | 255 | } |
244 | 256 | } |
245 | 257 | |
Index: branches/iwtransclusion/phase3/includes/GlobalUsageQuery.php |
— | — | @@ -156,8 +156,12 @@ |
157 | 157 | } |
158 | 158 | |
159 | 159 | /* Perform select (Duh.) */ |
160 | | - $res = $this->db->select( 'globaltemplatelinks', |
| 160 | + $res = $this->db->select( |
161 | 161 | array( |
| 162 | + 'globaltemplatelinks', |
| 163 | + 'globalnamespaces' |
| 164 | + ), |
| 165 | + array( |
162 | 166 | 'gtl_to_title', |
163 | 167 | 'gtl_from_wiki', |
164 | 168 | 'gtl_from_page', |
— | — | @@ -170,6 +174,9 @@ |
171 | 175 | 'ORDER BY' => "gtl_to_title $order, gtl_from_wiki $order, gtl_from_page $order", |
172 | 176 | // Select an extra row to check whether we have more rows available |
173 | 177 | 'LIMIT' => $this->limit + 1, |
| 178 | + ), |
| 179 | + array( |
| 180 | + 'gtl_from_namespace = gn_namespace' |
174 | 181 | ) |
175 | 182 | ); |
176 | 183 | |
— | — | @@ -207,7 +214,7 @@ |
208 | 215 | $this->result[$row->gtl_to_title][$row->gtl_from_wiki][] = array( |
209 | 216 | 'template' => $row->gtl_to_title, |
210 | 217 | 'id' => $row->gtl_from_page, |
211 | | - 'namespace' => $row->gtl_from_namespace, |
| 218 | + 'namespace' => $row->gn_namespacetext, |
212 | 219 | 'title' => $row->gtl_from_title, |
213 | 220 | 'wiki' => $row->gtl_from_wiki, |
214 | 221 | ); |
Index: branches/iwtransclusion/phase3/includes/specials/SpecialGlobalFileUsage.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | |
8 | 8 | class SpecialGlobalFileUsage extends SpecialPage { |
9 | 9 | public function __construct() { |
10 | | - parent::__construct( 'GlobalFileUsage', 'globalfileusage' ); |
| 10 | + parent::__construct( 'GlobalFileUsage' ); |
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
Property changes on: branches/iwtransclusion/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
14 | 14 | Merged /trunk/phase3:r74211-74805 |