Skip to content

Instantly share code, notes, and snippets.

@mateusz
Created June 3, 2013 23:26
Show Gist options
  • Save mateusz/074356785f0231d4f75d to your computer and use it in GitHub Desktop.
Save mateusz/074356785f0231d4f75d to your computer and use it in GitHub Desktop.
diff --git a/core/manifest/ConfigManifest.php b/core/manifest/ConfigManifest.php
index cf1d130..9791984 100644
--- a/core/manifest/ConfigManifest.php
+++ b/core/manifest/ConfigManifest.php
@@ -396,9 +396,10 @@ class SS_ConfigManifest {
foreach ($this->yamlConfigFragments as $i => $fragment) {
$failsonly = isset($fragment['only']) && !$this->matchesPrefilterVariantRules($fragment['only']);
- $matchesexcept = isset($fragment['except']) && $this->matchesPrefilterVariantRules($fragment['except']);
+ $matchesexcept = !isset($fragment['except']) ||
+ isset($fragment['except']) && !$this->matchesPrefilterVariantRules($fragment['except']);
- if (!$failsonly && !$matchesexcept) $matchingFragments[] = $fragment;
+ if (!$failsonly && $matchesexcept) $matchingFragments[] = $fragment;
}
$this->yamlConfigFragments = $matchingFragments;
@@ -425,6 +426,8 @@ class SS_ConfigManifest {
default:
// NOP
+ // TODO: fixup to respond properly so the except checks don't fail? Maybe needs to be refactored into
+ // another "doesNotMatch..." function?
}
}
@@ -487,9 +490,13 @@ class SS_ConfigManifest {
foreach ($this->yamlConfigFragments as $i => $fragment) {
$failsonly = isset($fragment['only']) && !$this->matchesVariantRules($fragment['only']);
- $matchesexcept = isset($fragment['except']) && $this->matchesVariantRules($fragment['except']);
+ $matchesexcept = !isset($fragment['except']) ||
+ isset($fragment['except']) && !$this->matchesVariantRules($fragment['except']);
- if (!$failsonly && !$matchesexcept) $this->mergeInYamlFragment($this->yamlConfig, $fragment['fragment']);
+ var_dump($fragment, $failsonly, $matchesexcept);
+ if (!$failsonly && $matchesexcept) {
+ $this->mergeInYamlFragment($this->yamlConfig, $fragment['fragment']);
+ }
}
if ($cache) {
@@ -532,6 +539,7 @@ class SS_ConfigManifest {
return false;
default:
+ // TODO: probably also needs to be fixed up for excepts...
if (isset($_ENV[$k]) && $_ENV[$k] == $v) break;
if (defined($k) && constant($k) == $v) break;
return false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment