r73850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73849‎ | r73850 | r73851 >
Date:00:43, 28 September 2010
Author:kaldari
Status:ok (Comments)
Tags:
Comment:
fix for database issue
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialBannerListLoader.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialBannerListLoader.php
@@ -7,7 +7,6 @@
88 public $project; // Project name
99 public $language; // Project language
1010 public $location; // User country
11 - public $centralNoticeDB;
1211 protected $sharedMaxAge = 600; // Cache for 10 minutes on the server side
1312 protected $maxAge = 600; // Cache for 10 minutes on the client side
1413
@@ -61,19 +60,7 @@
6261 // Quick short circuit to be able to show preferred notices
6362 $templates = array();
6463
65 - $templates[] = array(
66 - 'name' => 'debug_begin',
67 - 'weight' => 0,
68 - 'display_anon' => 0,
69 - 'display_account' => 0
70 - );
7164 if ( $this->language == 'en' && $this->project != null ) {
72 - $templates[] = array(
73 - 'name' => 'debug_en_preferred',
74 - 'weight' => 0,
75 - 'display_anon' => 0,
76 - 'display_account' => 0
77 - );
7865 // See if we have any preferred notices for all of en
7966 $notices = CentralNoticeDB::getNotices( null, 'en', null, 1, 1, $this->location );
8067
@@ -84,12 +71,6 @@
8572 }
8673
8774 if ( !$templates && $this->project == 'wikipedia' ) {
88 - $templates[] = array(
89 - 'name' => 'debug_wikipedia_preferred',
90 - 'weight' => 0,
91 - 'display_anon' => 0,
92 - 'display_account' => 0
93 - );
9475 // See if we have any preferred notices for this language wikipedia
9576 $notices = CentralNoticeDB::getNotices( 'wikipedia', $this->language, false, 1, 1, $this->location );
9677
@@ -101,20 +82,9 @@
10283
10384 // Didn't find any preferred matches so do an old style lookup
10485 if ( !$templates ) {
105 - $templates[] = array(
106 - 'name' => 'debug_old_style_lookup',
107 - 'weight' => 0,
108 - 'display_anon' => 0,
109 - 'display_account' => 0
110 - );
11186 $templates = CentralNotice::selectNoticeTemplates( $this->project, $this->language, $this->location );
11287 }
113 - $templates[] = array(
114 - 'name' => 'debug_finished',
115 - 'weight' => 0,
116 - 'display_anon' => 0,
117 - 'display_account' => 0
118 - );
 88+
11989 return FormatJson::encode( $templates );
12090 }
12191
Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -98,19 +98,20 @@
9999
100100 $wgSpecialPages['BannerController'] = 'SpecialBannerController';
101101 $wgAutoloadClasses['SpecialBannerController'] = $dir . 'SpecialBannerController.php';
 102+
 103+ $wgAutoloadClasses['CentralNoticeDB'] = $dir . 'CentralNotice.db.php';
102104
103105 if ( $wgNoticeInfrastructure ) {
104106 $wgSpecialPages['CentralNotice'] = 'CentralNotice';
105107 $wgSpecialPageGroups['CentralNotice'] = 'wiki'; // Wiki data and tools"
106108 $wgAutoloadClasses['CentralNotice'] = $dir . 'SpecialCentralNotice.php';
107 -
 109+
108110 $wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate';
109111 $wgAutoloadClasses['SpecialNoticeTemplate'] = $dir . 'SpecialNoticeTemplate.php';
110 -
 112+
111113 $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation';
112114 $wgAutoloadClasses['SpecialBannerAllocation'] = $dir . 'SpecialBannerAllocation.php';
113 -
114 - $wgAutoloadClasses['CentralNoticeDB'] = $dir . 'CentralNotice.db.php';
 115+
115116 $wgAutoloadClasses['TemplatePager'] = $dir . 'TemplatePager.php';
116117 }
117118 }

Comments

#Comment by Brion VIBBER (talk | contribs)   02:55, 28 September 2010

This reverts r73848 -- is there a reason for this?

#Comment by Brion VIBBER (talk | contribs)   02:56, 28 September 2010

Rather r73847 (on trunk)

#Comment by Kaldari (talk | contribs)   06:07, 28 September 2010

The changes in r73847 were temporary to debug a problem that existed in the live environment, but not locally. The fix was to autoload the CentralNoticeDB class regardless of whether $wgNoticeInfrastructure was set to true or not on that wiki, since CentralNoticeDB is used by the new banner loading system, not just the CentralNotice interface infrastructure.

Status & tagging log