Krinkle has uploaded a new change for review.
https://gerrit.wikimedia.org/r/290824
Change subject: Minor clean up in CNChoiceDataResourceLoaderModule
......................................................................
Minor clean up in CNChoiceDataResourceLoaderModule
* Remove a few spurious line breaks.
* Use ! operator instead of count().
* Return inline empty array and move $dependencies lower down.
Change-Id: Ia398d275502d91bc221d6dbd80f7d7af58225e56
---
M includes/CNChoiceDataResourceLoaderModule.php
1 file changed, 5 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralNotice
refs/changes/24/290824/1
diff --git a/includes/CNChoiceDataResourceLoaderModule.php
b/includes/CNChoiceDataResourceLoaderModule.php
index 440bdda..422fd7d 100644
--- a/includes/CNChoiceDataResourceLoaderModule.php
+++ b/includes/CNChoiceDataResourceLoaderModule.php
@@ -47,9 +47,7 @@
* @param string $language
*/
protected function getFromDb( $project, $language ) {
-
$choicesProvider = new ChoiceDataProvider( $project, $language
);
-
return $choicesProvider->getChoices();
}
@@ -109,9 +107,7 @@
public function getScript( ResourceLoaderContext $context ) {
$choices = $this->getChoices( $context );
-
- if ( count( $choices ) === 0 ) {
-
+ if ( !$choices ) {
// If there are no choices, this module will have no
dependencies,
// but other modules that create mw.centralNotice may
be brought
// in elsewhere. Let's the check for its existence
here, too, for
@@ -146,18 +142,15 @@
return array();
}
-
- $dependencies = array();
-
// Get the choices (possible campaigns and banners) for this
user
$choices = $this->getChoices( $context );
-
- // If there are no choices, no dependencies
- if ( count( $choices ) === 0 ) {
- return $dependencies;
+ if ( !$choices ) {
+ // If there are no choices, no dependencies
+ return array();
}
// Run through the choices to get all needed mixin RL modules
+ $dependencies = array();
foreach ( $choices as $choice ) {
foreach ( $choice['mixins'] as $mixinName =>
$mixinParams ) {
--
To view, visit https://gerrit.wikimedia.org/r/290824
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia398d275502d91bc221d6dbd80f7d7af58225e56
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralNotice
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits