[Rt-commit] rt branch, 5.0/lifecycle-ui, updated. rt-5.0.0alpha1-117-g85f9244c50

? sunnavy sunnavy at bestpractical.com
Tue Apr 28 13:34:54 EDT 2020


The branch, 5.0/lifecycle-ui has been updated
       via  85f9244c50488da0868779f98791a5af8d7b0116 (commit)
      from  89d3a490f07debbc5214be6385094433e7a75cc9 (commit)

Summary of changes:
 lib/RT/Config.pm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 85f9244c50488da0868779f98791a5af8d7b0116
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Apr 29 01:18:41 2020 +0800

    Add file configs as fallbacks for hash database configs
    
    For hash configs, previously we dropped file configs when corresponding
    db ones exist, to avoid file configs from shadowing db ones. It is
    acutally incorrect.
    
    Considering that we updated %Lifecycles in db config and then installed
    RT::IR. Since %Lifecycles in db config doesn't contain new lifecycles
    set in RTIR_Config.pm, those new RTIR lifecycles will never take effect.
    
    This commit adds file configs back as fallbacks, to fix the above issue.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 9dc3c1e0e3..0de3a848f5 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -2615,16 +2615,17 @@ sub LoadConfigFromDatabase {
 
         my $type = $meta->{Type} || 'SCALAR';
 
-        # hashes combine, but we don't want that behavior because the previous
-        # config settings will shadow any change that the database config makes
-        if ($type eq 'HASH') {
-            $self->Set($name, ());
-        }
-
         my $val = $type eq 'ARRAY' ? $value
                 : $type eq 'HASH'  ? [ %$value ]
                                    : [ $value ];
 
+        # hashes combine, but by default previous config settings shadow
+        # later changes, here we want database configs to shadow file ones.
+        if ($type eq 'HASH') {
+            $val = [ $self->Get($name), @$val ];
+            $self->Set($name, ());
+        }
+
         $self->SetFromConfig(
             Option     => \$name,
             Value      => $val,

-----------------------------------------------------------------------


More information about the rt-commit mailing list