Skip to content

Commit

Permalink
ENH Do not emit deprecation notices for supported modules by default
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 17, 2024
1 parent 9c9b743 commit 51fcc4d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Transformer/YamlTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Exception;
use Closure;
use SilverStripe\Config\Collections\MemoryConfigCollection;
use SilverStripe\Dev\Deprecation;

class YamlTransformer implements TransformerInterface
{
Expand Down Expand Up @@ -135,6 +136,9 @@ private function checkForDeprecatedConfig(array $document, MutableConfigCollecti
if (!($collection instanceof MemoryConfigCollection)) {
return;
}
if ($document['inSupportedModule'] && !Deprecation::getShowNoticesCalledFromSupportedCode()) {
return;
}
foreach ($document['content'] as $key => $value) {
if (!is_array($value)) {
continue;
Expand Down Expand Up @@ -240,8 +244,14 @@ protected function getNamedYamlDocuments()
);
}

$inSupportedModule = false;
if (class_exists(Deprecation::class) && method_exists(Deprecation::class, 'fileIsInSupportedModule')) {
$inSupportedModule = Deprecation::fileIsInSupportedModule($document['filename']);
}
$filename = $document['filename'];
$documents[$header['name']] = [
'filename' => $document['filename'],
'filename' => $filename,
'inSupportedModule' => $inSupportedModule,
'header' => $header,
'content' => $content,
];
Expand Down

0 comments on commit 51fcc4d

Please sign in to comment.