From a7504f380a264fa8da3cbab36bee8efd9fcf6295 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 30 May 2007 18:34:25 +0000 Subject: [PATCH] removed memcached support added check for new modules --- docs/changelog/7.x.x.txt | 2 + docs/gotcha.txt | 4 + lib/WebGUI/Cache.pm | 5 +- lib/WebGUI/Cache/Memcached.pm | 194 ---------------------------------- sbin/preload.exclude.example | 1 - sbin/testEnvironment.pl | 3 +- 6 files changed, 9 insertions(+), 200 deletions(-) delete mode 100644 lib/WebGUI/Cache/Memcached.pm diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 6db49ea48..8160ad6e9 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -19,6 +19,8 @@ queries for groupIds by userId (instead of the usual userIds by groupId) - fix: bad javascript string escaping in EMS - fix: Unable to upload images or edit listings for Matrix + - Added import/export mechanism for EMS events. + - Removed the long depricated Memcached cache module. 7.3.19 diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 025303c8b..99c76c467 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -22,6 +22,10 @@ save you many hours of grief. the userProfileData table will need to be updated to reflect these changes. + * WebGUI now requires the following additional perl modules to operate: + Config::JSON + Text::CSV_XS + 7.3.16 -------------------------------------------------------------------- diff --git a/lib/WebGUI/Cache.pm b/lib/WebGUI/Cache.pm index 4b3b9b778..a0b632646 100644 --- a/lib/WebGUI/Cache.pm +++ b/lib/WebGUI/Cache.pm @@ -118,10 +118,7 @@ sub new { my $cache; my $class = shift; my $session = shift; - if ($session->config->get("cacheType") eq "WebGUI::Cache::Memcached" && $session->config->get("memcached_servers")) { - require WebGUI::Cache::Memcached; - return WebGUI::Cache::Memcached->new($session,@_); - } elsif ($session->config->get("cacheType") eq "WebGUI::Cache::Database") { + if ($session->config->get("cacheType") eq "WebGUI::Cache::Database") { require WebGUI::Cache::Database; return WebGUI::Cache::Database->new($session,@_); } else { diff --git a/lib/WebGUI/Cache/Memcached.pm b/lib/WebGUI/Cache/Memcached.pm deleted file mode 100644 index 71fc681e4..000000000 --- a/lib/WebGUI/Cache/Memcached.pm +++ /dev/null @@ -1,194 +0,0 @@ -package WebGUI::Cache::Memcached; - -=head1 LEGAL - - ------------------------------------------------------------------- - WebGUI is Copyright 2001-2006 Plain Black Corporation. - ------------------------------------------------------------------- - Please read the legal notices (docs/legal.txt) and the license - (docs/license.txt) that came with this distribution before using - this software. - ------------------------------------------------------------------- - http://www.plainblack.com info@plainblack.com - ------------------------------------------------------------------- - -=cut - -use Cache::Memcached; -use Digest::MD5; - -our @ISA = qw(WebGUI::Cache); - -=head1 NAME - -Package WebGUI::Cache::Memcached - -=head1 DESCRIPTION - -This package provides an interface to the memcached distributed caching system. -See http://www.danga.com/memcached/ for more details on memcached. - -=head1 SYNOPSIS - - use WebGUI::Cache::Memcached; - -=head1 METHODS - -These methods are available from this class: - -=cut - - - - -#------------------------------------------------------------------- - -=head2 delete ( ) - -Deletes a key of the Memcached system. - -=cut - -sub delete { - $_[0]->{_cache}->delete($_[0]->{_key}); -} - - -#------------------------------------------------------------------- - -=head2 flush ( ) - -Flushes the Memcached system. - -=cut - -sub flush { - my $self = shift; - $self->SUPER::flush(); - my $memd = $self->{_cache}; - my $succes = 1; - $memd->init_buckets() unless $memd->{'buckets'}; - my @hosts = @{$memd->{'buckets'}}; - foreach my $host (@hosts) { - my $sock = $memd->sock_to_host($host); - my @res = $memd->run_command($sock, "flush_all\r\n"); - $success = 0 unless (@res); - # Reset stats - $memd->run_command($sock, "stats reset\r\n"); - } - return $success; -} - -#------------------------------------------------------------------- - -=head2 get ( ) - -Retrieve content from the filesystem cache. - -=cut - -sub get { - return undef if ($_[0]->session->get("disableCache")); - return $_[0]->{_cache}->get($_[0]->{_key}); -} - -#------------------------------------------------------------------- - -=head2 new ( session, key [, namespace ] ) - -Constructor. - -=head3 session - -A reference to the current session. - -=head3 key - -A key unique to this namespace. It is used to uniquely identify the cached content. - -=head3 namespace - -Defaults to the config filename for the current site. The only reason to override the default is if you want the cached content to be shared among all WebGUI instances on this machine. A common alternative namespace is "URL", which is typically used when caching content using the setByHTTP method. - -=cut - -sub new { - my $cache; - my $class = shift; - my $session = shift; - my $key = $class->parseKey(shift); - my $namespace = shift || $session->config->getFilename; - - # Overcome maximum key length of 255 characters - if(length($key.$namespace) > 255) { - $key = Digest::MD5::md5_base64($key); - } - - my $servers = $session->config->get("memcached_servers"); - $servers = [ $servers ] unless (ref $servers); - - my %options = ( - namespace=>$namespace, - servers=>$servers - ); - - $cache = new Cache::Memcached(\%options); - bless {_session=>$session, _cache => $cache, _key => $key}, $class; -} - - -#------------------------------------------------------------------- - -=head2 set ( content [, ttl ] ) - -Save content to the filesystem cache. - -=head3 content - -A scalar variable containing the content to be set. - -=head3 ttl - -The time to live for this content. This is the amount of time (in seconds) that the content will remain in the cache. Defaults to "60". - -=cut - -sub set { - my $ttl = $_[2] || 60; - $_[0]->{_cache}->set($_[0]->{_key},$_[1],$ttl); -} - - -#------------------------------------------------------------------- - -=head2 stats ( ) - -Returns statistic information about the caching system. - -=cut - -sub stats { - my $self = shift; - my $output; - my $memd = $self->{_cache}; - # There's a bug in the Cache::Memcached->stats function that - # only returns the first row of statistic data. - # That's why we issue the stats command ourselve. - $memd->init_buckets() unless $memd->{'buckets'}; - my @hosts = @{$memd->{'buckets'}}; - foreach my $host (@hosts) { - $output .= "HOST: $host\n"; - my $sock = $memd->sock_to_host($host); - my @res = $memd->run_command($sock, "stats\r\n"); - $output .= join("",@res)."\n\n"; - $output =~ s/STAT/ /g; - $output =~ s/END*//g; - } - return $output; -} - - - -1; - - diff --git a/sbin/preload.exclude.example b/sbin/preload.exclude.example index 1a910bbd1..c97f18d54 100644 --- a/sbin/preload.exclude.example +++ b/sbin/preload.exclude.example @@ -1,4 +1,3 @@ -WebGUI::Cache::Memcached WebGUI::Cache::Database WebGUI::Auth::LDAP WebGUI::Asset::Wobject::WSClient diff --git a/sbin/testEnvironment.pl b/sbin/testEnvironment.pl index d75a936e5..7a0eeb07a 100644 --- a/sbin/testEnvironment.pl +++ b/sbin/testEnvironment.pl @@ -104,6 +104,8 @@ checkModule("HTML::Template::Expr",0.05,2); checkModule("Parse::PlainConfig",1.1); checkModule("XML::RSSLite",0.11); checkModule("JSON",0.991); +checkModule("Config::JSON","1.0.3"); +checkModule("Text::CSV_XS","0.26"); checkModule("Net::Subnets",0.21); checkModule("Finance::Quote",1.08); checkModule("POE",0.3202); @@ -111,7 +113,6 @@ checkModule("POE::Component::IKC::Server",0.18); checkModule("POE::Component::Client::HTTP", 0.77); checkModule("Data::Structure::Util",0.11); checkModule("Apache2::Request",2.06); -checkModule("Cache::Memcached",1.15,2); checkModule("URI::Escape","3.28"); checkModule("POSIX"); checkModule("List::Util");