Index: trunk/extensions/CentralNotice/SpecialNoticeLoader.php |
— | — | @@ -1,82 +0,0 @@ |
2 | | -<?php |
3 | | - |
4 | | -/** |
5 | | - * The notice loader is a central point of contact; a single consistent |
6 | | - * URL used for the cluster, in all language and project versions. |
7 | | - * |
8 | | - * That central URL can be heavily cached, and centrally purged when |
9 | | - * updates do happen. |
10 | | - * |
11 | | - * It loads up a second page (Special:NoticeText) with specific project |
12 | | - * and language options and a version timestamp for clean cache breaking. |
13 | | - */ |
14 | | -class SpecialNoticeLoader extends NoticePage { |
15 | | - function __construct() { |
16 | | - parent::__construct( "NoticeLoader" ); |
17 | | - } |
18 | | - |
19 | | - /** |
20 | | - * Clients should recheck this fairly often, but not _constantly_. |
21 | | - * 5 minutes? |
22 | | - */ |
23 | | - protected function maxAge() { |
24 | | - global $wgNoticeTimeout; |
25 | | - return $wgNoticeTimeout; |
26 | | - } |
27 | | - |
28 | | - protected function sharedMaxAge() { |
29 | | - global $wgNoticeServerTimeout; |
30 | | - return $wgNoticeServerTimeout; |
31 | | - } |
32 | | - |
33 | | - function getJsOutput( $par ) { |
34 | | - global $wgNoticeTestMode; |
35 | | - $loader = $this->loaderScript(); |
36 | | - if ( $wgNoticeTestMode ) { |
37 | | - return $this->testCondition( $loader ); |
38 | | - } else { |
39 | | - return $loader; |
40 | | - } |
41 | | - } |
42 | | - |
43 | | - function testCondition( $code ) { |
44 | | - global $wgNoticeEnabledSites; |
45 | | - $conditions = array(); |
46 | | - $conditions[] = '/[?&]sitenotice=yes/.test(document.location.search)'; |
47 | | - if ( $wgNoticeEnabledSites ) { |
48 | | - foreach ( $wgNoticeEnabledSites as $site ) { |
49 | | - list( $lang, $project ) = explode( ".", $site ); |
50 | | - if ( $lang == '*' ) { |
51 | | - $conditions[] = |
52 | | - '(wgNoticeProject)==' . |
53 | | - Xml::encodeJsVar( $project ); |
54 | | - } elseif ( $project == '*' ) { |
55 | | - $conditions[] = |
56 | | - '(wgNoticeLang)==' . |
57 | | - Xml::encodeJsVar( $lang ); |
58 | | - } else { |
59 | | - $conditions[] = |
60 | | - '(wgNoticeLang+"."+wgNoticeProject)==' . |
61 | | - Xml::encodeJsVar( $site ); |
62 | | - } |
63 | | - } |
64 | | - } |
65 | | - return |
66 | | - 'if((' . |
67 | | - implode( ')||(', $conditions ) . |
68 | | - ')){' . |
69 | | - $code . |
70 | | - '}'; |
71 | | - } |
72 | | - |
73 | | - function loaderScript() { |
74 | | - global $wgNoticeText; |
75 | | - $encUrl = htmlspecialchars( $wgNoticeText ); |
76 | | - $encEpoch = urlencode( efCentralNoticeEpoch() ); |
77 | | - return "document.writeln(" . |
78 | | - Xml::encodeJsVar( "<script src=\"$encUrl/" ) . |
79 | | - '+wgNoticeProject+"/"+wgUserLanguage+' . |
80 | | - Xml::encodeJsVar( "?$encEpoch\"></script>" ) . |
81 | | - ');'; |
82 | | - } |
83 | | -} |
Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -131,9 +131,6 @@ |
132 | 132 | $wgSpecialPageGroups['CentralNotice'] = 'wiki'; // Wiki data and tools" |
133 | 133 | $wgAutoloadClasses['CentralNotice'] = $dir . 'SpecialCentralNotice.php'; |
134 | 134 | |
135 | | - $wgSpecialPages['NoticeLoader'] = 'SpecialNoticeLoader'; |
136 | | - $wgAutoloadClasses['SpecialNoticeLoader'] = $dir . 'SpecialNoticeLoader.php'; |
137 | | - |
138 | 135 | $wgSpecialPages['NoticeText'] = 'SpecialNoticeText'; |
139 | 136 | $wgAutoloadClasses['SpecialNoticeText'] = $dir . 'SpecialNoticeText.php'; |
140 | 137 | |