added a per-site config file option for international message caching
This commit is contained in:
parent
35ead8b39e
commit
3eec10dc49
11 changed files with 59 additions and 55 deletions
|
|
@ -77,8 +77,9 @@ webgui.
|
|||
to allow templates to be hidden from forms and/or management.
|
||||
- Added dTree menu to the navigation system
|
||||
(Thanks to Geir Landro, http://www.destroydrop.com)
|
||||
- Added Cool Menus to the navigation system. (Thanks to Thomas Bratili,
|
||||
- Added Cool Menus to the navigation system. (Thanks to Thomas Brattli,
|
||||
http://www.dhtmlcentral.com)
|
||||
- Added a config file option for per-site International message caching.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -82,8 +82,6 @@ Convert::ASN1........................Graham Barr
|
|||
|
||||
Data::Config.........................Sébastien Aperghis-Tramoni
|
||||
|
||||
HTML::CalendarMonthSimple............Gregor Mosheh
|
||||
|
||||
HTML::TagFilter......................William Ross
|
||||
|
||||
HTML::Template.......................Sam Tregar
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ save you many hours of grief.
|
|||
* WebGUI now requires the following Perl modules to be installed:
|
||||
Data::Serializer
|
||||
SOAP::Lite
|
||||
Cache::Cache (no longer optional)
|
||||
|
||||
WARNING: Be sure you install these modules BEFORE you attempt to
|
||||
upgrade or the upgrade will fail and you'll have a mess to
|
||||
|
|
@ -38,6 +39,7 @@ save you many hours of grief.
|
|||
variables.
|
||||
|
||||
|
||||
|
||||
5.5.0
|
||||
--------------------------------------------------------------------
|
||||
* If you have any custom Message Board templates they will be
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ QnD INSTALL INSTRUCTIONS:
|
|||
SOAP::Lite
|
||||
Data::Serializer
|
||||
Image::Magick (optional)
|
||||
Cache::Cache (optional)
|
||||
Cache::Cache
|
||||
|
||||
|
||||
3. Install Apache (preferably with mod_perl) and set up your config.
|
||||
|
|
|
|||
|
|
@ -500,6 +500,7 @@ push(@newWobjects,"WSClient");
|
|||
$conf->set("wobjects"=>\@newWobjects);
|
||||
$conf->set("emailRecoveryLoggingEnabled"=>1);
|
||||
$conf->set("passwordChangeLoggingEnabled"=>1);
|
||||
$conf->set("useSharedInternationalCache"=>1);
|
||||
$conf->write;
|
||||
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -12,6 +12,11 @@ extrasPath = /data/WebGUI/www/extras
|
|||
uploadsURL = /uploads
|
||||
uploadsPath = /data/WebGUI/www/uploads
|
||||
|
||||
useSharedInternationalCache = 1
|
||||
|
||||
emailRecoveryLoggingEnabled = 1
|
||||
passwordChangeLoggingEnabled = 1
|
||||
|
||||
authMethods = LDAP, WebGUI
|
||||
|
||||
wobjects = Article, EventsCalendar, FileManager, HttpProxy, \
|
||||
|
|
|
|||
|
|
@ -15,9 +15,7 @@ package WebGUI::Cache;
|
|||
=cut
|
||||
|
||||
|
||||
#Test to see if Cache::FileCache will load.
|
||||
my $hasCache=1;
|
||||
eval " use Cache::FileCache; "; $hasCache=0 if $@;
|
||||
use Cache::FileCache;
|
||||
|
||||
use HTTP::Headers;
|
||||
use HTTP::Request;
|
||||
|
|
@ -32,7 +30,7 @@ Package WebGUI::Cache
|
|||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This package provides a means for WebGUI to cache data to the filesystem. Caching is only enabled, however, if Cache::Filecache is installed on the system.
|
||||
This package provides a means for WebGUI to cache data to the filesystem.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
|
|
@ -45,11 +43,6 @@ These methods are available from this class:
|
|||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _canCache {
|
||||
return ($hasCache);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -61,11 +54,7 @@ Remove content from the filesystem cache.
|
|||
=cut
|
||||
|
||||
sub delete {
|
||||
if (_canCache()) {
|
||||
$_[0]->{_cache}->remove($_[0]->{_key});
|
||||
} else {
|
||||
$_[0]->{_cache} = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -86,16 +75,12 @@ A regular expression that will match keys in the current namespace. Example: m/^
|
|||
=cut
|
||||
|
||||
sub deleteByRegex {
|
||||
if (_canCache()) {
|
||||
my @keys = $_[0]->{_cache}->get_keys();
|
||||
foreach my $key (@keys) {
|
||||
if ($key =~ $_[1]) {
|
||||
$_[0]->{_cache}->remove($key);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$_[0]->{_cache} = "";
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -107,11 +92,7 @@ Retrieve content from the filesystem cache.
|
|||
=cut
|
||||
|
||||
sub get {
|
||||
if (_canCache()) {
|
||||
return $_[0]->{_cache}->get($_[0]->{_key});
|
||||
} else {
|
||||
return $_[0]->{_cache};
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -124,12 +105,8 @@ Retrieves an datastructure from the filesystem cache.
|
|||
|
||||
sub getDataStructure {
|
||||
my ($serializer);
|
||||
if (_canCache()) {
|
||||
$serializer = Data::Serializer->new(serializer => 'Storable');
|
||||
return $serializer->deserialize($_[0]->{_cache}->get($_[0]->{_key}));
|
||||
} else {
|
||||
return $_[0]->{_cache};
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -157,7 +134,7 @@ sub new {
|
|||
my $class = shift;
|
||||
my $key = shift;
|
||||
my $namespace = shift || $session{config}{configFile};
|
||||
$cache = new Cache::FileCache({namespace=>$namespace, auto_purge_on_set=>1}) if (_canCache());
|
||||
$cache = new Cache::FileCache({namespace=>$namespace, auto_purge_on_set=>1});
|
||||
bless {_cache => $cache, _key => $key}, $class;
|
||||
}
|
||||
|
||||
|
|
@ -184,11 +161,7 @@ The time to live for this content. This is the amount of time (in seconds) that
|
|||
|
||||
sub set {
|
||||
my $ttl = $_[2] || 60;
|
||||
if (_canCache()) {
|
||||
$_[0]->{_cache}->set($_[0]->{_key},$_[1],$ttl);
|
||||
} else {
|
||||
$_[0]->{_cache} = $_[1];
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -217,12 +190,8 @@ in the cache. Defaults to "60".
|
|||
|
||||
sub setDataStructure {
|
||||
my $ttl = $_[2] || 60;
|
||||
if (_canCache()) {
|
||||
$serializer = Data::Serializer->new(serializer => 'Storable');
|
||||
$_[0]->{_cache}->set($_[0]->{_key},$serializer->serialize($_[1]),$ttl);
|
||||
} else {
|
||||
$_[0]->{_cache} = $_[1];
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -80,7 +80,11 @@ sub get {
|
|||
} else {
|
||||
$namespace = "WebGUI";
|
||||
}
|
||||
$cache = WebGUI::Cache->new($language."_".$namespace."_".$_[0],"International");
|
||||
my $cachetag = $session{config}{configFile}."-International";
|
||||
if ($session{config}{useSharedInternationalCache}) {
|
||||
$cachetag = "International";
|
||||
}
|
||||
$cache = WebGUI::Cache->new($language."_".$namespace."_".$_[0],$cachetag);
|
||||
$output = $cache->get;
|
||||
if (not defined $output) {
|
||||
($output) = WebGUI::SQL->quickArray("select message from international
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Apache::Registry (); # Uncomment this for use with mod_perl 1.0
|
|||
#----------------------------------------
|
||||
# System controlled Perl modules.
|
||||
#----------------------------------------
|
||||
eval "use Cache::FileCache ();"; # eval, may not be installed
|
||||
use Cache::FileCache ();
|
||||
use CGI (); CGI->compile(':all');
|
||||
use CGI::Carp ();
|
||||
use CGI::Util ();
|
||||
|
|
@ -29,6 +29,8 @@ use FileHandle ();
|
|||
use Net::SMTP ();
|
||||
use POSIX ();
|
||||
use URI::Escape ();
|
||||
use Data::Serializer ();
|
||||
use SOAP::Lite ();
|
||||
|
||||
|
||||
#----------------------------------------
|
||||
|
|
|
|||
|
|
@ -187,23 +187,45 @@ if (eval { require Date::Calc }) {
|
|||
}
|
||||
}
|
||||
|
||||
print "Cache::FileCache module (optional*) ...... ";
|
||||
if (eval { require Cache::FileCache }) {
|
||||
print "Cache::Cache module ...................... ";
|
||||
if (eval { require Cache::Cache }) {
|
||||
print "OK\n";
|
||||
} else {
|
||||
print "Not installed. Caching not possible.\n";
|
||||
if ($< == 0 && $os eq "Linuxish") {
|
||||
print "Attempting to install...\n";
|
||||
CPAN::Shell->install("Cache::Cache");
|
||||
} else {
|
||||
print "Please install.\n";
|
||||
$prereq = 0;
|
||||
}
|
||||
}
|
||||
|
||||
print <<STOP;
|
||||
print "SOAP::Lite module ........................ ";
|
||||
if (eval { require SOAP::Lite }) {
|
||||
print "OK\n";
|
||||
} else {
|
||||
if ($< == 0 && $os eq "Linuxish") {
|
||||
print "Attempting to install...\n";
|
||||
CPAN::Shell->install("SOAP::Lite");
|
||||
} else {
|
||||
print "Please install.\n";
|
||||
$prereq = 0;
|
||||
}
|
||||
}
|
||||
|
||||
* Please note that Cache::FileCache is not
|
||||
optional in all environments (such as Mac
|
||||
OS X). Also note, that Cache::FileCache
|
||||
is not available for Windows style
|
||||
environments due to limitations on those
|
||||
systems.
|
||||
print "Data::Serializer module .................. ";
|
||||
if (eval { require Data::Serializer }) {
|
||||
print "OK\n";
|
||||
} else {
|
||||
if ($< == 0 && $os eq "Linuxish") {
|
||||
print "Attempting to install...\n";
|
||||
CPAN::Shell->install("Data::Serializer");
|
||||
} else {
|
||||
print "Please install.\n";
|
||||
$prereq = 0;
|
||||
}
|
||||
}
|
||||
|
||||
STOP
|
||||
|
||||
print "Image::Magick module (optional) .......... ";
|
||||
if (eval { require Image::Magick }) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue