r98467 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r98466‎ | r98467 | r98468 >
Date:22:08, 29 September 2011
Author:reedy
Status:resolved (Comments)
Tags:
Comment:
Back out r95396 and friends
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/BacklinkCache.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/EditPage.php (modified) (history)
  • /trunk/phase3/includes/GlobalUsageQuery.php (deleted) (history)
  • /trunk/phase3/includes/Linker.php (modified) (history)
  • /trunk/phase3/includes/LinksUpdate.php (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/SpecialPageFactory.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/includes/cache/HTMLCacheUpdate.php (modified) (history)
  • /trunk/phase3/includes/db/Database.php (modified) (history)
  • /trunk/phase3/includes/installer/MysqlUpdater.php (modified) (history)
  • /trunk/phase3/includes/installer/SqliteUpdater.php (modified) (history)
  • /trunk/phase3/includes/interwiki/Interwiki.php (modified) (history)
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/includes/parser/ParserOutput.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_DOM.php (modified) (history)
  • /trunk/phase3/includes/parser/Preprocessor_Hash.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialGlobalFileUsage.php (deleted) (history)
  • /trunk/phase3/includes/specials/SpecialGlobalTemplateUsage.php (deleted) (history)
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/maintenance/archives/patch-globalinterwiki.sql (deleted) (history)
  • /trunk/phase3/maintenance/archives/patch-globalnamespaces.sql (deleted) (history)
  • /trunk/phase3/maintenance/archives/patch-globaltemplatelinks.sql (deleted) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -461,8 +461,6 @@
462462 'Watchlist' => array( 'Watchlist' ),
463463 'Whatlinkshere' => array( 'WhatLinksHere' ),
464464 'Withoutinterwiki' => array( 'WithoutInterwiki' ),
465 - 'GlobalFileUsage' => array( 'GlobalFileUsage' ),
466 - 'GlobalTemplateUsage' => array( 'GlobalTemplateUsage' ),
467465 );
468466
469467 /**
@@ -1412,9 +1410,6 @@
14131411 'templatesused' => '{{PLURAL:$1|Template|Templates}} used on this page:',
14141412 'templatesusedpreview' => '{{PLURAL:$1|Template|Templates}} used in this preview:',
14151413 'templatesusedsection' => '{{PLURAL:$1|Template|Templates}} used in this section:',
1416 -'distanttemplatesused' => 'Distant {{PLURAL:$1|template|templates}} used on this page:',
1417 -'distanttemplatesusedpreview' => 'Distant {{PLURAL:$1|template|templates}} used in this preview:',
1418 -'distanttemplatesusedsection' => 'Distant {{PLURAL:$1|template|templates}} used in this section:',
14191414 'template-protected' => '(protected)',
14201415 'template-semiprotected' => '(semi-protected)',
14211416 'hiddencategories' => 'This page is a member of {{PLURAL:$1|1 hidden category|$1 hidden categories}}:',
@@ -4580,27 +4575,7 @@
45814576 'compare-title-not-exists' => 'The title you specified does not exist.',
45824577 'compare-revision-not-exists' => 'The revision you specified does not exist.',
45834578
4584 -# Special:GlobalFileUsage
4585 -'globalfileusage' => 'Global file usage',
4586 -'globalfileusage-for' => 'Global file usage for "$1"',
4587 -'globalfileusage-desc' => '[[Special:GlobalFileUsage|Special page]] to view global file usage',
4588 -'globalfileusage-ok' => 'Search',
4589 -'globalfileusage-text' => 'Search global file usage',
4590 -'globalfileusage-no-results' => '[[$1]] is not used on other wikis.',
4591 -'globalfileusage-on-wiki' => 'Usage on $2',
4592 -'globalfileusage-more' => 'View [[{{#Special:GlobalUsage}}/$1|more global usage]] of this file.',
4593 -'globalfileusage-filterlocal' => 'Do not show local usage',
45944579
4595 -# Special:GlobalTemplateUsage
4596 -'globaltemplateusage' => 'Global template usage',
4597 -'globaltemplateusage-for' => 'Global template usage for "$1"',
4598 -'globaltemplateusage-ok' => 'Search',
4599 -'globaltemplateusage-text' => 'Search global template usage',
4600 -'globaltemplateusage-no-results' => '[[$1]] is not used on other wikis.',
4601 -'globaltemplateusage-on-wiki' => 'Usage on $2',
4602 -'globaltemplateusage-more' => 'View [[{{#Special:GlobalUsage}}/$1|more global usage]] of this template.',
4603 -'globaltemplateusage-filterlocal' => 'Do not show local usage',
4604 -
46054580 # Database error messages
46064581 'dberr-header' => 'This wiki has a problem',
46074582 'dberr-problems' => 'Sorry!
Index: trunk/phase3/maintenance/archives/patch-globalnamespaces.sql
@@ -1,14 +0,0 @@
2 -CREATE TABLE /*_*/globalnamespaces (
3 - -- The wiki ID of the remote wiki
4 - gn_wiki varchar(64) NOT NULL,
5 -
6 - -- The namespace ID of the transcluded page on that wiki
7 - gn_namespace int NOT NULL,
8 -
9 - -- The namespace text of transcluded page
10 - -- Needed for display purposes, since the local namespace ID doesn't necessarily match a distant one
11 - gn_namespacetext varchar(255) NOT NULL
12 -
13 -) /*$wgDBTableOptions*/;
14 -CREATE UNIQUE INDEX /*i*/gn_index ON /*_*/globalnamespaces (gn_wiki, gn_namespace, gn_namespacetext);
Index: trunk/phase3/maintenance/archives/patch-globaltemplatelinks.sql
@@ -1,36 +0,0 @@
2 -CREATE TABLE /*_*/globaltemplatelinks (
3 - -- The wiki ID of the remote wiki
4 - gtl_from_wiki varchar(64) NOT NULL,
5 -
6 - -- The page ID of the calling page on the remote wiki
7 - gtl_from_page int unsigned NOT NULL,
8 -
9 - -- The namespace of the calling page on the remote wiki
10 - -- Needed for display purposes, since the foreign namespace ID doesn't necessarily match a local one
11 - -- The link between the namespace and the namespace name is made by the globalnamespaces table
12 - gtl_from_namespace int NOT NULL,
13 -
14 - -- The title of the calling page on the remote wiki
15 - -- Needed for display purposes
16 - gtl_from_title varchar(255) binary NOT NULL,
17 -
18 - -- The interwiki prefix of the wiki that hosts the transcluded page
19 - gtl_to_prefix varchar(32) NOT NULL,
20 -
21 - -- The namespace of the transcluded page on that wiki
22 - gtl_to_namespace int NOT NULL,
23 -
24 - -- The namespace name of transcluded page
25 - -- Needed for display purposes, since the local namespace ID doesn't necessarily match a distant one
26 - gtl_to_namespacetext varchar(255) NOT NULL,
27 -
28 - -- The title of the transcluded page on that wiki
29 - gtl_to_title varchar(255) binary NOT NULL
30 -) /*$wgDBTableOptions*/;
31 -
32 -CREATE UNIQUE INDEX /*i*/gtl_to_from ON /*_*/globaltemplatelinks (gtl_to_prefix, gtl_to_namespace, gtl_to_title, gtl_from_wiki, gtl_from_page);
33 -CREATE UNIQUE INDEX /*i*/gtl_from_to ON /*_*/globaltemplatelinks (gtl_from_wiki, gtl_from_page, gtl_to_prefix, gtl_to_namespace, gtl_to_title);
Index: trunk/phase3/maintenance/archives/patch-globalinterwiki.sql
@@ -1,10 +0,0 @@
2 -CREATE TABLE /*_*/globalinterwiki (
3 - -- The wiki ID of the wiki
4 - giw_wikiid varchar(64) NOT NULL,
5 -
6 - -- The interwiki prefix of that wiki
7 - giw_prefix varchar(32) NOT NULL
8 -
9 -) /*$wgDBTableOptions*/;
10 -CREATE UNIQUE INDEX /*i*/giw_index ON /*_*/globalinterwiki (giw_wikiid, giw_prefix);
Index: trunk/phase3/maintenance/tables.sql
@@ -1474,68 +1474,4 @@
14751475 -- Should cover *most* configuration - strings, ints, bools, etc.
14761476 CREATE INDEX /*i*/cf_name_value ON /*_*/config (cf_name,cf_value(255));
14771477
1478 -CREATE TABLE /*_*/globaltemplatelinks (
1479 - -- The wiki ID of the remote wiki
1480 - gtl_from_wiki varchar(64) NOT NULL,
1481 -
1482 - -- The page ID of the calling page on the remote wiki
1483 - gtl_from_page int unsigned NOT NULL,
1484 -
1485 - -- The namespace of the calling page on the remote wiki
1486 - -- Needed for display purposes, since the foreign namespace ID doesn't necessarily match a local one
1487 - -- The link between the namespace and the namespace name is made by the globalnamespaces table
1488 - gtl_from_namespace int NOT NULL,
1489 -
1490 - -- The title of the calling page on the remote wiki
1491 - -- Needed for display purposes
1492 - gtl_from_title varchar(255) binary NOT NULL,
1493 -
1494 - -- The interwiki prefix of the wiki that hosts the transcluded page
1495 - gtl_to_prefix varchar(32) NOT NULL,
1496 -
1497 - -- The namespace of the transcluded page on that wiki
1498 - gtl_to_namespace int NOT NULL,
1499 -
1500 - -- The namespace name of transcluded page
1501 - -- Needed for display purposes, since the local namespace ID doesn't necessarily match a distant one
1502 - gtl_to_namespacetext varchar(255) NOT NULL,
1503 -
1504 - -- The title of the transcluded page on that wiki
1505 - gtl_to_title varchar(255) binary NOT NULL
1506 -) /*$wgDBTableOptions*/;
1507 -
1508 -CREATE UNIQUE INDEX /*i*/gtl_to_from ON /*_*/globaltemplatelinks (gtl_to_prefix, gtl_to_namespace, gtl_to_title, gtl_from_wiki, gtl_from_page);
1509 -CREATE UNIQUE INDEX /*i*/gtl_from_to ON /*_*/globaltemplatelinks (gtl_from_wiki, gtl_from_page, gtl_to_prefix, gtl_to_namespace, gtl_to_title);
1510 -
1511 -CREATE TABLE /*_*/globalnamespaces (
1512 - -- The wiki ID of the remote wiki
1513 - gn_wiki varchar(64) NOT NULL,
1514 -
1515 - -- The namespace ID of the transcluded page on that wiki
1516 - gn_namespace int NOT NULL,
1517 -
1518 - -- The namespace text of transcluded page
1519 - -- Needed for display purposes, since the local namespace ID doesn't necessarily match a distant one
1520 - gn_namespacetext varchar(255) NOT NULL
1521 -
1522 -) /*$wgDBTableOptions*/;
1523 -CREATE UNIQUE INDEX /*i*/gn_index ON /*_*/globalnamespaces (gn_wiki, gn_namespace, gn_namespacetext);
1524 -
1525 -CREATE TABLE /*_*/globalinterwiki (
1526 - -- The wiki ID of the wiki
1527 - giw_wikiid varchar(64) NOT NULL,
1528 -
1529 - -- The interwiki prefix of that wiki
1530 - giw_prefix varchar(32) NOT NULL
1531 -
1532 -) /*$wgDBTableOptions*/;
1533 -CREATE UNIQUE INDEX /*i*/giw_index ON /*_*/globalinterwiki (giw_wikiid, giw_prefix);
1534 -
1535 -
15361478 -- vim: sw=2 sts=2 et
Property changes on: trunk/phase3/maintenance/tables.sql
___________________________________________________________________
Modified: svn:mergeinfo
15371479 Reverse-merged /branches/iwtransclusion/phase3v3/maintenance/tables.sql:r92983-95395
Index: trunk/phase3/maintenance/language/messages.inc
@@ -645,9 +645,6 @@
646646 'templatesused',
647647 'templatesusedpreview',
648648 'templatesusedsection',
649 - 'distanttemplatesused',
650 - 'distanttemplatesusedpreview',
651 - 'distanttemplatesusedsection',
652649 'template-protected',
653650 'template-semiprotected',
654651 'hiddencategories',
@@ -3444,27 +3441,6 @@
34453442 'compare-title-not-exists',
34463443 'compare-revision-not-exists',
34473444 ),
3448 - 'globalfileusage' => array(
3449 - 'globalfileusage',
3450 - 'globalfileusage-for',
3451 - 'globalfileusage-desc',
3452 - 'globalfileusage-ok',
3453 - 'globalfileusage-text',
3454 - 'globalfileusage-no-results',
3455 - 'globalfileusage-on-wiki',
3456 - 'globalfileusage-more',
3457 - 'globalfileusage-filterlocal',
3458 - ),
3459 - 'globaltemplateusage' => array(
3460 - 'globaltemplateusage',
3461 - 'globaltemplateusage-for',
3462 - 'globaltemplateusage-ok',
3463 - 'globaltemplateusage-text',
3464 - 'globaltemplateusage-no-results',
3465 - 'globaltemplateusage-on-wiki',
3466 - 'globaltemplateusage-more',
3467 - 'globaltemplateusage-filterlocal',
3468 - ),
34693445 'db-error-messages' => array(
34703446 'dberr-header',
34713447 'dberr-problems',
@@ -3752,8 +3728,6 @@
37533729 'external_images' => 'External image whitelist',
37543730 'special-tags' => 'Special:Tags',
37553731 'comparepages' => 'Special:ComparePages',
3756 - 'globalfileusage' => 'Special:GlobalFileUsage',
3757 - 'globaltemplateusage' => 'Special:GlobalTemplateUsage',
37583732 'db-error-messages' => 'Database error messages',
37593733 'html-forms' => 'HTML forms',
37603734 'sqlite' => 'SQLite database support',
Index: trunk/phase3/includes/GlobalUsageQuery.php
@@ -1,367 +0,0 @@
2 -<?php
3 -/**
4 - * A helper class to query the globalimagelinks table
5 - *
6 - */
7 -class GlobalUsageQuery {
8 - private $limit = 50;
9 - private $offset;
10 - private $hasMore = false;
11 - private $filterLocal = false;
12 - private $result;
13 - private $continue;
14 - private $reversed = false;
15 - private $target = null;
16 -
17 - /**
18 - * @param $target mixed Title or db key, or array of db keys of target(s)
19 - */
20 - public function __construct( $target ) {
21 - global $wgGlobalDatabase;
22 - $this->db = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
23 - if ( $target instanceof Title && $target->getNamespace( ) == NS_FILE ) {
24 - $this->target = $target->getDBKey();
25 - } else {
26 - $this->target = $target;
27 - }
28 - $this->offset = array();
29 - }
30 -
31 - /**
32 - * Set the offset parameter
33 - *
34 - * @param $offset string offset
35 - * @param $reversed bool True if this is the upper offset
36 - */
37 - public function setOffset( $offset, $reversed = null ) {
38 - if ( !is_null( $reversed ) ) {
39 - $this->reversed = $reversed;
40 - }
41 -
42 - if ( !is_array( $offset ) ) {
43 - $offset = explode( '|', $offset );
44 - }
45 -
46 - if ( count( $offset ) == 3 ) {
47 - $this->offset = $offset;
48 - return true;
49 - } else {
50 - return false;
51 - }
52 - }
53 - /**
54 - * Return the offset set by the user
55 - *
56 - * @return array offset
57 - */
58 - public function getOffsetString() {
59 - return implode( '|', $this->offset );
60 - }
61 - /**
62 - * Is the result reversed
63 - *
64 - * @return bool
65 - */
66 - public function isReversed() {
67 - return $this->reversed;
68 - }
69 -
70 - /**
71 - * Returns the string used for continuation in a file search
72 - *
73 - * @return string
74 - *
75 - */
76 - public function getContinueFileString() {
77 - if ( $this->hasMore() ) {
78 - return "{$this->lastRow->gil_to}|{$this->lastRow->gil_wiki}|{$this->lastRow->gil_page}";
79 - } else {
80 - return '';
81 - }
82 - }
83 -
84 - /**
85 - * Returns the string used for continuation in a template search
86 - *
87 - * @return string
88 - *
89 - */
90 - public function getContinueTemplateString() {
91 - if ( $this->hasMore() ) {
92 - return "{$this->lastRow->gtl_to_title}|{$this->lastRow->gtl_from_wiki}|{$this->lastRow->gtl_from_page}";
93 - } else {
94 - return '';
95 - }
96 - }
97 -
98 - /**
99 - * Set the maximum amount of items to return. Capped at 500.
100 - *
101 - * @param $limit int The limit
102 - */
103 - public function setLimit( $limit ) {
104 - $this->limit = min( $limit, 500 );
105 - }
106 - /**
107 - * Returns the user set limit
108 - */
109 - public function getLimit() {
110 - return $this->limit;
111 - }
112 -
113 - /**
114 - * Set whether to filter out the local usage
115 - */
116 - public function filterLocal( $value = true ) {
117 - $this->filterLocal = $value;
118 - }
119 -
120 - /**
121 - * Executes the query for a file search
122 - */
123 - public function searchTemplate() {
124 - global $wgLocalInterwiki;
125 -
126 - /* Construct a where clause */
127 - // Add target template(s)
128 - $where = array( 'gtl_to_prefix' => $wgLocalInterwiki,
129 - 'gtl_to_namespace' => $this->target->getNamespace( ),
130 - 'gtl_to_title' => $this->target->getDBkey( )
131 - );
132 -
133 - // Set the continuation condition
134 - $order = 'ASC';
135 - if ( $this->offset ) {
136 - $qTo = $this->db->addQuotes( $this->offset[0] );
137 - $qWiki = $this->db->addQuotes( $this->offset[1] );
138 - $qPage = intval( $this->offset[2] );
139 -
140 - // Check which limit we got in order to determine which way to traverse rows
141 - if ( $this->reversed ) {
142 - // Reversed traversal; do not include offset row
143 - $op1 = '<';
144 - $op2 = '<';
145 - $order = 'DESC';
146 - } else {
147 - // Normal traversal; include offset row
148 - $op1 = '>';
149 - $op2 = '>=';
150 - $order = 'ASC';
151 - }
152 -
153 - $where[] = "(gtl_to_title $op1 $qTo) OR " .
154 - "(gtl_to_title = $qTo AND gtl_from_wiki $op1 $qWiki) OR " .
155 - "(gtl_to_title = $qTo AND gtl_from_wiki = $qWiki AND gtl_from_page $op2 $qPage)";
156 - }
157 -
158 - /* Perform select (Duh.) */
159 - $res = $this->db->select(
160 - array(
161 - 'globaltemplatelinks',
162 - 'globalnamespaces'
163 - ),
164 - array(
165 - 'gtl_to_title',
166 - 'gtl_from_wiki',
167 - 'gtl_from_page',
168 - 'gtl_from_namespace',
169 - 'gtl_from_title'
170 - ),
171 - $where,
172 - __METHOD__,
173 - array(
174 - 'ORDER BY' => "gtl_to_title $order, gtl_from_wiki $order, gtl_from_page $order",
175 - // Select an extra row to check whether we have more rows available
176 - 'LIMIT' => $this->limit + 1,
177 - ),
178 - array(
179 - 'gtl_from_namespace = gn_namespace'
180 - )
181 - );
182 -
183 - /* Process result */
184 - // Always return the result in the same order; regardless whether reversed was specified
185 - // reversed is really only used to determine from which direction the offset is
186 - $rows = array();
187 - foreach ( $res as $row ) {
188 - $rows[] = $row;
189 - }
190 - if ( $this->reversed ) {
191 - $rows = array_reverse( $rows );
192 - }
193 -
194 - // Build the result array
195 - $count = 0;
196 - $this->hasMore = false;
197 - $this->result = array();
198 - foreach ( $rows as $row ) {
199 - $count++;
200 - if ( $count > $this->limit ) {
201 - // We've reached the extra row that indicates that there are more rows
202 - $this->hasMore = true;
203 - $this->lastRow = $row;
204 - break;
205 - }
206 -
207 - if ( !isset( $this->result[$row->gtl_to_title] ) ) {
208 - $this->result[$row->gtl_to_title] = array();
209 - }
210 - if ( !isset( $this->result[$row->gtl_to_title][$row->gtl_from_wiki] ) ) {
211 - $this->result[$row->gtl_to_title][$row->gtl_from_wiki] = array();
212 - }
213 -
214 - $this->result[$row->gtl_to_title][$row->gtl_from_wiki][] = array(
215 - 'template' => $row->gtl_to_title,
216 - 'id' => $row->gtl_from_page,
217 - 'namespace' => $row->gn_namespacetext,
218 - 'title' => $row->gtl_from_title,
219 - 'wiki' => $row->gtl_from_wiki,
220 - );
221 - }
222 - }
223 -
224 - /**
225 - * Executes the query for a template search
226 - */
227 - public function searchFile() {
228 - /* Construct a where clause */
229 - // Add target image(s)
230 - $where = array( 'gil_to' => $this->target );
231 -
232 - if ( $this->filterLocal ) {
233 - // Don't show local file usage
234 - $where[] = 'gil_wiki != ' . $this->db->addQuotes( wfWikiId() );
235 - }
236 -
237 - // Set the continuation condition
238 - $order = 'ASC';
239 - if ( $this->offset ) {
240 - $qTo = $this->db->addQuotes( $this->offset[0] );
241 - $qWiki = $this->db->addQuotes( $this->offset[1] );
242 - $qPage = intval( $this->offset[2] );
243 -
244 - // Check which limit we got in order to determine which way to traverse rows
245 - if ( $this->reversed ) {
246 - // Reversed traversal; do not include offset row
247 - $op1 = '<';
248 - $op2 = '<';
249 - $order = 'DESC';
250 - } else {
251 - // Normal traversal; include offset row
252 - $op1 = '>';
253 - $op2 = '>=';
254 - $order = 'ASC';
255 - }
256 -
257 - $where[] = "(gil_to $op1 $qTo) OR " .
258 - "(gil_to = $qTo AND gil_wiki $op1 $qWiki) OR " .
259 - "(gil_to = $qTo AND gil_wiki = $qWiki AND gil_page $op2 $qPage)";
260 - }
261 -
262 - /* Perform select (Duh.) */
263 - $res = $this->db->select( 'globalimagelinks',
264 - array(
265 - 'gil_to',
266 - 'gil_wiki',
267 - 'gil_page',
268 - 'gil_page_namespace',
269 - 'gil_page_title'
270 - ),
271 - $where,
272 - __METHOD__,
273 - array(
274 - 'ORDER BY' => "gil_to $order, gil_wiki $order, gil_page $order",
275 - // Select an extra row to check whether we have more rows available
276 - 'LIMIT' => $this->limit + 1,
277 - )
278 - );
279 -
280 - /* Process result */
281 - // Always return the result in the same order; regardless whether reversed was specified
282 - // reversed is really only used to determine from which direction the offset is
283 - $rows = array();
284 - foreach ( $res as $row ) {
285 - $rows[] = $row;
286 - }
287 - if ( $this->reversed ) {
288 - $rows = array_reverse( $rows );
289 - }
290 -
291 - // Build the result array
292 - $count = 0;
293 - $this->hasMore = false;
294 - $this->result = array();
295 - foreach ( $rows as $row ) {
296 - $count++;
297 - if ( $count > $this->limit ) {
298 - // We've reached the extra row that indicates that there are more rows
299 - $this->hasMore = true;
300 - $this->lastRow = $row;
301 - break;
302 - }
303 -
304 - if ( !isset( $this->result[$row->gil_to] ) ) {
305 - $this->result[$row->gil_to] = array();
306 - }
307 - if ( !isset( $this->result[$row->gil_to][$row->gil_wiki] ) ) {
308 - $this->result[$row->gil_to][$row->gil_wiki] = array();
309 - }
310 -
311 - $this->result[$row->gil_to][$row->gil_wiki][] = array(
312 - 'image' => $row->gil_to,
313 - 'id' => $row->gil_page,
314 - 'namespace' => $row->gil_page_namespace,
315 - 'title' => $row->gil_page_title,
316 - 'wiki' => $row->gil_wiki,
317 - );
318 - }
319 - }
320 -
321 - /**
322 - * Returns the result set. The result is a 4 dimensional array
323 - * (file, wiki, page), whose items are arrays with keys:
324 - * - image or template: File name or template name
325 - * - id: Page id
326 - * - namespace: Page namespace text
327 - * - title: Unprefixed page title
328 - * - wiki: Wiki id
329 - *
330 - * @return array Result set
331 - */
332 - public function getResult() {
333 - return $this->result;
334 - }
335 - /**
336 - * Returns a 3 dimensional array with the result of the first file. Useful
337 - * if only one resource was queried.
338 - *
339 - * For further information see documentation of getResult()
340 - *
341 - * @return array Result set
342 - */
343 - public function getSingleResult() {
344 - if ( $this->result ) {
345 - return current( $this->result );
346 - } else {
347 - return array();
348 - }
349 - }
350 -
351 - /**
352 - * Returns whether there are more results
353 - *
354 - * @return bool
355 - */
356 - public function hasMore() {
357 - return $this->hasMore;
358 - }
359 -
360 - /**
361 - * Returns the result length
362 - *
363 - * @return int
364 - */
365 - public function count() {
366 - return count( $this->result );
367 - }
368 -}
Index: trunk/phase3/includes/AutoLoader.php
@@ -559,7 +559,6 @@
560560 'BmpHandler' => 'includes/media/BMP.php',
561561 'DjVuHandler' => 'includes/media/DjVu.php',
562562 'Exif' => 'includes/media/Exif.php',
563 - 'GlobalUsageQuery' => 'includes/GlobalUsageQuery.php',
564563 'FormatExif' => 'includes/media/FormatMetadata.php',
565564 'FormatMetadata' => 'includes/media/FormatMetadata.php',
566565 'GIFHandler' => 'includes/media/GIF.php',
@@ -773,8 +772,6 @@
774773 'SpecialEmailUser' => 'includes/specials/SpecialEmailuser.php',
775774 'SpecialExport' => 'includes/specials/SpecialExport.php',
776775 'SpecialFilepath' => 'includes/specials/SpecialFilepath.php',
777 - 'SpecialGlobalFileUsage' => 'includes/specials/SpecialGlobalFileUsage.php',
778 - 'SpecialGlobalTemplateUsage' => 'includes/specials/SpecialGlobalTemplateUsage.php',
779776 'SpecialImport' => 'includes/specials/SpecialImport.php',
780777 'SpecialListFiles' => 'includes/specials/SpecialListfiles.php',
781778 'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php',
Property changes on: trunk/phase3/includes/AutoLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
782779 Reverse-merged /branches/iwtransclusion/phase3v3/includes/AutoLoader.php:r92983-95395
783780 Reverse-merged /branches/iwtransclusion/phase3/includes/AutoLoader.php:r70966,71049
784781 Reverse-merged /branches/iwtransclusion/phase3v2/includes/AutoLoader.php:r87111-87112
Index: trunk/phase3/includes/Linker.php
@@ -1662,42 +1662,6 @@
16631663 }
16641664
16651665 /**
1666 - * Returns HTML for the "templates used on this page" list.
1667 - *
1668 - * @param $templates Array of templates from Article::getUsedTemplate
1669 - * or similar
1670 - * @param $preview Boolean: whether this is for a preview
1671 - * @param $section Boolean: whether this is for a section edit
1672 - * @return String: HTML output
1673 - */
1674 - public static function formatDistantTemplates( $templates, $preview = false, $section = false ) {
1675 - wfProfileIn( __METHOD__ );
1676 -
1677 - $outText = '';
1678 - if ( count( $templates ) > 0 ) {
1679 -
1680 - # Construct the HTML
1681 - $outText = '<div class="mw-templatesUsedExplanation">';
1682 - if ( $preview ) {
1683 - $outText .= wfMsgExt( 'distanttemplatesusedpreview', array( 'parse' ), count( $templates ) );
1684 - } elseif ( $section ) {
1685 - $outText .= wfMsgExt( 'distanttemplatesusedsection', array( 'parse' ), count( $templates ) );
1686 - } else {
1687 - $outText .= wfMsgExt( 'distanttemplatesused', array( 'parse' ), count( $templates ) );
1688 - }
1689 - $outText .= "</div><ul>\n";
1690 -
1691 - usort( $templates, array( 'Title', 'compare' ) );
1692 - foreach ( $templates as $titleObj ) {
1693 - $outText .= '<li>' . self::link( $titleObj ) . '</li>';
1694 - }
1695 - $outText .= '</ul>';
1696 - }
1697 - wfProfileOut( __METHOD__ );
1698 - return $outText;
1699 - }
1700 -
1701 - /**
17021666 * Returns HTML for the "hidden categories on this page" list.
17031667 *
17041668 * @param $hiddencats Array of hidden categories from Article::getHiddenCategories
Index: trunk/phase3/includes/db/Database.php
@@ -1817,39 +1817,6 @@
18181818 }
18191819
18201820 /**
1821 - * Build a partial where clause from a 3-d array
1822 - * The keys on each level may be either integers or strings.
1823 - *
1824 - * @param $data Array: organized as 3-d array(baseKeyVal => array(middleKeyVal => array(subKeyVal => <ignored>, ...), ...), ...)
1825 - * @param $baseKey String: field name to match the base-level keys to (eg 'gtl_to_prefix')
1826 - * @param $middleKey String: field name to match the middle-level keys to (eg 'gtl_to_namespace')
1827 - * @param $subKey String: field name to match the sub-level keys to (eg 'gtl_to_title')
1828 - * @return Mixed: string SQL fragment, or false if no items in array.
1829 - */
1830 - function makeWhereFrom3d( $data, $baseKey, $middleKey, $subKey ) {
1831 - $conds = array();
1832 - foreach ( $data as $base => $subdata ) {
1833 - foreach ( $subdata as $middle => $sub ) {
1834 - if ( count( $sub ) ) {
1835 - $conds[] = $this->makeList(
1836 - array( $baseKey => $base,
1837 - $middleKey => $middle,
1838 - $subKey => array_keys( $sub ) ),
1839 - LIST_AND
1840 - );
1841 - }
1842 - }
1843 - }
1844 -
1845 - if ( $conds ) {
1846 - return $this->makeList( $conds, LIST_OR );
1847 - } else {
1848 - // Nothing to search for...
1849 - return false;
1850 - }
1851 - }
1852 -
1853 - /**
18541821 * Bitwise operations
18551822 */
18561823
Property changes on: trunk/phase3/includes/db/Database.php
___________________________________________________________________
Modified: svn:mergeinfo
18571824 Reverse-merged /branches/iwtransclusion/phase3/includes/db/Database.php:r70576,70764
18581825 Reverse-merged /branches/iwtransclusion/phase3v2/includes/db/Database.php:r87108
18591826 Reverse-merged /branches/iwtransclusion/phase3v3/includes/db/Database.php:r92983-95395
Index: trunk/phase3/includes/DefaultSettings.php
@@ -2998,35 +2998,14 @@
29992999 $wgPreprocessorCacheThreshold = 1000;
30003000
30013001 /**
3002 - * Enable interwiki transcluding. Only when iw_trans=1 in the interwiki table.
3003 - * If the interwiki prefix is associated with a wiki ID in the interwiki table,
3004 - * then the distant templates will be retrieved in the distant DB. If there is
3005 - * no wiki ID but a API URL for that prefix, the distant templates will be
3006 - * retrieved using the API and cached in memcached.
 3002+ * Enable interwiki transcluding. Only when iw_trans=1.
30073003 */
3008 -$wgEnableInterwikiTranscluding = false;
 3004+$wgEnableScaryTranscluding = false;
