r92971 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92970‎ | r92971 | r92972 >
Date:22:45, 23 July 2011
Author:jeroendedauw
Status:ok
Tags:lamecommitsummary 
Comment:
fu r92970 - added docs, fixed var name typo and added check to only hold into account enabled campaigns
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizardConfig.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardConfig.php
@@ -13,6 +13,16 @@
1414 */
1515 class UploadWizardConfig {
1616
 17+ /**
 18+ * Returns the globally configuration, optionaly combined with campaign sepcific
 19+ * configuration.
 20+ *
 21+ * @since 1.2
 22+ *
 23+ * @param string|null $campaignName
 24+ *
 25+ * @return array
 26+ */
1727 public static function getConfig( $campaignName = null ) {
1828 global $wgUploadWizardConfig;
1929 static $mergedConfig = false;
@@ -28,21 +38,36 @@
2939 return $wgUploadWizardConfig;
3040 }
3141
 42+ /**
 43+ * Returns the default global config, from UploadWizard.config.php.
 44+ *
 45+ * @since 1.2
 46+ *
 47+ * @return array
 48+ */
3249 protected static function getDefaultConfig() {
3350 global $wgUpwizDir;
3451 $configPath = $wgUpwizDir . '/UploadWizard.config.php';
3552 return is_file( $configPath ) ? include( $configPath ) : array();
3653 }
3754
 55+ /**
 56+ * Returns the configuration of the specified campaign,
 57+ * or an empty array when the campaign is not found or not enabled.
 58+ *
 59+ * @since 1.2
 60+ *
 61+ * @param string $campaignName
 62+ *
 63+ * @return array
 64+ */
3865 protected static function getCampaignConfig( $campaignName ) {
3966 $capmaignSettings = array();
4067
41 - if ( !is_null( $capaignName ) ) {
42 - $capaign = UploadWizardCampaign::newFromName( $capaignName );
43 -
44 - if ( $capaign !== false ) {
45 - return $capaign->getConfig();
46 - }
 68+ $capaign = UploadWizardCampaign::newFromName( $campaignName );
 69+
 70+ if ( $capaign !== false && $capaign->getIsEnabled() ) {
 71+ return $capaign->getConfig();
4772 }
4873
4974 return array();

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92970work on campaign config handlingjeroendedauw22:38, 23 July 2011

Status & tagging log