r73435 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73434‎ | r73435 | r73436 >
Date:01:41, 21 September 2010
Author:kaldari
Status:reverted (Comments)
Tags:
Comment:
some debugging output
Modified paths:
  • /trunk/extensions/CentralNotice/CentralNotice.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialBannerListLoader.php (modified) (history)
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialBannerListLoader.php
@@ -64,9 +64,11 @@
6565 * Generate JSON for the specified site
6666 */
6767 function getJsonList() {
 68+ global $cnDebug;
6869
6970 // Quick short circuit to be able to show preferred notices
7071 $templates = array();
 72+ $cnDebug = ' //';
7173
7274 if ( $this->language == 'en' && $this->project != null ) {
7375 // See if we have any preferred notices for all of en
@@ -76,6 +78,7 @@
7779 // Pull banners
7880 $templates = CentralNoticeDB::selectTemplatesAssigned( $notices );
7981 }
 82+ $cnDebug .= ' 1';
8083 }
8184
8285 if ( !$templates && $this->project == 'wikipedia' ) {
@@ -86,14 +89,16 @@
8790 // Pull banners
8891 $templates = CentralNoticeDB::selectTemplatesAssigned( $notices );
8992 }
 93+ $cnDebug .= ' 2';
9094 }
9195
9296 // Didn't find any preferred matches so do an old style lookup
9397 if ( !$templates ) {
9498 $templates = CentralNotice::selectNoticeTemplates( $this->project, $this->language, $this->location );
 99+ $cnDebug .= ' 3';
95100 }
96101
97 - return FormatJson::encode( $templates );
 102+ return FormatJson::encode( $templates ) . $cnDebug;
98103 }
99104
100105 }
Index: trunk/extensions/CentralNotice/CentralNotice.php
@@ -51,6 +51,8 @@
5252 // smallish if you will. :)
5353 $wgNoticeServerTimeout = 0;
5454
 55+$cnDebug = '';
 56+
5557 // Source for live counter information
5658 $wgNoticeCounterSource = "http://donate.wikimedia.org/counter.php";
5759
Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -1005,6 +1005,8 @@
10061006 * @return A 2D array of running banners with associated weights and settings
10071007 */
10081008 static function selectNoticeTemplates( $project, $language, $location = null ) {
 1009+ global $cnDebug, $wgDBname;
 1010+
10091011 $campaigns = array();
10101012 $dbr = wfGetDB( DB_SLAVE );
10111013 $encTimestamp = $dbr->addQuotes( $dbr->timestamp() );
@@ -1065,6 +1067,7 @@
10661068 $campaigns[] = $row->not_id;
10671069 }
10681070 }
 1071+ $cnDebug .= ' campaigns: '.count( $campaigns ).' database: '.$wgDBname;
10691072
10701073 $templates = array();
10711074 if ( $campaigns ) {

Comments

#Comment by Catrope (talk | contribs)   19:42, 27 September 2010

Please just use wfDebug() for this instead of introducing a new global that's against naming conventions and polluting the output.

#Comment by Catrope (talk | contribs)   19:44, 27 September 2010

Actually this code was reverted in r73439, never mind.

Status & tagging log