30093005
30103006 /**
3011 - * If $wgEnableInterwikiTranscluding is set to true and if an interwiki prefix
3012 - * is associated with a wiki ID, then, this option should be set to true to
3013 - * enable the cache invalidation of the distant pages when the local templates
3014 - * are edited and also to display the list of the distant templates used by
3015 - * the local pages. Enabling this requires to set up a global shared database
3016 - * (see next option $wgGlobalDatabase).
 3007+ * (see next option $wgGlobalDatabase).
30173008 */
3018 -$wgEnableInterwikiTemplatesTracking = false;
3019 -
3020 -/**
3021 - * If $wgEnableInterwikiTemplatesTracking is set to true, this option should
3022 - * contain the wiki ID of the database that hosts the globaltemplatelinks table.
30233009 */
3024 -$wgGlobalDatabase = '';
3025 -
3026 -/**
3027 - * If $wgEnableInterwikiTranscluding is set to true and if an interwiki
3028 - * prefix is associated with an API URL and no wiki ID, this will be
3029 - * the expiry time for the transcluded templates cached in memcached.
3030 - */
30313010 $wgTranscludeCacheExpiry = 3600;
30323011
30333012 /** @} */ # end of parser settings }
@@ -5198,8 +5177,6 @@
51995178 'Export' => 'pagetools',
52005179 'Import' => 'pagetools',
52015180 'Whatlinkshere' => 'pagetools',
5202 - 'GlobalFileUsage' => 'pagetools',
5203 - 'GlobalTemplateUsage' => 'pagetools',
52045181
52055182 'Statistics' => 'wiki',
52065183 'Version' => 'wiki',
Index: trunk/phase3/includes/specials/SpecialGlobalTemplateUsage.php
@@ -1,196 +0,0 @@
2 -<?php
3 -/**
4 - * This file has been copied from Extension:GlobalUsage and adapted
5 - * to show the usage of a template instead of a file.
6 - * Special page to show global template usage. Also contains hook functions for
7 - * showing usage on an template page.
8 - *
9 - * @author Bryan Tong Minh <bryan.tongminh@gmail.com>
10 - * @author Peter Potrowl <peter017@gmail.com>
11 - */
12 -
13 -class SpecialGlobalTemplateUsage extends SpecialPage {
14 - public function __construct() {
15 - parent::__construct( 'GlobalTemplateUsage' );
16 - }
17 -
18 - /**
19 - * Entry point
20 - */
21 - public function execute( $par ) {
22 - $target = $par ? $par : $this->getRequest()->getVal( 'target' );
23 - $this->target = Title::newFromText( $target );
24 -
25 - $this->setHeaders();
26 -
27 - $this->showForm();
28 -
29 - if ( $this->target !== null ) {
30 - $this->getOutput()->setPageTitle( wfMsg( 'globaltemplateusage-for', $this->target->getPrefixedText() ) );
31 -
32 - $this->showResult();
33 - }
34 - }
35 -
36 - /**
37 - * Shows the search form
38 - */
39 - private function showForm() {
40 - global $wgScript;
41 -
42 - /* Build form */
43 - $html = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . "\n";
44 - // Name of SpecialPage
45 - $html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
46 - // Limit
47 - $html .= Html::hidden( 'limit', $this->getRequest()->getInt( 'limit', 50 ) );
48 - // Input box with target prefilled if available
49 - $formContent = "\t" . Xml::input( 'target', 40, is_null( $this->target ) ? ''
50 - : $this->target->getPrefixedText( ) )
51 - // Submit button
52 - . "\n\t" . Xml::element( 'input', array(
53 - 'type' => 'submit',
54 - 'value' => wfMsg( 'globaltemplateusage-ok' )
55 - ) );
56 -
57 - // Wrap the entire form in a nice fieldset
58 - $html .= Xml::fieldSet( wfMsg( 'globaltemplateusage-text' ), $formContent ) . "\n</form>";
59 -
60 - $this->getOutput()->addHtml( $html );
61 - }
62 -
63 - /**
64 - * Creates as queryer and executes it based on the WebRequest object
65 - */
66 - private function showResult() {
67 - $request = $this->getRequest();
68 - $query = new GlobalUsageQuery( $this->target );
69 -
70 - // Extract params from the WebRequest object
71 - if ( $request->getText( 'from' ) ) {
72 - $query->setOffset( $request->getText( 'from' ) );
73 - } elseif ( $request->getText( 'to' ) ) {
74 - $query->setOffset( $request->getText( 'to' ), true );
75 - }
76 - $query->setLimit( $request->getInt( 'limit', 50 ) );
77 -
78 - // Perform query
79 - $query->searchTemplate();
80 -
81 - $out = $this->getOutput();
82 -
83 - // Don't show form element if there is no data
84 - if ( $query->count() == 0 ) {
85 - $out->addWikiMsg( 'globaltemplateusage-no-results', $this->target->getPrefixedText( ) );
86 - return;
87 - }
88 -
89 - $navbar = $this->getNavBar( $query );
90 - $targetName = $this->target->getPrefixedText( );
91 -
92 - // Top navbar
93 - $out->addHtml( $navbar );
94 -
95 - $out->addHtml( '<div id="mw-globaltemplateusage-result">' );
96 - foreach ( $query->getSingleResult() as $wiki => $result ) {
97 - $out->addHtml(
98 - '<h2>' . wfMsgExt(
99 - 'globaltemplateusage-on-wiki', 'parseinline',
100 - $targetName, WikiMap::getWikiName( $wiki ) )
101 - . "</h2><ul>\n" );
102 - foreach ( $result as $item ) {
103 - $out->addHtml( "\t<li>" . self::formatItem( $item ) . "</li>\n" );
104 - }
105 - $out->addHtml( "</ul>\n" );
106 - }
107 - $out->addHtml( '</div>' );
108 -
109 - // Bottom navbar
110 - $out->addHtml( $navbar );
111 - }
112 -
113 - /**
114 - * Helper to format a specific item
115 - */
116 - public static function formatItem( $item ) {
117 - if ( !$item['namespace'] ) {
118 - $page = $item['title'];
119 - } else {
120 - $page = "{$item['namespace']}:{$item['title']}";
121 - }
122 -
123 - $link = WikiMap::makeForeignLink( $item['wiki'], $page,
124 - str_replace( '_', ' ', $page ) );
125 - // Return only the title if no link can be constructed
126 - return $link === false ? $page : $link;
127 - }
128 -
129 - /**
130 - * Helper function to create the navbar, stolen from wfViewPrevNext
131 - *
132 - * @param $query GlobalTemplateUsageQuery An executed GlobalTemplateUsageQuery object
133 - * @return string Navbar HTML
134 - */
135 - protected function getNavBar( $query ) {
136 - $lang = $this->getLang();
137 - $target = $this->target->getPrefixedText();
138 - $limit = $query->getLimit();
139 - $fmtLimit = $lang->formatNum( $limit );
140 -
141 - # Find out which strings are for the prev and which for the next links
142 - $offset = $query->getOffsetString();
143 - $continue = $query->getContinueTemplateString();
144 - if ( $query->isReversed() ) {
145 - $from = $offset;
146 - $to = $continue;
147 - } else {
148 - $from = $continue;
149 - $to = $offset;
150 - }
151 -
152 - # Get prev/next link display text
153 - $prev = wfMsgExt( 'prevn', array( 'parsemag', 'escape' ), $fmtLimit );
154 - $next = wfMsgExt( 'nextn', array( 'parsemag', 'escape' ), $fmtLimit );
155 - # Get prev/next link title text
156 - $pTitle = wfMsgExt( 'prevn-title', array( 'parsemag', 'escape' ), $fmtLimit );
157 - $nTitle = wfMsgExt( 'nextn-title', array( 'parsemag', 'escape' ), $fmtLimit );
158 -
159 - # Fetch the title object
160 - $title = $this->getTitle();
161 -
162 - # Make 'previous' link
163 - if ( $to ) {
164 - $attr = array( 'title' => $pTitle, 'class' => 'mw-prevlink' );
165 - $q = array( 'limit' => $limit, 'to' => $to, 'target' => $target );
166 - $plink = Linker::link( $title, $prev, $attr, $q );
167 - } else {
168 - $plink = $prev;
169 - }
170 -
171 - # Make 'next' link
172 - if ( $from ) {
173 - $attr = array( 'title' => $nTitle, 'class' => 'mw-nextlink' );
174 - $q = array( 'limit' => $limit, 'from' => $from, 'target' => $target );
175 - $nlink = Linker::link( $title, $next, $attr, $q );
176 - } else {
177 - $nlink = $next;
178 - }
179 -
180 - # Make links to set number of items per page
181 - $numLinks = array();
182 - foreach ( array( 20, 50, 100, 250, 500 ) as $num ) {
183 - $fmtLimit = $lang->formatNum( $num );
184 -
185 - $q = array( 'offset' => $offset, 'limit' => $num, 'target' => $target );
186 - $lTitle = wfMsgExt( 'shown-title', array( 'parsemag', 'escape' ), $num );
187 - $attr = array( 'title' => $lTitle, 'class' => 'mw-numlink' );
188 -
189 - $numLinks[] = Linker::link( $title, $fmtLimit, $attr, $q );
190 - }
191 - $nums = $lang->pipeList( $numLinks );
192 -
193 - return wfMsgHtml( 'viewprevnext', $plink, $nlink, $nums );
194 - }
195 -}
196 -
197 -
Index: trunk/phase3/includes/specials/SpecialGlobalFileUsage.php
@@ -1,213 +0,0 @@
2 -<?php
3 -/**
4 - * Special page to show global file usage. Also contains hook functions for
5 - * showing usage on an image page.
6 - */
7 -
8 -class SpecialGlobalFileUsage extends SpecialPage {
9 - public function __construct() {
10 - parent::__construct( 'GlobalFileUsage' );
11 - }
12 -
13 - /**
14 - * Entry point
15 - */
16 - public function execute( $par ) {
17 - $request = $this->getRequest();
18 - $target = $par ? $par : $request->getVal( 'target' );
19 - $this->target = Title::makeTitleSafe( NS_FILE, $target );
20 -
21 - $this->filterLocal = $request->getCheck( 'filterlocal' );
22 -
23 - $this->setHeaders();
24 -
25 - $this->showForm();
26 -
27 - if ( !is_null( $this->target ) ) {
28 - $this->getOutput()->setPageTitle( wfMsg( 'globalfileusage-for', $this->target->getPrefixedText() ) );
29 - $this->showResult();
30 - }
31 - }
32 -
33 - /**
34 - * Shows the search form
35 - */
36 - private function showForm() {
37 - global $wgScript, $wgContLang;
38 -
39 - /* Build form */
40 - $html = Xml::openElement( 'form', array( 'action' => $wgScript ) ) . "\n";
41 - // Name of SpecialPage
42 - $html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
43 - // Limit
44 - $html .= Html::hidden( 'limit', $this->getRequest()->getInt( 'limit', 50 ) );
45 - // Input box with target prefilled if available
46 - $formContent = "\t" . Xml::input( 'target', 40, is_null( $this->target ) ? ''
47 - : $this->target->getText() )
48 - // Submit button
49 - . "\n\t" . Xml::element( 'input', array(
50 - 'type' => 'submit',
51 - 'value' => wfMsg( 'globalfileusage-ok' )
52 - ) )
53 - // Filter local checkbox
54 - . "\n\t<p>" . Xml::checkLabel( wfMsg( 'globalfileusage-filterlocal' ),
55 - 'filterlocal', 'mw-filterlocal', $this->filterLocal ) . '</p>';
56 -
57 - if ( !is_null( $this->target ) ) {
58 - $file = wfFindFile( $this->target );
59 - if ( $file !== null ) {
60 - // Show the image if it exists
61 - $html .= Linker::makeImageLink2( $this->target, $file,
62 - array( 'align' => $this->getLang()->alignEnd(), 'thumbnail' => true ) );
63 - }
64 - }
65 -
66 - // Wrap the entire form in a nice fieldset
67 - $html .= Xml::fieldSet( wfMsg( 'globalfileusage-text' ), $formContent ) . "\n</form>";
68 -
69 - $this->getOutput()->addHtml( $html );
70 - }
71 -
72 - /**
73 - * Creates as queryer and executes it based on the WebRequest object
74 - */
75 - private function showResult() {
76 - $request = $this->getRequest();
77 - $query = new GlobalUsageQuery( $this->target );
78 -
79 - // Extract params from the WebRequest object
80 - if ( $request->getText( 'from' ) ) {
81 - $query->setOffset( $request->getText( 'from' ) );
82 - } elseif ( $request->getText( 'to' ) ) {
83 - $query->setOffset( $request->getText( 'to' ), true );
84 - }
85 - $query->setLimit( $request->getInt( 'limit', 50 ) );
86 - $query->filterLocal( $this->filterLocal );
87 -
88 - // Perform query
89 - $query->searchFile();
90 -
91 - // Show result
92 - $out = $this->getOutput();
93 -
94 - // Don't show form element if there is no data
95 - if ( $query->count() == 0 ) {
96 - $out->addWikiMsg( 'globalfileusage-no-results', $this->target->getPrefixedText() );
97 - return;
98 - }
99 -
100 - $offset = $query->getOffsetString();
101 - $navbar = $this->getNavBar( $query );
102 - $targetName = $this->target->getText();
103 -
104 - // Top navbar
105 - $out->addHtml( $navbar );
106 -
107 - $out->addHtml( '<div id="mw-globalfileusage-result">' );
108 - foreach ( $query->getSingleResult() as $wiki => $result ) {
109 - $out->addHtml(
110 - '<h2>' . wfMsgExt(
111 - 'globalfileusage-on-wiki', 'parseinline',
112 - $targetName, WikiMap::getWikiName( $wiki ) )
113 - . "</h2><ul>\n" );
114 - foreach ( $result as $item ) {
115 - $out->addHtml( "\t<li>" . self::formatItem( $item ) . "</li>\n" );
116 - }
117 - $out->addHtml( "</ul>\n" );
118 - }
119 - $out->addHtml( '</div>' );
120 -
121 - // Bottom navbar
122 - $out->addHtml( $navbar );
123 - }
124 -
125 - /**
126 - * Helper to format a specific item
127 - */
128 - public static function formatItem( $item ) {
129 - if ( !$item['namespace'] ) {
130 - $page = $item['title'];
131 - } else {
132 - $page = "{$item['namespace']}:{$item['title']}";
133 - }
134 -
135 - $link = WikiMap::makeForeignLink( $item['wiki'], $page,
136 - str_replace( '_', ' ', $page ) );
137 - // Return only the title if no link can be constructed
138 - return $link === false ? $page : $link;
139 - }
140 -
141 - /**
142 - * Helper function to create the navbar, stolen from wfViewPrevNext
143 - *
144 - * @param $query GlobalUsageQuery An executed GlobalUsageQuery object
145 - * @return string Navbar HTML
146 - */
147 - protected function getNavBar( $query ) {
148 - $lang = $this->getLang();
149 - $target = $this->target->getText();
150 - $limit = $query->getLimit();
151 - $fmtLimit = $lang->formatNum( $limit );
152 -
153 - # Find out which strings are for the prev and which for the next links
154 - $offset = $query->getOffsetString();
155 - $continue = $query->getContinueFileString();
156 - if ( $query->isReversed() ) {
157 - $from = $offset;
158 - $to = $continue;
159 - } else {
160 - $from = $continue;
161 - $to = $offset;
162 - }
163 -
164 - # Get prev/next link display text
165 - $prev = wfMsgExt( 'prevn', array( 'parsemag', 'escape' ), $fmtLimit );
166 - $next = wfMsgExt( 'nextn', array( 'parsemag', 'escape' ), $fmtLimit );
167 - # Get prev/next link title text
168 - $pTitle = wfMsgExt( 'prevn-title', array( 'parsemag', 'escape' ), $fmtLimit );
169 - $nTitle = wfMsgExt( 'nextn-title', array( 'parsemag', 'escape' ), $fmtLimit );
170 -
171 - # Fetch the title object
172 - $title = $this->getTitle();
173 -
174 - # Make 'previous' link
175 - if ( $to ) {
176 - $attr = array( 'title' => $pTitle, 'class' => 'mw-prevlink' );
177 - $q = array( 'limit' => $limit, 'to' => $to, 'target' => $target );
178 - if ( $this->filterLocal )
179 - $q['filterlocal'] = '1';
180 - $plink = Linker::link( $title, $prev, $attr, $q );
181 - } else {
182 - $plink = $prev;
183 - }
184 -
185 - # Make 'next' link
186 - if ( $from ) {
187 - $attr = array( 'title' => $nTitle, 'class' => 'mw-nextlink' );
188 - $q = array( 'limit' => $limit, 'from' => $from, 'target' => $target );
189 - if ( $this->filterLocal )
190 - $q['filterlocal'] = '1';
191 - $nlink = Linker::link( $title, $next, $attr, $q );
192 - } else {
193 - $nlink = $next;
194 - }
195 -
196 - # Make links to set number of items per page
197 - $numLinks = array();
198 - foreach ( array( 20, 50, 100, 250, 500 ) as $num ) {
199 - $fmtLimit = $lang->formatNum( $num );
200 -
201 - $q = array( 'offset' => $offset, 'limit' => $num, 'target' => $target );
202 - if ( $this->filterLocal )
203 - $q['filterlocal'] = '1';
204 - $lTitle = wfMsgExt( 'shown-title', array( 'parsemag', 'escape' ), $num );
205 - $attr = array( 'title' => $lTitle, 'class' => 'mw-numlink' );
206 -
207 - $numLinks[] = Linker::link( $title, $fmtLimit, $attr, $q );
208 - }
209 - $nums = $lang->pipeList( $numLinks );
210 -
211 - return wfMsgHtml( 'viewprevnext', $plink, $nlink, $nums );
212 - }
213 -}
214 -
Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -34,8 +34,8 @@
3535 * For users tt replaces the set of enabled namespaces from the query
3636 * string when applicable. Extensions can add new profiles with hooks
3737 * with custom search options just for that profile.
38 - * @var null|string
39 - */
 38+ * null|string
 39+ */
