[otrs-cvs] CVS: otrs/Kernel/System Config.pm,1.53,1.54

cvs-log at otrs.org cvs-log at otrs.org
Thu Oct 5 04:18:31 CEST 2006


Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv23674/Kernel/System

Modified Files:
	Config.pm 
Log Message:
added speed improvements

Index: Config.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/Config.pm,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -r1.53 -r1.54
*** Config.pm	18 Sep 2006 13:26:00 -0000	1.53
--- Config.pm	5 Oct 2006 01:18:28 -0000	1.54
***************
*** 70,74 ****
  
      # check needed objects
!     foreach (qw(DBObject ConfigObject LogObject)) {
          $Self->{$_} = $Param{$_} || die "Got no $_!";
      }
--- 70,74 ----
  
      # check needed objects
!     foreach (qw(DBObject ConfigObject LogObject TimeObject)) {
          $Self->{$_} = $Param{$_} || die "Got no $_!";
      }
***************
*** 458,462 ****
          $Level = 'Default';
      }
- #$Self->{LogObject}->Dumper(\%Param);
  
      if ($Self->{Config}->{$Param{Name}}) {
--- 458,461 ----
***************
*** 471,475 ****
          }
          # add current valid state
!         if (!$Param{Default} && !defined($Self->ModGet(ConfigName => $ConfigItem->{Name}))) {
              $ConfigItem->{Valid} = 0;
          }
--- 470,474 ----
          }
          # add current valid state
!         if (!$Param{Default} && !defined($Self->_ModGet(ConfigName => $ConfigItem->{Name}))) {
              $ConfigItem->{Valid} = 0;
          }
***************
*** 481,486 ****
              # fill default
              $ConfigItem->{Setting}->[1]->{String}->[1]->{Default} = $ConfigItem->{Setting}->[1]->{String}->[1]->{Content};
!             if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
!                 $ConfigItem->{Setting}->[1]->{String}->[1]->{Content} = $Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
              }
          }
--- 480,486 ----
              # fill default
              $ConfigItem->{Setting}->[1]->{String}->[1]->{Default} = $ConfigItem->{Setting}->[1]->{String}->[1]->{Content};
!             my $String = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($String)) {
!                 $ConfigItem->{Setting}->[1]->{String}->[1]->{Content} = $String;
              }
          }
***************
*** 488,493 ****
              # fill default
              $ConfigItem->{Setting}->[1]->{TextArea}->[1]->{Default} = $ConfigItem->{Setting}->[1]->{TextArea}->[1]->{Content};
!             if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
!                 $ConfigItem->{Setting}->[1]->{TextArea}->[1]->{Content} = $Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
              }
          }
--- 488,494 ----
              # fill default
              $ConfigItem->{Setting}->[1]->{TextArea}->[1]->{Default} = $ConfigItem->{Setting}->[1]->{TextArea}->[1]->{Content};
!             my $TextArea = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($TextArea)) {
!                 $ConfigItem->{Setting}->[1]->{TextArea}->[1]->{Content} = $TextArea;
              }
          }
***************
*** 495,504 ****
              # fill default
              $ConfigItem->{Setting}->[1]->{Option}->[1]->{Default} = $ConfigItem->{Setting}->[1]->{Option}->[1]->{SelectedID};
