mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-25 04:02:37 +01:00
Do not override pre-existing registry with default values
This commit is contained in:
parent
0d70d85506
commit
b4e8302f32
@ -74,6 +74,10 @@ sub add {
|
|||||||
$section = lc $section;
|
$section = lc $section;
|
||||||
$item = lc $item;
|
$item = lc $item;
|
||||||
|
|
||||||
|
if ($is_default) {
|
||||||
|
return if exists $self->{registry}->hash->{$section} and exists $self->{registry}->hash->{$section}->{$item};
|
||||||
|
}
|
||||||
|
|
||||||
$self->{registry}->hash->{$section}->{$item}->{value} = $value;
|
$self->{registry}->hash->{$section}->{$item}->{value} = $value;
|
||||||
$self->{registry}->hash->{$section}->{$item}->{type} = $type;
|
$self->{registry}->hash->{$section}->{$item}->{type} = $type;
|
||||||
|
|
||||||
@ -108,6 +112,12 @@ sub set {
|
|||||||
$item = lc $item;
|
$item = lc $item;
|
||||||
$key = lc $key if defined $key;
|
$key = lc $key if defined $key;
|
||||||
|
|
||||||
|
if ($is_default) {
|
||||||
|
return if exists $self->{registry}->hash->{$section}
|
||||||
|
and exists $self->{registry}->hash->{$section}->{$item}
|
||||||
|
and exists $self->{registry}->hash->{$section}->{$item}->{$key};
|
||||||
|
}
|
||||||
|
|
||||||
my $oldvalue = $self->get_value($section, $item, 1) if defined $value;
|
my $oldvalue = $self->get_value($section, $item, 1) if defined $value;
|
||||||
$oldvalue = '' if not defined $oldvalue;
|
$oldvalue = '' if not defined $oldvalue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user