4040 protected $profile;
4141
4242 /// Search engine
Index: trunk/phase3/includes/cache/HTMLCacheUpdate.php
@@ -50,16 +50,7 @@
5151 return;
5252 }
5353
54 - if ( $this->mTable === 'globaltemplatelinks' ) {
55 - global $wgEnableInterwikiTemplatesTracking;
5654
57 - if ( $wgEnableInterwikiTemplatesTracking ) {
58 - $distantPageArray = $this->mCache->getDistantTemplateLinks( 'globaltemplatelinks' );
59 - $this->invalidateDistantTitles( $distantPageArray );
60 - }
61 - return;
62 - }
63 -
6455 # Get an estimate of the number of rows from the BacklinkCache
6556 $numRows = $this->mCache->getNumLinks( $this->mTable );
6657 if ( $numRows > $this->mRowsPerJob * 2 ) {
@@ -77,7 +68,6 @@
7869 $this->invalidateTitles( $titleArray );
7970 }
8071 }
81 - wfRunHooks( 'HTMLCacheUpdate::doUpdate', array($this->mTitle) );
8272 }
8373
8474 /**
@@ -208,46 +198,10 @@
209199 }
210200 }
211201
212 - /**
213 - * Invalidate an array of distant pages, given the wiki ID and page ID of those pages
214 - */
215 - protected function invalidateDistantTitles( $distantPageArray ) {
216 - global $wgUseSquid;
217 -
218 - $pagesByWiki = array();
219 - $titleArray = array();
220 - # Sort by WikiID in $pagesByWiki
221 - # Create the distant titles for Squid in $titleArray
222 - foreach ( $distantPageArray as $row ) {
223 - $wikiid = $row->gtl_from_wiki;
224 - if( !isset( $pagesByWiki[$wikiid] ) ) {
225202 $pagesByWiki[$wikiid] = array();
226203 }
227 - $pagesByWiki[$wikiid][] = $row->gtl_from_page;
228 - $titleArray[] = Title::makeTitle( $row->gtl_from_namespace, $row->gtl_from_title, '', $row->gil_interwiki );
229 - }
230204
231 - foreach ( $pagesByWiki as $wikiid => $pages ) {
232 - $dbw = wfGetDB( DB_MASTER, array( ), $wikiid );
233 - $timestamp = $dbw->timestamp();
234 - $batches = array_chunk( $pages, $this->mRowsPerQuery );
235 - foreach ( $batches as $batch ) {
236 - $dbw->update( 'page',
237 - array( 'page_touched' => $timestamp ),
238 - array( 'page_id IN (' . $dbw->makeList( $batch ) . ')' ),
239 - __METHOD__
240 - );
241 - }
242 - }
243205
244 - # Update squid
245 - if ( $wgUseSquid ) {
246 - $u = SquidUpdate::newFromTitles( $titleArray );
247 - $u->doUpdate();
248 - }
249 - }
250 -}
251 -
252206 /**
253207 * Job wrapper for HTMLCacheUpdate. Gets run whenever a related
254208 * job gets called from the queue.
Index: trunk/phase3/includes/SpecialPageFactory.php
@@ -126,8 +126,6 @@
127127 // Page tools
128128 'ComparePages' => 'SpecialComparePages',
129129 'Export' => 'SpecialExport',
130 - 'GlobalFileUsage' => 'SpecialGlobalFileUsage',
131 - 'GlobalTemplateUsage' => 'SpecialGlobalTemplateUsage',
132130 'Import' => 'SpecialImport',
133131 'Undelete' => 'SpecialUndelete',
134132 'Whatlinkshere' => 'SpecialWhatlinkshere',
@@ -264,7 +262,7 @@
265263 /**
266264 * Add a page to a certain display group for Special:SpecialPages
267265 *
268 - * @param $page SpecialPage|string
 266+ * @param $page Mixed: SpecialPage or string
269267 * @param $group String
270268 */
271269 public static function setGroup( $page, $group ) {
@@ -277,8 +275,6 @@
278276 * Get the group that the special page belongs in on Special:SpecialPage
279277 *
280278 * @param $page SpecialPage
281 - *
282 - * @return string
283279 */
284280 public static function getGroup( &$page ) {
285281 $name = $page->getName();
Property changes on: trunk/phase3/includes/SpecialPageFactory.php
___________________________________________________________________
Modified: svn:mergeinfo
286282 Reverse-merged /branches/iwtransclusion/phase3v2/includes/SpecialPageFactory.php:r87111-87112
287283 Reverse-merged /branches/iwtransclusion/phase3v3/includes/SpecialPageFactory.php:r92983-95395
288284 Reverse-merged /branches/iwtransclusion/phase3/includes/SpecialPageFactory.php:r70966,71049,74205
Index: trunk/phase3/includes/EditPage.php
@@ -1376,7 +1376,7 @@
13771377 * during form output near the top, for captchas and the like.
13781378 */
13791379 function showEditForm( $formCallback = null ) {
1380 - global $wgOut, $wgUser, $wgEnableInterwikiTranscluding, $wgEnableInterwikiTemplatesTracking;
 1380+ global $wgOut, $wgUser;
13811381
13821382 wfProfileIn( __METHOD__ );
13831383
@@ -1410,6 +1410,7 @@
14111411 $toolbar = '';
14121412 }
14131413
 1414+
14141415 $wgOut->addHTML( $this->editFormPageTop );
14151416
14161417 if ( $wgUser->getOption( 'previewontop' ) ) {
@@ -1421,9 +1422,6 @@
14221423 $templates = $this->getTemplates();
14231424 $formattedtemplates = Linker::formatTemplates( $templates, $this->preview, $this->section != '');
14241425
1425 - $distantTemplates = $this->getDistantTemplates();
1426 - $formattedDistantTemplates = Linker::formatDistantTemplates( $distantTemplates, $this->preview, $this->section != '' );
1427 -
14281426 $hiddencats = $this->mArticle->getHiddenCategories();
14291427 $formattedhiddencats = Linker::formatHiddenCategories( $hiddencats );
14301428
@@ -1522,21 +1520,6 @@
15231521 <div class='templatesUsed'>
15241522 {$formattedtemplates}
15251523 </div>
1526 -HTML
1527 -);
1528 -
1529 - if ( $wgEnableInterwikiTranscluding && $wgEnableInterwikiTemplatesTracking ) {
1530 - $wgOut->addHTML( <<<HTML
1531 -{$this->editFormTextAfterTools}
1532 -<div class='distantTemplatesUsed'>
1533 -{$formattedDistantTemplates}
1534 -</div>
1535 -HTML
1536 -);
1537 - }
1538 -
1539 - $wgOut->addHTML( <<<HTML
1540 -{$this->editFormTextAfterTools}
15411524 <div class='hiddencats'>
15421525 {$formattedhiddencats}
15431526 </div>
@@ -2198,28 +2181,6 @@
21992182 }
22002183 }
22012184
2202 - function getDistantTemplates() {
2203 - global $wgEnableInterwikiTemplatesTracking;
2204 - if ( !$wgEnableInterwikiTemplatesTracking ) {
2205 - return array( );
2206 - }
2207 - if ( $this->preview || $this->section != '' ) {
2208 - $templates = array();
2209 - if ( !isset( $this->mParserOutput ) ) return $templates;
2210 - $templatesList = $this->mParserOutput->getDistantTemplates();
2211 - foreach( $templatesList as $prefix => $templatesbyns ) {
2212 - foreach( $templatesbyns as $ns => $template ) {
2213 - foreach( array_keys( $template ) as $dbk ) {
2214 - $templates[] = Title::makeTitle( $ns, $dbk, null, $prefix );
2215 - }
2216 - }
2217 - }
2218 - return $templates;
2219 - } else {
2220 - return $this->mArticle->getUsedDistantTemplates();
2221 - }
2222 - }
2223 -
22242185 /**
22252186 * Call the stock "user is blocked" page
22262187 */
Index: trunk/phase3/includes/LinksUpdate.php
@@ -29,7 +29,6 @@
3030 $mLinks, //!< Map of title strings to IDs for the links in the document
3131 $mImages, //!< DB keys of the images used, in the array key only
3232 $mTemplates, //!< Map of title strings to IDs for the template references, including broken ones
33 - $mDistantTemplates,//!< Map of title strings to IDs for the distant template references, including broken ones
3433 $mExternals, //!< URLs of external links, array key only
3534 $mCategories, //!< Map of category names to sort keys
3635 $mInterlangs, //!< Map of language codes to titles
@@ -67,7 +66,6 @@
6867 $this->mLinks = $parserOutput->getLinks();
6968 $this->mImages = $parserOutput->getImages();
7069 $this->mTemplates = $parserOutput->getTemplates();
71 - $this->mDistantTemplates = $parserOutput->getDistantTemplates();
7270 $this->mExternals = $parserOutput->getExternalLinks();
7371 $this->mCategories = $parserOutput->getCategories();
7472 $this->mProperties = $parserOutput->getProperties();
@@ -154,15 +152,6 @@
155153 $this->incrTableUpdate( 'templatelinks', 'tl', $this->getTemplateDeletions( $existing ),
156154 $this->getTemplateInsertions( $existing ) );
157155
158 - # Distant template links
159 - global $wgGlobalDatabase;
160 - if ( $wgGlobalDatabase ) {
161 - $existing = $this->getDistantExistingTemplates();
162 - $this->incrSharedTableUpdate( 'globaltemplatelinks', 'gtl',
163 - $this->getDistantTemplateDeletions( $existing ),
164 - $this->getDistantTemplateInsertions( $existing ) );
165 - }
166 -
167156 # Category links
168157 $existing = $this->getExistingCategories();
169158
@@ -378,54 +367,12 @@
379368 if ( $where ) {
380369 $this->mDb->delete( $table, $where, __METHOD__ );
381370 }
382 - if ( isset( $insertions['globaltemplatelinks'] ) ) {
383 - $this->mDb->insert( 'globaltemplatelinks', $insertions['globaltemplatelinks'], __METHOD__, 'IGNORE' );
384 - unset( $insertions['globaltemplatelinks'] );
385 - }
386 - if ( isset( $insertions['globalnamespaces'] ) ) {
387 - $this->mDb->insert( 'globalnamespaces', $insertions['globalnamespaces'], __METHOD__, 'IGNORE' );
388 - unset( $insertions['globalnamespaces'] );
389 - }
390 - if ( isset( $insertions['globalinterwiki'] ) ) {
391 - $this->mDb->insert( 'globalinterwiki', $insertions['globalinterwiki'], __METHOD__, 'IGNORE' );
392 - unset( $insertions['globalinterwiki'] );
393 - }
394371 if ( count( $insertions ) ) {
395372 $this->mDb->insert( $table, $insertions, __METHOD__, 'IGNORE' );
396373 }
397374 }
398375
399 - /**
400 - * Update a shared table by doing a delete query then an insert query
401 - * @private
402 - */
403 - function incrSharedTableUpdate( $table, $prefix, $deletions, $insertions ) {
404 - global $wgGlobalDatabase;
405376
406 - if ( $wgGlobalDatabase ) {
407 - $dbw = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
408 - $where = array( "{$prefix}_from_wiki" => wfWikiID(),
409 - "{$prefix}_from_page" => $this->mId
410 - );
411 - $baseKey = "{$prefix}_to_wiki";
412 - $middleKey = "{$prefix}_to_namespace";
413 -
414 - $clause = $dbw->makeWhereFrom3d( $deletions, $baseKey, $middleKey, "{$prefix}_to_title" );
415 - if ( $clause ) {
416 - $where[] = $clause;
417 - } else {
418 - $where = false;
419 - }
420 -
421 - if ( $where ) {
422 - $dbw->delete( $table, $where, __METHOD__ );
423 - }
424 - if ( count( $insertions ) ) {
425 - $dbw->insert( $table, $insertions, __METHOD__, 'IGNORE' );
426 - }
427 - }
428 - }
429 -
430377 /**
431378 * Get an array of pagelinks insertions for passing to the DB
432379 * Skips the titles specified by the 2-D array $existing
@@ -468,44 +415,6 @@
469416 }
470417
471418 /**
472 - * Get an array of distant template insertions. Like getLinkInsertions()
473 - * @private
474 - */
475 - function getDistantTemplateInsertions( $existing = array() ) {
476 - $arr = array();
477 - foreach( $this->mDistantTemplates as $prefix => $templatesToNS ) {
478 - foreach( $templatesToNS as $ns => $dbkeys ) {
479 - $diffs = isset( $existing[$prefix] ) && isset( $existing[$prefix][$ns] )
480 - ? array_diff_key( $dbkeys, $existing[$prefix][$ns] )
481 - : $dbkeys;
482 - $interwiki = Interwiki::fetch( $prefix );
483 - $wikiid = $interwiki->getWikiID();
484 - foreach ( $diffs as $dbk => $id ) {
485 - $arr['globaltemplatelinks'][] = array(
486 - 'gtl_from_wiki' => wfWikiID(),
487 - 'gtl_from_page' => $this->mId,
488 - 'gtl_from_namespace' => $this->mTitle->getNamespace(),
489 - 'gtl_from_title' => $this->mTitle->getText(),
490 - 'gtl_to_wiki' => $wikiid,
491 - 'gtl_to_namespace' => $ns,
492 - 'gtl_to_title' => $dbk
493 - );
494 - $arr['globalinterwiki'][] = array(
495 - 'giw_wikiid' => $wikiid,
496 - 'giw_prefix' => $prefix,
497 - );
498 - $arr['globalnamespaces'][] = array(
499 - 'gn_wiki' => wfWikiID( ),
500 - 'gn_namespace' => $this->mTitle->getNamespace(),
501 - 'gn_namespacetext' => $this->mTitle->getNsText(),
502 - );
503 - }
504 - }
505 - }
506 - return $arr;
507 - }
508 -
509 - /**
510419 * Get an array of image insertions
511420 * Skips the names specified in $existing
512421 * @private
@@ -672,30 +581,6 @@
673582 }
674583
675584 /**
676 - * Given an array of existing templates, returns those templates which are not in $this
677 - * and thus should be deleted.
678 - * @private
679 - */
680 - function getDistantTemplateDeletions( $existing ) {
681 - $del = array();
682 - foreach ( $existing as $wikiid => $templatesForNS ) {
683 - if ( isset( $this->mDistantTemplates[$wikiid] ) ) {
684 - $del[$wikiid] = array_diff_key( $existing[$wikiid], $this->mDistantTemplates[$wikiid] );
685 - } else {
686 - $del[$wikiid] = $existing[$wikiid];
687 - }
688 - foreach ( $templatesForNS as $ns => $dbkeys ) {
689 - if ( isset( $this->mDistantTemplates[$wikiid][$ns] ) ) {
690 - $del[$wikiid][$ns] = array_diff_key( $existing[$wikiid][$ns], $this->mDistantTemplates[$wikiid][$ns] );
691 - } else {
692 - $del[$wikiid][$ns] = $existing[$wikiid][$ns];
693 - }
694 - }
695 - }
696 - return $del;
697 - }
698 -
699 - /**
700585 * Given an array of existing images, returns those images which are not in $this
701586 * and thus should be deleted.
702587 * @private
@@ -791,36 +676,6 @@
792677 }
793678
794679 /**
795 - * Get an array of existing distant templates, as a 3-D array
796 - * @private
797 - */
798 - function getDistantExistingTemplates() {
799 - global $wgGlobalDatabase;
800 -
801 - $arr = array();
802 - if ( $wgGlobalDatabase ) {
803 - $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
804 - $res = $dbr->select(
805 - 'globaltemplatelinks',
806 - array( 'gtl_to_wiki', 'gtl_to_namespace', 'gtl_to_title' ),
807 - array( 'gtl_from_wiki' => wfWikiID(), 'gtl_from_page' => $this->mId ),
808 - __METHOD__,
809 - $this->mOptions
810 - );
811 - foreach ( $res as $row ) {
812 - if ( !isset( $arr[$row->gtl_to_wiki] ) ) {
813 - $arr[$row->gtl_to_wiki] = array();
814 - }
815 - if ( !isset( $arr[$row->gtl_to_wiki][$row->gtl_to_namespace] ) ) {
816 - $arr[$row->gtl_to_wiki][$row->gtl_to_namespace] = array();
817 - }
818 - $arr[$row->gtl_to_wiki][$row->gtl_to_namespace][$row->gtl_to_title] = 1;
819 - }
820 - }
821 - return $arr;
822 - }
823 -
824 - /**
825680 * Get an array of existing images, image names in the keys
826681 * @private
827682 */
Index: trunk/phase3/includes/parser/Preprocessor_Hash.php
@@ -976,7 +976,6 @@
977977 if ( $flags & PPFrame::NO_TEMPLATES ) {
978978 $newIterator = $this->virtualBracketedImplode( '{{', '|', '}}', $bits['title'], $bits['parts'] );
979979 } else {
980 - $bits['interwiki'] = $this->title->getInterwiki( );
981980 $ret = $this->parser->braceSubstitution( $bits, $this );
982981 if ( isset( $ret['object'] ) ) {
983982 $newIterator = $ret['object'];
Index: trunk/phase3/includes/parser/Parser.php
@@ -3022,7 +3022,7 @@
30233023 * @private
30243024 */
30253025 function braceSubstitution( $piece, $frame ) {
3026 - global $wgNonincludableNamespaces, $wgEnableInterwikiTranscluding, $wgEnableInterwikiTemplatesTracking;
 3026+ global $wgContLang, $wgNonincludableNamespaces;
30273027 wfProfileIn( __METHOD__ );
30283028 wfProfileIn( __METHOD__.'-setup' );
30293029
@@ -3030,6 +3030,7 @@
30313031 $found = false; # $text has been filled
30323032 $nowiki = false; # wiki markup in $text should be escaped
30333033 $isHTML = false; # $text is HTML, armour it against wikitext transformation
 3034+ $forceRawInterwiki = false; # Force interwiki transclusion to be done in raw mode not rendered
30343035 $isChildObj = false; # $text is a DOM node needing expansion in a child frame
30353036 $isLocalObj = false; # $text is a DOM node needing expansion in the current frame
30363037
@@ -3194,9 +3195,6 @@
31953196 }
31963197 $title = Title::newFromText( $part1, $ns );
31973198 if ( $title ) {
3198 - if ( !$title->isExternal() && $piece['interwiki'] !== '' ) {
3199 - $title->setInterwiki( $piece['interwiki'] );
3200 - }
32013199 $titleText = $title->getPrefixedText();
32023200 # Check for language variants if the template is not found
32033201 if ( $this->getFunctionLang()->hasVariants() && $title->getArticleID() == 0 ) {
@@ -3264,22 +3262,18 @@
32653263 $text = "[[:$titleText]]";
32663264 $found = true;
32673265 }
3268 - } elseif ( $wgEnableInterwikiTranscluding && $title->isTrans() ) {
3269 -
3270 - $text = Interwiki::interwikiTransclude( $title );
3271 - $this->registerDistantTemplate( $title );
3272 -
3273 - if ( $wgEnableInterwikiTemplatesTracking ) {
3274 - $this->registerDistantTemplate( $title );
3275 - }
3276 -
3277 - if ( $text !== false ) {
 3266+ } elseif ( $title->isTrans() ) {
 3267+ # Interwiki transclusion
 3268+ if ( $this->ot['html'] && !$forceRawInterwiki ) {
 3269+ $text = $this->interwikiTransclude( $title, 'render' );
 3270+ $isHTML = true;
 3271+ } else {
 3272+ $text = $this->interwikiTransclude( $title, 'raw' );
32783273 # Preprocess it like a template
32793274 $text = $this->preprocessToDom( $text, self::PTD_FOR_INCLUSION );
3280 - $found = true;
32813275 $isChildObj = true;
32823276 }
3283 -
 3277+ $found = true;
32843278 }
32853279
32863280 # Do infinite loop check
@@ -3429,19 +3423,10 @@
34303424 }
34313425
34323426 /**
3433 - * Register a distant template as used
 3427+ * Fetch the unparsed text of a template and register a reference to it.
 3428+ * @param Title $title
 3429+ * @return mixed string or false
34343430 */
3435 - function registerDistantTemplate( $title ) {
3436 - $stuff = Parser::distantTemplateCallback( $title, $this );
3437 - $text = $stuff['text'];
3438 - $finalTitle = isset( $stuff['finalTitle'] ) ? $stuff['finalTitle'] : $title;
3439 - if ( isset( $stuff['deps'] ) ) {
3440 - foreach ( $stuff['deps'] as $dep ) {
3441 - $this->mOutput->addDistantTemplate( $dep['title'], $dep['page_id'], $dep['rev_id'] );
3442 - }
3443 - }
3444 - }
3445 -
34463431 function fetchTemplate( $title ) {
34473432 $rv = $this->fetchTemplateAndTitle( $title );
34483433 return $rv[0];
@@ -3570,23 +3555,58 @@
35713556 return array( $file, $title );
35723557 }
35733558
3574 - static function distantTemplateCallback( $title, $parser=false ) {
3575 - $text = '';
3576 - $rev_id = null;
3577 - $deps[] = array(
3578 - 'title' => $title,
3579 - 'page_id' => $title->getArticleID(),
3580 - 'rev_id' => $rev_id );
 3559+ /**
 3560+ * Transclude an interwiki link.
 3561+ *
 3562+ * @param $title Title
 3563+ * @param $action
 3564+ *
 3565+ * @return string
 3566+ */
 3567+ function interwikiTransclude( $title, $action ) {
 3568+ global $wgEnableScaryTranscluding;
35813569
3582 - $finalTitle = $title;
 3570+ if ( !$wgEnableScaryTranscluding ) {
 3571+ return wfMsgForContent('scarytranscludedisabled');
 3572+ }
35833573
3584 - return array(
3585 - 'text' => $text,
3586 - 'finalTitle' => $finalTitle,
3587 - 'deps' => $deps );
 3574+ $url = $title->getFullUrl( "action=$action" );
 3575+
 3576+ if ( strlen( $url ) > 255 ) {
 3577+ return wfMsgForContent( 'scarytranscludetoolong' );
35883578 }
 3579+ return $this->fetchScaryTemplateMaybeFromCache( $url );
 3580+ }
35893581
35903582 /**
 3583+ * @param $url string
 3584+ * @return Mixed|String
 3585+ */
 3586+ function fetchScaryTemplateMaybeFromCache( $url ) {
 3587+ global $wgTranscludeCacheExpiry;
 3588+ $dbr = wfGetDB( DB_SLAVE );
 3589+ $tsCond = $dbr->timestamp( time() - $wgTranscludeCacheExpiry );
 3590+ $obj = $dbr->selectRow( 'transcache', array('tc_time', 'tc_contents' ),
 3591+ array( 'tc_url' => $url, "tc_time >= " . $dbr->addQuotes( $tsCond ) ) );
 3592+ if ( $obj ) {
 3593+ return $obj->tc_contents;
 3594+ }
 3595+
 3596+ $text = Http::get( $url );
 3597+ if ( !$text ) {
 3598+ return wfMsgForContent( 'scarytranscludefailed', $url );
 3599+ }
 3600+
 3601+ $dbw = wfGetDB( DB_MASTER );
 3602+ $dbw->replace( 'transcache', array('tc_url'), array(
 3603+ 'tc_url' => $url,
 3604+ 'tc_time' => $dbw->timestamp( time() ),
 3605+ 'tc_contents' => $text)
 3606+ );
 3607+ return $text;
 3608+ }
 3609+
 3610+ /**
35913611 * Triple brace replacement -- used for template arguments
35923612 * @private
35933613 *
Index: trunk/phase3/includes/parser/ParserOutput.php
@@ -121,8 +121,6 @@
122122 $mLinks = array(), # 2-D map of NS/DBK to ID for the links in the document. ID=zero for broken.
123123 $mTemplates = array(), # 2-D map of NS/DBK to ID for the template references. ID=zero for broken.
124124 $mTemplateIds = array(), # 2-D map of NS/DBK to rev ID for the template references. ID=zero for broken.
125 - $mDistantTemplates = array(), # 3-D map of WIKIID/NS/DBK to ID for the template references. ID=zero for broken.
126 - $mDistantTemplateIds = array(), # 3-D map of WIKIID/NS/DBK to rev ID for the template references. ID=zero for broken.
127125 $mImages = array(), # DB keys of the images used, in the array key only
128126 $mFileSearchOptions = array(), # DB keys of the images used mapped to sha1 and MW timestamp
129127 $mExternalLinks = array(), # External link URLs, in the key only
@@ -193,8 +191,6 @@
194192 function getEditSectionTokens() { return $this->mEditSectionTokens; }
195193 function &getLinks() { return $this->mLinks; }
196194 function &getTemplates() { return $this->mTemplates; }
197 - function &getDistantTemplates() { return $this->mDistantTemplates; }
198 - function &getDistantTemplateIds() { return $this->mDistantTemplateIds; }
199195 function &getTemplateIds() { return $this->mTemplateIds; }
200196 function &getImages() { return $this->mImages; }
201197 function &getFileSearchOptions() { return $this->mFileSearchOptions; }
@@ -316,31 +312,6 @@
317313 $this->mTemplateIds[$ns][$dbk] = $rev_id; // For versioning
318314 }
319315
320 - function addDistantTemplate( $title, $page_id, $rev_id ) {
321 - $prefix = $title->getInterwiki();
322 - if ( $prefix !=='' ) {
323 - $ns = $title->getNamespace();
324 - $dbk = $title->getDBkey();
325 -
326 - if ( !isset( $this->mDistantTemplates[$prefix] ) ) {
327 - $this->mDistantTemplates[$prefix] = array();
328 - }
329 - if ( !isset( $this->mDistantTemplates[$prefix][$ns] ) ) {
330 - $this->mDistantTemplates[$prefix][$ns] = array();
331 - }
332 - $this->mDistantTemplates[$prefix][$ns][$dbk] = $page_id;
333 -
334 - // For versioning
335 - if ( !isset( $this->mDistantTemplateIds[$prefix] ) ) {
336 - $this->mDistantTemplateIds[$prefix] = array();
337 - }
338 - if ( !isset( $this->mDistantTemplateIds[$prefix][$ns] ) ) {
339 - $this->mDistantTemplateIds[$prefix][$ns] = array();
340 - }
341 - $this->mDistantTemplateIds[$prefix][$ns][$dbk] = $rev_id;
342 - }
343 - }
344 -
345316 /**
346317 * @param $title Title object, must be an interwiki link
347318 * @throws MWException if given invalid input
Index: trunk/phase3/includes/parser/Preprocessor_DOM.php
@@ -1039,8 +1039,7 @@
10401040 $params = array(
10411041 'title' => new PPNode_DOM( $title ),
10421042 'parts' => new PPNode_DOM( $parts ),
1043 - 'lineStart' => $lineStart,
1044 - 'interwiki' => $this->title->getInterwiki( ) );
 1043+ 'lineStart' => $lineStart );
10451044 $ret = $this->parser->braceSubstitution( $params, $this );
10461045 if ( isset( $ret['object'] ) ) {
10471046 $newIterator = $ret['object'];
Index: trunk/phase3/includes/Revision.php
@@ -110,7 +110,8 @@
111111 'minor_edit' => $row->ar_minor_edit,
112112 'text_id' => isset( $row->ar_text_id ) ? $row->ar_text_id : null,
113113 'deleted' => $row->ar_deleted,
114 - 'len' => $row->ar_len);
 114+ 'len' => $row->ar_len
 115+ );
115116 if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
116117 // Pre-1.5 ar_text row
117118 $attribs['text'] = self::getRevisionText( $row, 'ar_' );
@@ -166,30 +167,6 @@
167168 }
168169
169170 /**
170 - * Stores the origin wiki of a revision in case it is a foreign wiki
171 - */
172 - function setWikiID( $wikiID ) {
173 - $this->mWikiID = $wikiID;
174 - }
175 -
176 - /**
177 - * Load the current revision of a given page of a foreign wiki.
178 - * The WikiID is stored for further use, such as loadText() and getTimestampFromId()
179 - */
180 - public static function loadFromTitleForeignWiki( $wikiID, $title ) {
181 - $dbr = wfGetDB( DB_SLAVE, array(), $wikiID );
182 -
183 - $revision = self::loadFromTitle( $dbr, $title );
184 -
185 - if( $revision ) {
186 - $revision->setWikiID( $wikiID );
187 - }
188 -
189 - return $revision;
190 -
191 - }
192 -
193 - /**
194171 * Load either the current, or a specified, revision
195172 * that's attached to a given page. If not attached
196173 * to that page, will return null.
@@ -426,7 +403,6 @@
427404 throw new MWException( 'Revision constructor passed invalid row format.' );
428405 }
429406 $this->mUnpatrolled = null;
430 - $this->mWikiID = false;
431407 }
432408
433409 /**
@@ -474,8 +450,7 @@
475451 if( isset( $this->mTitle ) ) {
476452 return $this->mTitle;
477453 }
478 - $dbr = wfGetDB( DB_SLAVE, array(), $this->mWikiID );
479 -
 454+ $dbr = wfGetDB( DB_SLAVE );
480455 $row = $dbr->selectRow(
481456 array( 'page', 'revision' ),
482457 array( 'page_namespace', 'page_title' ),
@@ -614,7 +589,7 @@
615590 if( $this->mUnpatrolled !== null ) {
616591 return $this->mUnpatrolled;
617592 }
618 - $dbr = wfGetDB( DB_SLAVE, array(), $this->mWikiID );
 593+ $dbr = wfGetDB( DB_SLAVE );
619594 $this->mUnpatrolled = $dbr->selectField( 'recentchanges',
620595 'rc_id',
621596 array( // Add redundant user,timestamp condition so we can use the existing index
@@ -950,11 +925,7 @@
951926 // Caching may be beneficial for massive use of external storage
952927 global $wgRevisionCacheExpiry, $wgMemc;
953928 $textId = $this->getTextId();
954 - if( isset( $this->mWikiID ) && $this->mWikiID !== false ) {
955 - $key = wfForeignMemcKey( $this->mWikiID, null, 'revisiontext', 'textid', $textId );
956 - } else {
957929 $key = wfMemcKey( 'revisiontext', 'textid', $textId );
958 - }
959930 if( $wgRevisionCacheExpiry ) {
960931 $text = $wgMemc->get( $key );
961932 if( is_string( $text ) ) {
@@ -974,7 +945,7 @@
975946
976947 if( !$row ) {
977948 // Text data is immutable; check slaves first.
978 - $dbr = wfGetDB( DB_SLAVE, array(), $this->mWikiID );
 949+ $dbr = wfGetDB( DB_SLAVE );
979950 $row = $dbr->selectRow( 'text',
980951 array( 'old_text', 'old_flags' ),
981952 array( 'old_id' => $this->getTextId() ),
@@ -983,7 +954,7 @@
984955
985956 if( !$row && wfGetLB()->getServerCount() > 1 ) {
986957 // Possible slave lag!
987 - $dbw = wfGetDB( DB_MASTER, array(), $this->mWikiID );
 958+ $dbw = wfGetDB( DB_MASTER );
988959 $row = $dbw->selectRow( 'text',
989960 array( 'old_text', 'old_flags' ),
990961 array( 'old_id' => $this->getTextId() ),
@@ -1094,8 +1065,7 @@
10951066 * @return String
10961067 */
10971068 static function getTimestampFromId( $title, $id ) {
1098 - $wikiId = wfWikiID();
1099 - $dbr = wfGetDB( DB_SLAVE, array(), $wikiId );
 1069+ $dbr = wfGetDB( DB_SLAVE );
11001070 // Casting fix for DB2
11011071 if ( $id == '' ) {
11021072 $id = 0;
@@ -1105,7 +1075,7 @@
11061076 $timestamp = $dbr->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ );
11071077 if ( $timestamp === false && wfGetLB()->getServerCount() > 1 ) {
11081078 # Not in slave, try master
1109 - $dbw = wfGetDB( DB_MASTER, array(), $wikiId );
 1079+ $dbw = wfGetDB( DB_MASTER );
11101080 $timestamp = $dbw->selectField( 'revision', 'rev_timestamp', $conds, __METHOD__ );
11111081 }
11121082 return wfTimestamp( TS_MW, $timestamp );
Property changes on: trunk/phase3/includes/Revision.php
___________________________________________________________________
Modified: svn:mergeinfo
11131083 Reverse-merged /branches/iwtransclusion/phase3/includes/Revision.php:r69730,69745-69746,69781,69783,69853,69948,70411,70575
11141084 Reverse-merged /branches/iwtransclusion/phase3v2/includes/Revision.php:r87105-87107
11151085 Reverse-merged /branches/iwtransclusion/phase3v3/includes/Revision.php:r92983-95395
Index: trunk/phase3/includes/installer/SqliteUpdater.php
@@ -63,8 +63,6 @@
6464 // 1.19
6565 array( 'addTable', 'config', 'patch-config.sql' ),
6666 array( 'addIndex', 'logging', 'type_action', 'patch-logging-type-action-index.sql'),
67 - array( 'addTable', 'globaltemplatelinks', 'patch-globaltemplatelinks.sql' ),
68 - array( 'addTable', 'globalnamespaces', 'patch-globalnamespaces.sql' ),
6967 array( 'addTable', 'globalinterwiki', 'patch-globalinterwiki.sql' ),
7068 array( 'doMigrateUserOptions' ),
7169 );
Index: trunk/phase3/includes/installer/MysqlUpdater.php
@@ -185,9 +185,6 @@
186186 // 1.19
187187 array( 'addTable', 'config', 'patch-config.sql' ),
188188 array( 'addIndex', 'logging', 'type_action', 'patch-logging-type-action-index.sql'),
189 - array( 'addTable', 'globaltemplatelinks', 'patch-globaltemplatelinks.sql' ),
190 - array( 'addTable', 'globalnamespaces', 'patch-globalnamespaces.sql' ),
191 - array( 'addTable', 'globalinterwiki', 'patch-globalinterwiki.sql' ),
192189 array( 'doMigrateUserOptions' ),
193190 array( 'dropField', 'user', 'user_options', 'patch-drop-user_options.sql' ),
194191
Index: trunk/phase3/includes/interwiki/Interwiki.php
@@ -9,7 +9,6 @@
1010 * All information is loaded on creation when called by Interwiki::fetch( $prefix ).
1111 * All work is done on slave, because this should *never* change (except during
1212 * schema updates etc, which aren't wiki-related)
13 - * This class also contains the functions that allow interwiki templates transclusion.
1413 */
1514 class Interwiki {
1615
@@ -172,7 +171,6 @@
173172 $mc = array(
174173 'iw_url' => $iw->mURL,
175174 'iw_api' => $iw->mAPI,
176 - 'iw_wikiid' => $iw->mWikiID,
177175 'iw_local' => $iw->mLocal,
178176 'iw_trans' => $iw->mTrans
179177 );
@@ -197,7 +195,6 @@
198196 $iw->mURL = $mc['iw_url'];
199197 $iw->mLocal = isset( $mc['iw_local'] ) ? $mc['iw_local'] : 0;
200198 $iw->mTrans = isset( $mc['iw_trans'] ) ? $mc['iw_trans'] : 0;
201 - $iw->mAPI = isset( $mc['iw_api'] ) ? $mc['iw_api'] :
202199 $iw->mAPI = isset( $mc['iw_api'] ) ? $mc['iw_api'] : '';
203200 $iw->mWikiID = isset( $mc['iw_wikiid'] ) ? $mc['iw_wikiid'] : '';
204201
@@ -392,166 +389,4 @@
393390 $msg = wfMessage( 'interwiki-desc-' . $this->mPrefix )->inContentLanguage();
394391 return !$msg->exists() ? '' : $msg;
395392 }
396 -
397 -
398 - /**
399 - * Transclude an interwiki link.
400 - */
401 - public static function interwikiTransclude( $title ) {
402 -
403 - // If we have a wikiID, we will use it to get an access to the remote database
404 - // if not, we will use the API URL to retrieve the data through a HTTP Get
405 -
406 - $wikiID = $title->getTransWikiID( );
407 - $transAPI = $title->getTransAPI( );
408 -
409 - if ( $wikiID !== '') {
410 -
411 - $finalText = self::fetchTemplateFromDB( $wikiID, $title );
412 - return $finalText;
413 -
414 - } else if( $transAPI !== '' ) {
415 -
416 - $interwiki = $title->getInterwiki( );
417 - $fullTitle = $title->getSemiPrefixedText( );
418 -
419 - $finalText = self::fetchTemplateFromAPI( $interwiki, $transAPI, $fullTitle );
420 -
421 - return $finalText;
422 -
423393 }
424 - return false;
425 - }
426 -
427 - /**
428 - * Retrieve the wikitext of a distant page accessing the foreign DB
429 - */
430 - public static function fetchTemplateFromDB ( $wikiID, $title ) {
431 -
432 - $revision = Revision::loadFromTitleForeignWiki( $wikiID, $title );
433 -
434 - if ( $revision ) {
435 - $text = $revision->getText();
436 - return $text;
437 - }
438 -
439 - return false;
440 - }
441 -
442 - /**
443 - * Retrieve the wikitext of a distant page using the API of the foreign wiki
444 - */
445 - public static function fetchTemplateFromAPI( $interwiki, $transAPI, $fullTitle ) {
446 - global $wgMemc, $wgTranscludeCacheExpiry;
447 -
448 - $key = wfMemcKey( 'iwtransclustiontext', 'textid', $interwiki, $fullTitle );
449 - $text = $wgMemc->get( $key );
450 - if( is_array ( $text ) &&
451 - isset ( $text['missing'] ) &&
452 - $text['missing'] === true ) {
453 - return false;
454 - } else if ( $text ) {
455 - return $text;
456 - }
457 -
458 - $url = wfAppendQuery(
459 - $transAPI,
460 - array( 'action' => 'query',
461 - 'titles' => $fullTitle,
462 - 'prop' => 'revisions',
463 - 'rvprop' => 'content',
464 - 'format' => 'json'
465 - )
466 - );
467 -
468 - $get = Http::get( $url );
469 - $content = FormatJson::decode( $get, true );
470 -
471 - if ( isset ( $content['query'] ) &&
472 - isset ( $content['query']['pages'] ) ) {
473 - $page = array_pop( $content['query']['pages'] );
474 - if ( $page && isset( $page['revisions'][0]['*'] ) ) {
475 - $text = $page['revisions'][0]['*'];
476 - $wgMemc->set( $key, $text, $wgTranscludeCacheExpiry );
477 -
478 - // When we cache a template, we also retrieve and cache its subtemplates
479 - $subtemplates = self::getSubtemplatesListFromAPI( $interwiki, $transAPI, $fullTitle );
480 - self::cacheTemplatesFromAPI( $interwiki, $transAPI, $subtemplates );
481 -
482 - return $text;
483 - } else {
484 - $wgMemc->set( $key, array ( 'missing' => true ), $wgTranscludeCacheExpiry );
485 - }
486 - }
487 - return false;
488 - }
489 -
490 - public static function getSubtemplatesListFromAPI ( $interwiki, $transAPI, $title ) {
491 - $url = wfAppendQuery( $transAPI,
492 - array( 'action' => 'query',
493 - 'titles' => $title,
494 - 'prop' => 'templates',
495 - 'format' => 'json'
496 - )
497 - );
498 -
499 - $get = Http::get( $url );
500 - $myArray = FormatJson::decode($get, true);
501 -
502 - $templates = array( );
503 - if ( ! empty( $myArray['query'] )) {
504 - if ( ! empty( $myArray['query']['pages'] )) {
505 - $templates = array_pop( $myArray['query']['pages'] );
506 - if ( ! empty( $templates['templates'] )) {
507 - $templates = $templates['templates'];
508 - }
509 - }
510 - return $templates;
511 - }
512 - }
513 -
514 - public static function cacheTemplatesFromAPI( $interwiki, $transAPI, $titles ){
515 - global $wgMemc, $wgTranscludeCacheExpiry;
516 -
517 - $outdatedTitles = array( );
518 -
519 - foreach( $titles as $title ){
520 - if ( isset ( $title['title'] ) ) {
521 - $key = wfMemcKey( 'iwtransclustiontext', 'textid', $interwiki, $title['title'] );
522 - $text = $wgMemc->get( $key );
523 - if( !$text ){
524 - $outdatedTitles[] = $title['title'];
525 - }
526 - }
527 - }
528 -
529 - $batches = array_chunk( $outdatedTitles, 50 );
530 -
531 - foreach( $batches as $batch ){
532 - $url = wfAppendQuery(
533 - $transAPI,
534 - array( 'action' => 'query',
535 - 'titles' => implode( '|', $batch ),
536 - 'prop' => 'revisions',
537 - 'rvprop' => 'content',
538 - 'format' => 'json'
539 - )
540 - );
541 - $get = Http::get( $url );
542 - $content = FormatJson::decode( $get, true );
543 -
544 - if ( isset ( $content['query'] ) &&
545 - isset ( $content['query']['pages'] ) ) {
546 - foreach( $content['query']['pages'] as $page ) {
547 - $key = wfMemcKey( 'iwtransclustiontext', 'textid', $interwiki, $page['title'] );
548 - if ( isset ( $page['revisions'][0]['*'] ) ) {
549 - $text = $page['revisions'][0]['*'];
550 - } else {
551 - $text = array ( 'missing' => true );
552 - }
553 - $wgMemc->set( $key, $text, $wgTranscludeCacheExpiry );
554 - }
555 - }
556 - }
557 - }
558 -}
Property changes on: trunk/phase3/includes/interwiki/Interwiki.php
___________________________________________________________________
Modified: svn:mergeinfo
559394 Reverse-merged /branches/iwtransclusion/phase3/includes/interwiki/Interwiki.php:r69541,69723,69730,69745-69746,69781,69783,69853,69948,70411,70575,70802
560395 Reverse-merged /branches/iwtransclusion/phase3v2/includes/interwiki/Interwiki.php:r87105-87107,87109
561396 Reverse-merged /branches/iwtransclusion/phase3v3/includes/interwiki/Interwiki.php:r92983-95395
Index: trunk/phase3/includes/OutputPage.php
@@ -2061,8 +2061,6 @@
20622062 * @param $action String: action that was denied or null if unknown
20632063 */
20642064 public function readOnlyPage( $source = null, $protected = false, $reasons = array(), $action = null ) {
2065 - global $wgEnableInterwikiTranscluding, $wgEnableInterwikiTemplatesTracking;
2066 -
20672065 $this->setRobotPolicy( 'noindex,nofollow' );
20682066 $this->setArticleRelated( false );
20692067
@@ -2111,12 +2109,6 @@
21122110 $templates
21132111 </div>
21142112 " );
2115 - if ( $wgEnableInterwikiTranscluding && $wgEnableInterwikiTemplatesTracking ) {
2116 - $distantTemplates = Linker::formatDistantTemplates( $article->getUsedDistantTemplates() );
2117 - $this->addHTML( "<div class='distantTemplatesUsed'>
2118 -$distantTemplates
2119 -</div>
2120 -" );
21212113 }
21222114 }
21232115
Property changes on: trunk/phase3/includes/OutputPage.php
___________________________________________________________________
Modified: svn:mergeinfo
21242116 Reverse-merged /branches/iwtransclusion/phase3/includes/OutputPage.php:r70764
21252117 Reverse-merged /branches/iwtransclusion/phase3v2/includes/OutputPage.php:r87108
21262118 Reverse-merged /branches/iwtransclusion/phase3v3/includes/OutputPage.php:r92983-95395
Index: trunk/phase3/includes/WikiPage.php
@@ -1600,7 +1600,7 @@
16011601 public function doDeleteArticle(
16021602 $reason, $suppress = false, $id = 0, $commit = true, &$error = '', User $user = null
16031603 ) {
1604 - global $wgUseTrackbacks, $wgEnableInterwikiTemplatesTracking, $wgGlobalDatabase, $wgUser;
 1604+ global $wgDeferredUpdateList, $wgUseTrackbacks, $wgUser;
16051605 $user = is_null( $user ) ? $wgUser : $user;
16061606
16071607 wfDebug( __METHOD__ . "\n" );
@@ -1706,13 +1706,6 @@
17071707 $dbw->delete( 'iwlinks', array( 'iwl_from' => $id ), __METHOD__ );
17081708 $dbw->delete( 'redirect', array( 'rd_from' => $id ), __METHOD__ );
17091709 $dbw->delete( 'page_props', array( 'pp_page' => $id ), __METHOD__ );
1710 -
1711 - if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) {
1712 - $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
1713 - $dbw2->delete( 'globaltemplatelinks',
1714 - array( 'gtl_from_wiki' => wfGetID(),
1715 - 'gtl_from_page' => $id )
1716 - );
17171710 }
17181711 }
17191712
@@ -2234,9 +2227,7 @@
22352228 $title->touchLinks();
22362229 $title->purgeSquid();
22372230 $title->deleteTitleProtection();
2238 -
2239 - # Invalidate caches of distant articles which transclude this page
2240 - DeferredUpdates::addHTMLCacheUpdate( $title, 'globaltemplatelinks' );
 2231+ $wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, 'globaltemplatelinks' );
22412232 }
22422233
22432234 /**
@@ -2280,9 +2271,7 @@
22812272
22822273 # Image redirects
22832274 RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $title );
2284 -
2285 - # Invalidate caches of distant articles which transclude this page
2286 - DeferredUpdates::addHTMLCacheUpdate( $title, 'globaltemplatelinks' );
 2275+ $wgDeferredUpdateList[] = new HTMLCacheUpdate( $title, 'globaltemplatelinks' );
22872276 }
22882277
22892278 /**
@@ -2295,8 +2284,6 @@
22962285 // Invalidate caches of articles which include this page
22972286 DeferredUpdates::addHTMLCacheUpdate( $title, 'templatelinks' );
22982287
2299 - // Invalidate caches of distant articles which transclude this page
2300 - DeferredUpdates::addHTMLCacheUpdate( $title, 'globaltemplatelinks' );
23012288
23022289 // Invalidate the caches of all pages which redirect here
23032290 DeferredUpdates::addHTMLCacheUpdate( $title, 'redirect' );
@@ -2340,40 +2327,6 @@
23412328 }
23422329
23432330 /**
2344 - * Return a list of distant templates used by this article.
2345 - * Uses the globaltemplatelinks table
2346 - *
2347 - * @return Array of Title objects
2348 - */
2349 - public function getUsedDistantTemplates() {
2350 - global $wgGlobalDatabase;
2351 -
2352 - $result = array();
2353 -
2354 - if ( $wgGlobalDatabase ) {
2355 - $id = $this->mTitle->getArticleID();
2356 -
2357 - if ( $id == 0 ) {
2358 - return array();
2359 - }
2360 -
2361 - $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
2362 - $res = $dbr->select( 'globaltemplatelinks',
2363 - array( 'gtl_to_prefix', 'gtl_to_namespace', 'gtl_to_title' ),
2364 - array( 'gtl_from_wiki' => wfWikiID( ), 'gtl_from_page' => $id ),
2365 - __METHOD__ );
2366 -
2367 - if ( $res !== false ) {
2368 - foreach ( $res as $row ) {
2369 - $result[] = Title::makeTitle( $row->gtl_to_namespace, $row->gtl_to_title, null, $row->gtl_to_prefix );
2370 - }
2371 - }
2372 - }
2373 -
2374 - return $result;
2375 - }
2376 -
2377 - /**
23782331 * Returns a list of hidden categories this page is a member of.
23792332 * Uses the page_props and categorylinks tables.
23802333 *
Index: trunk/phase3/includes/BacklinkCache.php
@@ -177,25 +177,6 @@
178178 }
179179
180180 /**
181 - * Get the distant backtemplatelinks for the table globaltemplatelinks. Cached in process memory only.
182 - * @return ResultWrapper list of distant pages that use the local title
183 - */
184 - public function getDistantTemplateLinks( ) {
185 - global $wgGlobalDatabase, $wgLocalInterwiki;
186 -
187 - $dbr = wfGetDB( DB_SLAVE, array(), $wgGlobalDatabase );
188 - $res = $dbr->select(
189 - array( 'globaltemplatelinks', 'globalinterwiki' ),
190 - array( 'gtl_from_wiki', 'gtl_from_page', 'gtl_from_title', 'giw_prefix' ),
191 - array( 'gtl_to_prefix' => $wgLocalInterwiki, 'gtl_to_title' => $this->title->getDBkey( ) ),
192 - __METHOD__,
193 - null,
194 - array( 'gtl_from_wiki = giw_wikiid' )
195 - );
196 - return $res;
197 - }
198 -
199 - /**
200181 * Get the field name prefix for a given table
201182 * @param $table String
202183 */
@@ -206,7 +187,6 @@
207188 'categorylinks' => 'cl',
208189 'templatelinks' => 'tl',
209190 'redirect' => 'rd',
210 - 'globaltemplatelinks' => 'gtl',
211191 );
212192
213193 if ( isset( $prefixes[$table] ) ) {
@@ -305,7 +285,7 @@
306286 */
307287 public function partition( $table, $batchSize ) {
308288
309 - // 1) try partition cache ...
 289+ // 1) try partition cache ...
310290
311291 if ( isset( $this->partitionCache[$table][$batchSize] ) ) {
312292 wfDebug( __METHOD__ . ": got from partition cache\n" );
@@ -360,7 +340,7 @@
361341 * Partition a DB result with backlinks in it into batches
362342 * @param $res ResultWrapper database result
363343 * @param $batchSize integer
364 - * @return array @see
 344+ * @return array @see
365345 */
366346 protected function partitionResult( $res, $batchSize ) {
367347 $batches = array();
Index: trunk/phase3/includes/Title.php
@@ -47,7 +47,6 @@
4848 */
4949 const GAID_FOR_UPDATE = 1;
5050
51 -
5251 /**
5352 * @name Private member variables
5453 * Please use the accessor functions instead.
@@ -766,19 +765,6 @@
767766 }
768767
769768 /**
770 - * Return the prefixed title with spaces _without_ the interwiki prefix
771 - *
772 - * @return \type{\string} the title, prefixed by the namespace but not by the interwiki prefix, with spaces
773 - */
774 - public function getSemiPrefixedText() {
775 - if ( !isset( $this->mSemiPrefixedText ) ){
776 - $s = ( $this->mNamespace === NS_MAIN ? '' : $this->getNsText() . ':' ) . $this->mTextform;
777 - $s = str_replace( '_', ' ', $s );
778 - $this->mSemiPrefixedText = $s;
779 - }
780 - return $this->mSemiPrefixedText;
781 - }
782 -
783769 /**
784770 * Get the prefixed title with spaces, plus any fragment
785771 * (part beginning with '#')
@@ -857,6 +843,8 @@
858844 * @return String the URL
859845 */
860846 public function getFullURL( $query = '', $variant = false ) {
 847+ global $wgServer, $wgRequest;
 848+
861849 # Hand off all the decisions on urls to getLocalURL
862850 $url = $this->getLocalURL( $query, $variant );
863851
@@ -1029,12 +1017,8 @@
10301018 * @return String the URL
10311019 */
10321020 public function getInternalURL( $query = '', $variant = false ) {
1033 - if ( $this->isExternal( ) ) {
1034 - $server = '';
1035 - } else {
1036 - global $wgInternalServer, $wgServer;
1037 - $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer;
1038 - }
 1021+ global $wgInternalServer, $wgServer;
 1022+ $server = $wgInternalServer !== false ? $wgInternalServer : $wgServer;
10391023 $url = wfExpandUrl( $server . $this->getLocalURL( $query, $variant ), PROTO_HTTP );
10401024 wfRunHooks( 'GetInternalURL', array( &$this, &$url, $query, $variant ) );
10411025 return $url;
@@ -2853,10 +2837,6 @@
28542838 $this->mFragment = str_replace( '_', ' ', substr( $fragment, 1 ) );
28552839 }
28562840
2857 - public function setInterwiki( $interwiki ) {
2858 - $this->mInterwiki = $interwiki;
2859 - }
2860 -
28612841 /**
28622842 * Get a Title object associated with the talk page of this article
28632843 *
@@ -3168,8 +3148,6 @@
31693149 * @return Mixed true on success, getUserPermissionsErrors()-like array on failure
31703150 */
31713151 public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true ) {
3172 - global $wgEnableInterwikiTemplatesTracking, $wgGlobalDatabase;
3173 -
31743152 $err = $this->isValidMoveOperation( $nt, $auth, $reason );
31753153 if ( is_array( $err ) ) {
31763154 return $err;
@@ -3197,7 +3175,7 @@
31983176 $pageCountChange = ( $createRedirect ? 1 : 0 ) - ( $nt->exists() ? 1 : 0 );
31993177
32003178 // Do the actual move
3201 - $err = $this->moveOverExistingRedirect( $nt, $reason, $createRedirect );
 3179+ $err = $this->moveToInternal( $nt, $reason, $createRedirect );
32023180 if ( is_array( $err ) ) {
32033181 # @todo FIXME: What about the File we have already moved?
32043182 $dbw->rollback();
@@ -3229,15 +3207,6 @@
32303208 );
32313209 }
32323210
3233 - if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) {
3234 - $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
3235 - $dbw2->update( 'globaltemplatelinks',
3236 - array( 'gtl_from_namespace' => $nt->getNamespace(),
3237 - 'gtl_from_title' => $nt->getText() ),
3238 - array ( 'gtl_from_page' => $pageid ),
3239 - __METHOD__ );
3240 - }
3241 -
32423211 if ( $protected ) {
32433212 # Protect the redirect title as the title used to be...
32443213 $dbw->insertSelect( 'page_restrictions', 'page_restrictions',
@@ -3331,8 +3300,8 @@
33323301 * @param $createRedirect Bool Whether to leave a redirect at the old title. Ignored
33333302 * if the user doesn't have the suppressredirect right
33343303 */
3335 - private function moveOverExistingRedirect( &$nt, $reason = '', $createRedirect = true ) {
3336 - global $wgUser, $wgContLang, $wgEnableInterwikiTemplatesTracking, $wgGlobalDatabase;
 3304+ private function moveToInternal( &$nt, $reason = '', $createRedirect = true ) {
 3305+ global $wgUser, $wgContLang;
33373306
33383307 if ( $nt->exists() ) {
33393308 $moveOverRedirect = true;
@@ -3399,14 +3368,7 @@
34003369 array( 'rc_timestamp' => $rcts, 'rc_namespace' => $newns, 'rc_title' => $newdbk, 'rc_new' => 1 ),
34013370 __METHOD__
34023371 );
3403 -
3404 - if ( $wgEnableInterwikiTemplatesTracking && $wgGlobalDatabase ) {
3405 - $dbw2 = wfGetDB( DB_MASTER, array(), $wgGlobalDatabase );
3406 - $dbw2->delete( 'globaltemplatelinks',
3407 - array( 'gtl_from_wiki' => wfGetID(),
3408 - 'gtl_from_page' => $newid ),
34093372 __METHOD__ );
3410 - }
34113373 }
34123374
34133375 # Save a null revision in the page's history notifying of the move
@@ -4406,4 +4368,4 @@
44074369 wfRunHooks( 'PageContentLanguage', array( $this, &$pageLang, $wgLang ) );
44084370 return wfGetLangObj( $pageLang );
44094371 }
4410 -}
 4372+}
\ No newline at end of file
Property changes on: trunk/phase3/includes/Title.php
___________________________________________________________________
Modified: svn:mergeinfo
44114373 Reverse-merged /branches/iwtransclusion/phase3v2/includes/Title.php:r87106-87107,87111,87115
44124374 Reverse-merged /branches/iwtransclusion/phase3v3/includes/Title.php:r92983-95395
44134375 Reverse-merged /branches/iwtransclusion/phase3/includes/Title.php:r69745-69746,69781,69783,69853,69948,70411,70575-70576,70966,71049,76200

Follow-up revisions

RevisionCommit summaryAuthorDate
r98469Fix comment syntax error from r98467reedy22:10, 29 September 2011
r98472Another reverse merge artefact from r98467reedy22:11, 29 September 2011
r98473And an extra brace from r98467reedy22:14, 29 September 2011
r98474And another brace... r98467reedy22:16, 29 September 2011
r98475More spurious code r98467reedy22:17, 29 September 2011
r98480Kill the updater remnants from r98467reedy22:28, 29 September 2011
r100167Remove some more code after r98467reedy21:47, 18 October 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r95396Merge the iwtransclusion branch back into trunk...reedy13:03, 24 August 2011

Comments

#Comment by Platonides (talk | contribs)   21:44, 18 October 2011

You added in WikPage.php global $wgDeferredUpdateList to line 1602 (doDeleteArticle), but that doesn't affect lines 2228 and 2272 (onArticleCreate and onArticleDelete).

Status & tagging log