Skip to content

Instantly share code, notes, and snippets.

@reneeb
Last active January 26, 2021 12:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save reneeb/8e57d2415d963e3650051d1278984491 to your computer and use it in GitHub Desktop.
Save reneeb/8e57d2415d963e3650051d1278984491 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use v5.10;
use strict;
use warnings;
use lib qw(/opt/otrs /opt/otrs/Kernel/cpan-lib);
use Kernel::Config::Files::ZZZAAuto;
my $Config = {};
Kernel::Config::Files::ZZZAAuto->Load( $Config );
for my $Key ( qw/Frontend::NavigationModule Frontend::Module/ ) {
check_config_key( $Key );
}
sub check_config_key {
my ($Key) = @_;
MODULE:
for my $Module ( keys %{ $Config->{$Key} || {} } ) {
next MODULE if !ref $Config->{$Key};
next MODULE if 'HASH' ne ref $Config->{$Key};
my $Data = $Config->{$Key}->{$Module};
TYPE:
for my $Type ( qw/Group GroupRo/ ) {
next TYPE if !ref $Data->{$Type};
GROUP:
for my $Group ( @{ $Data->{$Type} || [] } ) {
next GROUP if defined $Group && $Group ne '0' and $Group ne '';
say sprintf 'Please check attribute %s of SysConfig setting %s###%s: "%s" is not a valid Group', $Type, $Key, $Module, $Group;
}
}
}
}
$ perl CheckAdminNavBar.pl
Please check attribute Group of SysConfig setting Frontend::NavigationModule###AdminTicketTemplatesWorkflow: "0" is not a valid Group
$
@Fydon
Copy link

Fydon commented Jan 26, 2021

Thank you. On line 38 there is an e after the second %s before the hash.

@reneeb
Copy link
Author

reneeb commented Jan 26, 2021

Thanks. It's fixed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment