r83746 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r83745‎ | r83746 | r83747 >
Date:03:29, 12 March 2011
Author:saper
Status:resolved (Comments)
Tags:
Comment:
Load SpecialNoticeTemplate class also on non-infrastructure wikis.

PHP Fatal error: Class 'SpecialNoticeTemplate' not found in CentralNotice/SpecialBannerLoader.php on line 66
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialNoticeTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -94,13 +94,13 @@
9595 $wgAutoloadClasses['CentralNotice'] = $dir . 'SpecialCentralNotice.php';
9696 $wgAutoloadClasses['CentralNoticeDB'] = $dir . 'CentralNotice.db.php';
9797 $wgAutoloadClasses['TemplatePager'] = $dir . 'TemplatePager.php';
 98+ $wgAutoloadClasses['SpecialNoticeTemplate'] = $dir . 'SpecialNoticeTemplate.php';
9899
99100 if ( $wgNoticeInfrastructure ) {
100101 $wgSpecialPages['CentralNotice'] = 'CentralNotice';
101102 $wgSpecialPageGroups['CentralNotice'] = 'wiki'; // Wiki data and tools"
102103
103104 $wgSpecialPages['NoticeTemplate'] = 'SpecialNoticeTemplate';
104 - $wgAutoloadClasses['SpecialNoticeTemplate'] = $dir . 'SpecialNoticeTemplate.php';
105105
106106 $wgSpecialPages['BannerAllocation'] = 'SpecialBannerAllocation';
107107 $wgAutoloadClasses['SpecialBannerAllocation'] = $dir . 'SpecialBannerAllocation.php';
Index: trunk/extensions/CentralNotice/SpecialNoticeTemplate.php
@@ -886,7 +886,9 @@
887887 }
888888
889889 public static function templateExists( $templateName ) {
890 - $dbr = wfGetDB( DB_SLAVE );
 890+ global $wgCentralDBname;
 891+ $dbr = wfGetDB( DB_SLAVE, array(), $wgCentralDBname );
 892+
891893 $eTemplateName = htmlspecialchars( $templateName );
892894 $row = $dbr->selectRow( 'cn_templates', 'tmp_name',
893895 array( 'tmp_name' => $eTemplateName ) );

Follow-up revisions

RevisionCommit summaryAuthorDate
r90897follow-up to r83746 - move static method into DB classkaldari18:39, 27 June 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   18:00, 27 June 2011

Per discussion with kaldari this seems like it shouldn't happen -- Special:BannerLoader is never supposed to be called except from the banner host wiki (metawiki in production), and that's the only thing calling templateExists.

Client wikis should never access the banner database directly...

#Comment by Kaldari (talk | contribs)   18:48, 27 June 2011

I went ahead and moved the bannerExists() function to the CentralNoticeDB class, which is where it belongs anyway (public static methods that just return information from the DB). This removes the dependency on SpecialNoticeTemplate.

Status & tagging log