[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-288-g1a79e58

Ruslan Zakirov ruz at bestpractical.com
Fri Mar 26 10:25:09 EDT 2010


The branch, 3.8-trunk has been updated
       via  1a79e58bad3b7cc4a91e16b7554c9474e18648dc (commit)
       via  21f181dd3080fe145c223381b4d1438167c9be32 (commit)
       via  9e409174445910dac1ed1e512013c7bd68cfb139 (commit)
       via  0a95c85de9a3f45a57e6279e70bb175f5661cbaa (commit)
      from  1a39d6f96a221c2507319f932101c720a7a732c7 (commit)

Summary of changes:
 bin/fastcgi_server.in   |    1 +
 bin/standalone_httpd.in |    2 +-
 bin/webmux.pl.in        |    3 +++
 etc/RT_Config.pm.in     |    2 +-
 lib/RT.pm.in            |   21 +++++++++++++++++++++
 lib/RT/I18N.pm          |   16 ++++++++++++++++
 6 files changed, 43 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit 0a95c85de9a3f45a57e6279e70bb175f5661cbaa
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Mar 26 17:01:59 2010 +0300

    drop default value of RTAddressRegexp option

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index e1d7917..24fdc4e 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -286,7 +286,7 @@ avoid sending mail to itself.  It will also hide RT addresses from the list of
 
 =cut
 
-Set($RTAddressRegexp , '^rt\@example.com$');
+Set($RTAddressRegexp , undef);
 
 =item C<$CanonicalizeEmailAddressMatch>, C<$CanonicalizeEmailAddressReplace>
 

commit 9e409174445910dac1ed1e512013c7bd68cfb139
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Mar 26 17:03:17 2010 +0300

    RT::I18N::LoadLexicons function that forces parsing and unties

diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index aa13c67..2206b51 100755
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -128,6 +128,22 @@ sub Init {
     return 1;
 }
 
+sub LoadLexicons {
+
+    no strict 'refs';
+    foreach my $k (keys %{RT::I18N::} ) {
+        next if $k eq 'main::';
+        next unless index($k, '::', -2) >= 0;
+        next unless exists ${ 'RT::I18N::'. $k }{'Lexicon'};
+
+        my $lex = *{ ${'RT::I18N::'. $k }{'Lexicon'} }{HASH};
+        # run fetch to force load
+        my $tmp = $lex->{'foo'};
+        # untie that has to lower fetch impact
+        untie %$lex if tied %$lex;
+    }
+}
+
 =head2 encoding
 
 Returns the encoding of the current lexicon, as yanked out of __ContentType's "charset" field.

commit 21f181dd3080fe145c223381b4d1438167c9be32
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Mar 26 17:04:40 2010 +0300

    Heavy argument in RT::InitClasses - load more if true
    
    * load scrips' modules
    * load custom fields' source classes
    * load all trnslations and parse them

diff --git a/lib/RT.pm.in b/lib/RT.pm.in
index 9ada958..1cf2443 100755
--- a/lib/RT.pm.in
+++ b/lib/RT.pm.in
@@ -425,6 +425,8 @@ Load all modules that define base classes.
 =cut
 
 sub InitClasses {
+    shift if @_%2; # so we can call it as a function or method
+    my %args = (@_);
     require RT::Tickets;
     require RT::Transactions;
     require RT::Attachments;
@@ -469,6 +471,25 @@ sub InitClasses {
         RT::ObjectCustomFieldValue
         RT::Attribute
     );
+
+    if ( $args{'Heavy'} ) {
+        # load scrips' modules
+        my $scrips = RT::Scrips->new($RT::SystemUser);
+        $scrips->Limit( FIELD => 'Stage', OPERATOR => '!=', VALUE => 'Disabled' );
+        while ( my $scrip = $scrips->Next ) {
+            $scrip->LoadModules;
+        }
+
+	foreach my $class ( grep $_, RT->Config->Get('CustomFieldValuesSources') ) {
+            local $@;
+            eval "require $class; 1" or $RT::Logger->error(
+                "Class '$class' is listed in CustomFieldValuesSources option"
+                ." in the config, but we failed to load it:\n$@\n"
+            );
+        }
+
+        RT::I18N->LoadLexicons;
+    }
 }
 
 =head2 InitSystemObjects

commit 1a79e58bad3b7cc4a91e16b7554c9474e18648dc
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Mar 26 17:20:02 2010 +0300

    use heavy load in forking web handlers

diff --git a/bin/fastcgi_server.in b/bin/fastcgi_server.in
index 522320c..a637144 100644
--- a/bin/fastcgi_server.in
+++ b/bin/fastcgi_server.in
@@ -195,6 +195,7 @@ if ( $opt{'help'} ) {
     );
 }
 
+$ENV{'RT_WEBMUX_HEAVY_LOAD'} = 1;
 use File::Basename;
 require (dirname(__FILE__) .'/webmux.pl');
 
diff --git a/bin/standalone_httpd.in b/bin/standalone_httpd.in
index b87a332..aa9204b 100755
--- a/bin/standalone_httpd.in
+++ b/bin/standalone_httpd.in
@@ -120,7 +120,7 @@ EOF
 } else {
     RT->ConnectToDatabase();
     RT->InitSystemObjects();
-    RT->InitClasses();
+    RT->InitClasses( Heavy => 1 );
     RT->InitPlugins();
     RT->Config->PostLoadCheck();
 
diff --git a/bin/webmux.pl.in b/bin/webmux.pl.in
index 1e62f52..50b959a 100755
--- a/bin/webmux.pl.in
+++ b/bin/webmux.pl.in
@@ -152,6 +152,9 @@ $RT::Mason::Handler = RT::Interface::Web::Handler->new(
     RT->Config->Get('MasonParameters')
 );
 
+# load more for mod_perl before forking
+RT::InitClasses( Heavy => 1 ) if $ENV{'MOD_PERL'} || $ENV{RT_WEBMUX_HEAVY_LOAD};
+
 # we must disconnect DB before fork
 $RT::Handle->dbh(undef);
 undef $RT::Handle;

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


More information about the Rt-commit mailing list