!             if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
!                 $ConfigItem->{Setting}->[1]->{Option}->[1]->{SelectedID} = $Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
              }
          }
          if ($ConfigItem->{Setting}->[1]->{Hash}) {
!            if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
                  my @Array = ();
                  if (ref($ConfigItem->{Setting}->[1]->{Hash}->[1]->{Item}) eq 'ARRAY') {
--- 496,507 ----
              # fill default
              $ConfigItem->{Setting}->[1]->{Option}->[1]->{Default} = $ConfigItem->{Setting}->[1]->{Option}->[1]->{SelectedID};
!             my $Option = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($Option)) {
!                 $ConfigItem->{Setting}->[1]->{Option}->[1]->{SelectedID} = $Option;
              }
          }
          if ($ConfigItem->{Setting}->[1]->{Hash}) {
!             my $HashRef = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($HashRef)) {
                  my @Array = ();
                  if (ref($ConfigItem->{Setting}->[1]->{Hash}->[1]->{Item}) eq 'ARRAY') {
***************
*** 506,510 ****
                  }
                  @{$ConfigItem->{Setting}->[1]->{Hash}->[1]->{Item}} = (undef);
!                 my %Hash = %{$Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level)};
                  foreach my $Key (sort keys %Hash) {
                     if (ref($Hash{$Key}) eq 'ARRAY') {
--- 509,513 ----
                  }
                  @{$ConfigItem->{Setting}->[1]->{Hash}->[1]->{Item}} = (undef);
!                 my %Hash = %{$HashRef};
                  foreach my $Key (sort keys %Hash) {
                     if (ref($Hash{$Key}) eq 'ARRAY') {
***************
*** 560,566 ****
          }
          if ($ConfigItem->{Setting}->[1]->{Array}) {
!             if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
                  @{$ConfigItem->{Setting}->[1]->{Array}->[1]->{Item}} = (undef);
!                 my @Array = @{$Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level)};
                  foreach my $Key (@Array) {
                      push (@{$ConfigItem->{Setting}->[1]->{Array}->[1]->{Item}}, {
--- 563,570 ----
          }
          if ($ConfigItem->{Setting}->[1]->{Array}) {
!             my $ArrayRef = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($ArrayRef)) {
                  @{$ConfigItem->{Setting}->[1]->{Array}->[1]->{Item}} = (undef);
!                 my @Array = @{$ArrayRef};
                  foreach my $Key (@Array) {
                      push (@{$ConfigItem->{Setting}->[1]->{Array}->[1]->{Item}}, {
***************
*** 572,578 ****
          }
          if ($ConfigItem->{Setting}->[1]->{FrontendModuleReg}) {
!              if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
                  @{$ConfigItem->{Setting}->[1]->{FrontendModuleReg}} = (undef);
!                 my %Hash = %{$Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level)};
                  foreach my $Key (sort keys %Hash) {
                      @{$ConfigItem->{Setting}->[1]->{FrontendModuleReg}->[1]->{$Key}} = (undef);
--- 576,583 ----
          }
          if ($ConfigItem->{Setting}->[1]->{FrontendModuleReg}) {
!             my $HashRef = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($HashRef)) {
                  @{$ConfigItem->{Setting}->[1]->{FrontendModuleReg}} = (undef);
!                 my %Hash = %{$HashRef};
                  foreach my $Key (sort keys %Hash) {
                      @{$ConfigItem->{Setting}->[1]->{FrontendModuleReg}->[1]->{$Key}} = (undef);
***************
*** 631,637 ****
          }
          if ($ConfigItem->{Setting}->[1]->{TimeWorkingHours}) {
!             if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
                  @{$ConfigItem->{Setting}->[1]->{TimeWorkingHours}->[1]->{Day}} = (undef);
!                 my %Days = %{$Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level)};
                  foreach my $Day (keys %Days) {
                      my @Array = (undef);
--- 636,643 ----
          }
          if ($ConfigItem->{Setting}->[1]->{TimeWorkingHours}) {
!             my $DaysRef = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($DaysRef)) {
                  @{$ConfigItem->{Setting}->[1]->{TimeWorkingHours}->[1]->{Day}} = (undef);
!                 my %Days = %{$DaysRef};
                  foreach my $Day (keys %Days) {
                      my @Array = (undef);
***************
*** 648,654 ****
          }
          if ($ConfigItem->{Setting}->[1]->{TimeVacationDays}) {
!             if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
                  @{$ConfigItem->{Setting}->[1]->{TimeVacationDays}->[1]->{Item}} = (undef);
!                 my %Hash = %{$Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level)};
                  foreach my $Month (sort {$a <=> $b} keys %Hash) {
  
--- 654,661 ----
          }
          if ($ConfigItem->{Setting}->[1]->{TimeVacationDays}) {
!             my $HashRef = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($HashRef)) {
                  @{$ConfigItem->{Setting}->[1]->{TimeVacationDays}->[1]->{Item}} = (undef);
!                 my %Hash = %{$HashRef};
                  foreach my $Month (sort {$a <=> $b} keys %Hash) {
  
***************
*** 669,675 ****
          }
          if ($ConfigItem->{Setting}->[1]->{TimeVacationDaysOneTime}) {
!             if (!$Param{Default} && defined($Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level))) {
                  @{$ConfigItem->{Setting}->[1]->{TimeVacationDaysOneTime}->[1]->{Item}} = (undef);
!                 my %Hash = %{$Self->ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level)};
                  foreach my $Year (sort {$a <=> $b} keys %Hash) {
                      my %Months = %{$Hash{$Year}};
--- 676,683 ----
          }
          if ($ConfigItem->{Setting}->[1]->{TimeVacationDaysOneTime}) {
!             my $HashRef = $Self->_ModGet(ConfigName => $ConfigItem->{Name}, Level => $Level);
!             if (!$Param{Default} && defined($HashRef)) {
                  @{$ConfigItem->{Setting}->[1]->{TimeVacationDaysOneTime}->[1]->{Item}} = (undef);
!                 my %Hash = %{$HashRef};
                  foreach my $Year (sort {$a <=> $b} keys %Hash) {
                      my %Months = %{$Hash{$Year}};
***************
*** 858,878 ****
          }
      }
!     my @List = ();
!     my %Used = ();
!     foreach my $ConfigItem (@{$Self->{XMLConfig}}) {
!         my $Name = $ConfigItem->{Name};
!         if ($ConfigItem->{Group} && ref($ConfigItem->{Group}) eq 'ARRAY') {
!             my $Hit = 0;
!             foreach my $Group (@{$ConfigItem->{Group}}) {
!                 if ($Group->{Content} && $Group->{Content} eq $Param{Group}) {
!                     $Hit = 1;
!                 }
!             }
!             if ($Hit) {
!                 if ($ConfigItem->{SubGroup} && ref($ConfigItem->{SubGroup}) eq 'ARRAY') {
!                     foreach my $SubGroup (@{$ConfigItem->{SubGroup}}) {
!                         if (!$Used{$ConfigItem->{Name}} && $SubGroup->{Content} && $SubGroup->{Content} eq $Param{SubGroup}) {
!                             $Used{$ConfigItem->{Name}} = 1;
!                             push (@List, $ConfigItem->{Name});
                          }
                      }
--- 866,885 ----
          }
      }
!     my %Data = ();
!     if ($Self->{'Cache::ConfigSubGroupConfigItemList'}) {
!         %Data = %{$Self->{'Cache::ConfigSubGroupConfigItemList'}};
!     }
!     else {
!         foreach my $ConfigItem (@{$Self->{XMLConfig}}) {
!             my %Used = ();
!             my $Name = $ConfigItem->{Name};
!             if ($ConfigItem->{Group} && ref($ConfigItem->{Group}) eq 'ARRAY') {
!                 foreach my $Group (@{$ConfigItem->{Group}}) {
!                     if ($Group && $ConfigItem->{SubGroup} && ref($ConfigItem->{SubGroup}) eq 'ARRAY') {
!                         foreach my $SubGroup (@{$ConfigItem->{SubGroup}}) {
!                             if (!$Used{$ConfigItem->{Name}} && $SubGroup->{Content} && $Group->{Content}) {
!                                 $Used{$ConfigItem->{Name}} = 1;
!                                 push (@{$Data{$Group->{Content}.'::'.$SubGroup->{Content}}},$ConfigItem->{Name});
!                             }
                          }
                      }
***************
*** 880,888 ****
              }
          }
      }
-     return @List;
  }
  
! sub ModGet {
      my $Self = shift;
      my %Param = @_;
--- 887,901 ----
              }
          }
+         $Self->{'Cache::ConfigSubGroupConfigItemList'} = \%Data;
+     }
+     if ($Data{$Param{Group}.'::'.$Param{SubGroup}}) {
+         return @{$Data{$Param{Group}.'::'.$Param{SubGroup}}};
+     }
+     else {
+         return ();
      }
  }
  
! sub _ModGet {
      my $Self = shift;
      my %Param = @_;
***************
*** 1232,1235 ****
--- 1245,1249 ----
      return $Data;
  }
+ 
  sub DESTROY {
      my $Self = shift;
***************
*** 1242,1246 ****
  }
  
- 
  1;
  
--- 1256,1259 ----



More information about the cvs-log mailing list