r93000 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92999‎ | r93000 | r93001 >
Date:18:42, 24 July 2011
Author:reedy
Status:deferred
Tags:
Comment:
Merge r87115, merge of r76200
Modified paths:
  • /branches/iwtransclusion/phase3v3/includes/BacklinkCache.php (modified) (history)
  • /branches/iwtransclusion/phase3v3/includes/GlobalUsageQuery.php (modified) (history)
  • /branches/iwtransclusion/phase3v3/includes/LinksUpdate.php (modified) (history)
  • /branches/iwtransclusion/phase3v3/includes/Title.php (modified) (history)
  • /branches/iwtransclusion/phase3v3/includes/cache/HTMLCacheUpdate.php (modified) (history)
  • /branches/iwtransclusion/phase3v3/includes/specials/SpecialGlobalFileUsage.php (modified) (history)
  • /branches/iwtransclusion/phase3v3/maintenance/archives/patch-globalinterwiki.sql (added) (history)
  • /branches/iwtransclusion/phase3v3/maintenance/archives/patch-globalnamespaces.sql (added) (history)
  • /branches/iwtransclusion/phase3v3/maintenance/archives/patch-globaltemplatelinks.sql (modified) (history)

Diff [purge]

Index: branches/iwtransclusion/phase3v3/maintenance/archives/patch-globaltemplatelinks.sql
@@ -9,9 +9,10 @@
1010 -- The page ID of the calling page on the remote wiki
1111 gtl_from_page int unsigned NOT NULL,
1212
13 - -- The namespace name of the calling page on the remote wiki
 13+ -- The namespace of the calling page on the remote wiki
1414 -- 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,
1617
1718 -- The title of the calling page on the remote wiki
1819 -- 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 @@
379379 $this->mDb->delete( $table, $where, __METHOD__ );
380380 }
381381 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' );
383385 }
384386 }
385387
@@ -466,16 +468,27 @@
467469 foreach( $this->mDistantTemplates as $wikiid => $templatesToNS ) {
468470 foreach( $templatesToNS as $ns => $dbkeys ) {
469471 $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();
470474 foreach ( $diffs as $dbk => $id ) {
471 - $arr[] = array(
 475+ $arr['globaltemplatelinks'][] = array(
472476 'gtl_from_wiki' => $wgWikiID,
473477 'gtl_from_page' => $this->mId,
474 - 'gtl_from_namespace' => $this->mTitle->getNsText(),
 478+ 'gtl_from_namespace' => $this->mTitle->getNamespace(),
475479 'gtl_from_title' => $this->mTitle->getText(),
476480 'gtl_to_wiki' => $wikiid,
477481 'gtl_to_namespace' => $ns,
478482 'gtl_to_title' => $dbk
479483 );
 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+ );
480493 }
481494 }
482495 }
Index: branches/iwtransclusion/phase3v3/includes/BacklinkCache.php
@@ -183,10 +183,12 @@
184184
185185 $dbr = $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
186186 $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' ),
189189 array( 'gtl_to_prefix' => $wgLocalInterwiki, 'gtl_to_title' => $this->title->getDBkey( ) ),
190 - __METHOD__
 190+ __METHOD__,
 191+ null,
 192+ array( 'gtl_from_wiki = giw_wikiid' )
191193 );
192194 return $res;
193195 }
Index: branches/iwtransclusion/phase3v3/includes/cache/HTMLCacheUpdate.php
@@ -216,12 +216,16 @@
217217 global $wgUseFileCache, $wgUseSquid, $wgLocalInterwiki;
218218
219219 $pagesByWiki = array();
 220+ $titleArray = array();
 221+ # Sort by WikiID in $pagesByWiki
 222+ # Create the distant titles for Squid in $titleArray
220223 foreach ( $distantPageArray as $row ) {
221224 $wikiid = $row->gtl_from_wiki;
222225 if( !isset( $pagesByWiki[$wikiid] ) ) {
223226 $pagesByWiki[$wikiid] = array();
224227 }
225228 $pagesByWiki[$wikiid][] = $row->gtl_from_page;
 229+ $titleArray[] = Title::makeTitle( $row->gtl_from_namespace, $row->gtl_from_title, '', $row->gil_interwiki );
226230 }
227231
228232 foreach ( $pagesByWiki as $wikiid => $pages ) {
@@ -236,6 +240,12 @@
237241 );
238242 }
239243 }
 244+
 245+ # Update squid
 246+ if ( $wgUseSquid ) {
 247+ $u = SquidUpdate::newFromTitles( $titleArray );
 248+ $u->doUpdate();
 249+ }
240250 }
241251 }
242252
Index: branches/iwtransclusion/phase3v3/includes/Title.php
@@ -3198,7 +3198,7 @@
31993199 if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) {
32003200 $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
32013201 $dbw2->update( 'globaltemplatelinks',
3202 - array( 'gtl_from_namespace' => $nt->getNsText(),
 3202+ array( 'gtl_from_namespace' => $nt->getNamespace(),
32033203 'gtl_from_title' => $nt->getText() ),
32043204 array ( 'gtl_from_page' => $pageid ),
32053205 __METHOD__ );
Property changes on: branches/iwtransclusion/phase3v3/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
32063206 Merged /branches/iwtransclusion/phase3v2/includes/Title.php:r87115
32073207 Merged /branches/iwtransclusion/phase3/includes/Title.php:r76200
Index: branches/iwtransclusion/phase3v3/includes/GlobalUsageQuery.php
@@ -156,8 +156,12 @@
157157 }
158158
159159 /* Perform select (Duh.) */
160 - $res = $this->db->select( 'globaltemplatelinks',
 160+ $res = $this->db->select(
161161 array(
 162+ 'globaltemplatelinks',
 163+ 'globalnamespaces'
 164+ ),
 165+ array(
162166 'gtl_to_title',
163167 'gtl_from_wiki',
164168 'gtl_from_page',
@@ -170,6 +174,9 @@
171175 'ORDER BY' => "gtl_to_title $order, gtl_from_wiki $order, gtl_from_page $order",
172176 // Select an extra row to check whether we have more rows available
173177 'LIMIT' => $this->limit + 1,
 178+ ),
 179+ array(
 180+ 'gtl_from_namespace = gn_namespace'
174181 )
175182 );
176183
@@ -207,7 +214,7 @@
208215 $this->result[$row->gtl_to_title][$row->gtl_from_wiki][] = array(
209216 'template' => $row->gtl_to_title,
210217 'id' => $row->gtl_from_page,
211 - 'namespace' => $row->gtl_from_namespace,
 218+ 'namespace' => $row->gn_namespacetext,
212219 'title' => $row->gtl_from_title,
213220 'wiki' => $row->gtl_from_wiki,
214221 );
Index: branches/iwtransclusion/phase3v3/includes/specials/SpecialGlobalFileUsage.php
@@ -6,7 +6,7 @@
77
88 class SpecialGlobalFileUsage extends SpecialPage {
99 public function __construct() {
10 - parent::__construct( 'GlobalFileUsage', 'globalfileusage' );
 10+ parent::__construct( 'GlobalFileUsage' );
1111 }
1212
1313 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r76200Adding and using globalinterwiki and globalnamespaces tables; that should do ...peter1717:35, 6 November 2010
r87115Merge r76200...reedy01:04, 29 April 2011

Status & tagging log