Index: branches/iwtransclusion/phase3v3/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/phase3v3/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/phase3v3/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/phase3v3/includes/LinksUpdate.php |
— | — | @@ -378,7 +378,9 @@ |
379 | 379 | $this->mDb->delete( $table, $where, __METHOD__ ); |
380 | 380 | } |
381 | 381 | if ( count( $insertions ) ) { |
382 | | - $this->mDb->insert( $table, $insertions, __METHOD__, 'IGNORE' ); |
| 382 | + $this->mDb->insert( 'globaltemplatelinks', $insertions['globaltemplatelinks'], __METHOD__, 'IGNORE' ); |
| 383 | + $this->mDb->insert( 'globalnamespaces', $insertions['globalnamespaces'], __METHOD__, 'IGNORE' ); |
| 384 | + $this->mDb->insert( 'globalinterwiki', $insertions['globalinterwiki'], __METHOD__, 'IGNORE' ); |
383 | 385 | } |
384 | 386 | } |
385 | 387 | |
— | — | @@ -466,16 +468,27 @@ |
467 | 469 | foreach( $this->mDistantTemplates as $wikiid => $templatesToNS ) { |
468 | 470 | foreach( $templatesToNS as $ns => $dbkeys ) { |
469 | 471 | $diffs = isset( $existing[$wikiid] ) && isset( $existing[$wikiid][$ns] ) ? array_diff_key( $dbkeys, $existing[$wikiid][$ns] ) : $dbkeys; |
| 472 | + $interwiki = Interwiki::fetch( $prefix ); |
| 473 | + $wikiid = $interwiki->getWikiID(); |
470 | 474 | foreach ( $diffs as $dbk => $id ) { |
471 | | - $arr[] = array( |
| 475 | + $arr['globaltemplatelinks'][] = array( |
472 | 476 | 'gtl_from_wiki' => $wgWikiID, |
473 | 477 | 'gtl_from_page' => $this->mId, |
474 | | - 'gtl_from_namespace' => $this->mTitle->getNsText(), |
| 478 | + 'gtl_from_namespace' => $this->mTitle->getNamespace(), |
475 | 479 | 'gtl_from_title' => $this->mTitle->getText(), |
476 | 480 | 'gtl_to_wiki' => $wikiid, |
477 | 481 | 'gtl_to_namespace' => $ns, |
478 | 482 | 'gtl_to_title' => $dbk |
479 | 483 | ); |
| 484 | + $arr['globalinterwiki'][] = array( |
| 485 | + 'giw_wikiid' => $wikiid, |
| 486 | + 'giw_prefix' => $prefix |
| 487 | + ); |
| 488 | + $arr['globalnamespaces'][] = array( |
| 489 | + 'gn_wiki' => wfWikiID( ), |
| 490 | + 'gn_namespace' => $this->mTitle->getNamespace(), |
| 491 | + 'gn_namespacetext' => $this->mTitle->getNsText(), |
| 492 | + ); |
480 | 493 | } |
481 | 494 | } |
482 | 495 | } |
Index: branches/iwtransclusion/phase3v3/includes/BacklinkCache.php |
— | — | @@ -183,10 +183,12 @@ |
184 | 184 | |
185 | 185 | $dbr = $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase ); |
186 | 186 | $res = $dbr->select( |
187 | | - array( 'globaltemplatelinks' ), |
188 | | - array( 'gtl_from_wiki', 'gtl_from_page' ), |
| 187 | + array( 'globaltemplatelinks', 'globalinterwiki' ), |
| 188 | + array( 'gtl_from_wiki', 'gtl_from_page', 'gtl_from_title', 'giw_prefix' ), |
189 | 189 | array( 'gtl_to_prefix' => $wgLocalInterwiki, 'gtl_to_title' => $this->title->getDBkey( ) ), |
190 | | - __METHOD__ |
| 190 | + __METHOD__, |
| 191 | + null, |
| 192 | + array( 'gtl_from_wiki = giw_wikiid' ) |
191 | 193 | ); |
192 | 194 | return $res; |
193 | 195 | } |
Index: branches/iwtransclusion/phase3v3/includes/cache/HTMLCacheUpdate.php |
— | — | @@ -216,12 +216,16 @@ |
217 | 217 | global $wgUseFileCache, $wgUseSquid, $wgLocalInterwiki; |
218 | 218 | |
219 | 219 | $pagesByWiki = array(); |
| 220 | + $titleArray = array(); |
| 221 | + # Sort by WikiID in $pagesByWiki |
| 222 | + # Create the distant titles for Squid in $titleArray |
220 | 223 | foreach ( $distantPageArray as $row ) { |
221 | 224 | $wikiid = $row->gtl_from_wiki; |
222 | 225 | if( !isset( $pagesByWiki[$wikiid] ) ) { |
223 | 226 | $pagesByWiki[$wikiid] = array(); |
224 | 227 | } |
225 | 228 | $pagesByWiki[$wikiid][] = $row->gtl_from_page; |
| 229 | + $titleArray[] = Title::makeTitle( $row->gtl_from_namespace, $row->gtl_from_title, '', $row->gil_interwiki ); |
226 | 230 | } |
227 | 231 | |
228 | 232 | foreach ( $pagesByWiki as $wikiid => $pages ) { |
— | — | @@ -236,6 +240,12 @@ |
237 | 241 | ); |
238 | 242 | } |
239 | 243 | } |
| 244 | + |
| 245 | + # Update squid |
| 246 | + if ( $wgUseSquid ) { |
| 247 | + $u = SquidUpdate::newFromTitles( $titleArray ); |
| 248 | + $u->doUpdate(); |
| 249 | + } |
240 | 250 | } |
241 | 251 | } |
242 | 252 | |
Index: branches/iwtransclusion/phase3v3/includes/Title.php |
— | — | @@ -3198,7 +3198,7 @@ |
3199 | 3199 | if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) { |
3200 | 3200 | $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase ); |
3201 | 3201 | $dbw2->update( 'globaltemplatelinks', |
3202 | | - array( 'gtl_from_namespace' => $nt->getNsText(), |
| 3202 | + array( 'gtl_from_namespace' => $nt->getNamespace(), |
3203 | 3203 | 'gtl_from_title' => $nt->getText() ), |
3204 | 3204 | array ( 'gtl_from_page' => $pageid ), |
3205 | 3205 | __METHOD__ ); |
Property changes on: branches/iwtransclusion/phase3v3/includes/Title.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
3206 | 3206 | Merged /branches/iwtransclusion/phase3v2/includes/Title.php:r87115 |
3207 | 3207 | Merged /branches/iwtransclusion/phase3/includes/Title.php:r76200 |
Index: branches/iwtransclusion/phase3v3/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/phase3v3/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 | /** |