- Added a 2.7% speed increase by precaching i18n messages. This should also

help increase shared memory amongst Apache children. (Matt Wilson)
This commit is contained in:
JT Smith 2006-05-16 16:47:09 +00:00
parent 746a916d4f
commit 4748163231
3 changed files with 24 additions and 5 deletions

View file

@ -17,9 +17,13 @@
- fix [ 1486788 ] karma isn't working on forums
- fix [ 1489094 ] DataForm Record edit link wrong for list mode (Michelle LaMar)
- fix [ 1488663 ] Add new subscription broken (Martin Kamerbeek / Procolix)
- Added a 2.7% speed increase by precaching i18n messages. This should also
help increase shared memory amongst Apache children. (Matt Wilson)
- fix [ 1488921 ] Help: Commerce, Manage
6.99.0
- Added an Events Management System asset that can help people run
conferences, conventions, and large meetings.
- Added a workflow system.
- Added a workflow scheduler system.
- Converted the runHourly.pl scripts to run as scheduled workflows.

View file

@ -17,7 +17,7 @@ package WebGUI::International;
use strict qw(vars subs);
our %l10nCache;
our %i18nCache;
=head1 NAME
@ -95,7 +95,7 @@ sub get {
$id =~ s/$safeRe//g;
$language =~ s/$safeRe//g;
$namespace =~ s/$safeRe//g;
return $l10nCache{$language}{$namespace}{$id} if $l10nCache{$language}{$namespace}{$id};
return $i18nCache{$language}{$namespace}{$id}{message} if $i18nCache{$language}{$namespace}{$id}{message};
my $cmd = "WebGUI::i18n::".$language."::".$namespace;
my $load = "use ".$cmd;
eval($load);
@ -104,7 +104,7 @@ sub get {
my $output = eval($cmd);
$self->session->errorHandler->warn("Couldn't get value from ".$cmd." because ".$@) if ($@);
$output = $self->get($id,$namespace,"English") if ($output eq "" && $language ne "English");
$l10nCache{$language}{$namespace}{$id} = $output;
$i18nCache{$language}{$namespace}{$id}{message} = $output;
return $output;
}
@ -225,13 +225,13 @@ Specify a default language. Defaults to user preference or "English".
sub new {
my ($class, $session, $namespace, $language) = @_;
return $l10nCache{namespaces}{$namespace} if $l10nCache{namespaces}{$namespace};
return $i18nCache{namespaces}{$namespace} if $i18nCache{namespaces}{$namespace};
my $self = bless( {
_session => $session,
_namespace => $namespace,
_language => ($language || $session->user->profileField('language')),
},$class);
$l10nCache{namespaces}{$namespace} = $self;
$i18nCache{namespaces}{$namespace} = $self;
return $self;
}

View file

@ -55,6 +55,21 @@ use Apache2::ServerUtil ();
Apache2::ServerUtil->server->add_version_component("WebGUI/".$WebGUI::VERSION);
#----------------------------------------
# Precache i18n
#----------------------------------------
opendir(DIR,$webguiRoot."/lib/WebGUI/i18n/English");
my @files = readdir(DIR);
closedir(DIR);
foreach my $file (@files) {
if ($file =~ /^(\w+)\.pm$/) {
my $namespace = $1;
my $cmd = "\$WebGUI::i18n::English::".$namespace."::I18N";
my $data = eval($cmd);
$WebGUI::International::i18nCache{English}{$namespace} = $data;
}
}
#----------------------------------------
# Preload all site configs.
#----------------------------------------