http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73818
Revision: 73818
Author: kaldari
Date: 2010-09-27 18:14:18 +0000 (Mon, 27 Sep 2010)
Log Message:
-----------
handle case of $matches being empty per comment at r73028
Modified Paths:
--------------
trunk/extensions/CentralNotice/SpecialCentralNotice.php
Modified: trunk/extensions/CentralNotice/SpecialCentralNotice.php
===================================================================
--- trunk/extensions/CentralNotice/SpecialCentralNotice.php 2010-09-27
16:13:39 UTC (rev 73817)
+++ trunk/extensions/CentralNotice/SpecialCentralNotice.php 2010-09-27
18:14:18 UTC (rev 73818)
@@ -1038,33 +1038,35 @@
// Normalize location parameter (should be an uppercase
2-letter country code)
preg_match( '/[a-zA-Z][a-zA-Z]/', $location, $matches );
- $location = strtoupper( $matches[0] );
-
- // Pull geotargeted campaigns
- $campaignResults2 = $dbr->select(
- array(
- 'cn_notices',
- 'cn_notice_languages',
- 'cn_notice_countries'
- ),
- array(
- 'not_id'
- ),
- array(
- "not_start <= $encTimestamp",
- "not_end >= $encTimestamp",
- 'not_enabled = 1', // enabled
- 'not_geo = 1', // geotargeted
- 'nc_notice_id = cn_notices.not_id',
- 'nc_country' => $location,
- 'nl_notice_id = cn_notices.not_id',
- 'nl_language' => $language,
- 'not_project' => array( '', $project )
- ),
- __METHOD__
- );
- foreach ( $campaignResults2 as $row ) {
- $campaigns[] = $row->not_id;
+ if ( $matches ) {
+ $location = strtoupper( $matches[0] );
+
+ // Pull geotargeted campaigns
+ $campaignResults2 = $dbr->select(
+ array(
+ 'cn_notices',
+ 'cn_notice_languages',
+ 'cn_notice_countries'
+ ),
+ array(
+ 'not_id'
+ ),
+ array(
+ "not_start <= $encTimestamp",
+ "not_end >= $encTimestamp",
+ 'not_enabled = 1', // enabled
+ 'not_geo = 1', // geotargeted
+ 'nc_notice_id =
cn_notices.not_id',
+ 'nc_country' => $location,
+ 'nl_notice_id =
cn_notices.not_id',
+ 'nl_language' => $language,
+ 'not_project' => array( '',
$project )
+ ),
+ __METHOD__
+ );
+ foreach ( $campaignResults2 as $row ) {
+ $campaigns[] = $row->not_id;
+ }
}
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs