From 20b2870a3f8ac393562ee2b42c381330ebd334b2 Mon Sep 17 00:00:00 2001 From: erickson Date: Wed, 25 Apr 2007 21:05:06 +0000 Subject: [PATCH] added ability to turn on/off added content lookups via memcache key git-svn-id: svn://svn.open-ils.org/ILS/trunk@7172 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/WWW/AddedContent.pm | 10 +++++++ Open-ILS/src/support-scripts/ac_ctl.pl | 27 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 Open-ILS/src/support-scripts/ac_ctl.pl diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent.pm b/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent.pm index 49beceb919..b7b94f18c0 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/AddedContent.pm @@ -31,6 +31,7 @@ sub import { my $net_timeout; +my $cache; sub child_init { OpenSRF::System->bootstrap_client( config_file => $bs_config ); @@ -40,6 +41,8 @@ sub child_init { return unless $ac_data; + $cache = OpenSRF::Utils::Cache->new; + my $ac_handler = $ac_data->{module}; $net_timeout = $ac_data->{timeout} || 3; @@ -68,6 +71,13 @@ sub handler { child_init() unless $handler; # why isn't apache doing this for us? return Apache2::Const::NOT_FOUND unless $handler; + # if this memcache key is set, added content lookups are disabled + if( $cache->get_cache('ac.no_lookup') ) { + $logger->info("added content lookup disabled"); + return Apache2::Const::NOT_FOUND; + } + + my( undef, $data, $format, $key ) = split(/\//, $r->path_info); my $err; diff --git a/Open-ILS/src/support-scripts/ac_ctl.pl b/Open-ILS/src/support-scripts/ac_ctl.pl new file mode 100755 index 0000000000..3b260b8450 --- /dev/null +++ b/Open-ILS/src/support-scripts/ac_ctl.pl @@ -0,0 +1,27 @@ +#!/usr/bin/perl +use strict; use warnings; + +use OpenSRF::AppSession; +use OpenSRF::System; +use OpenSRF::Utils::SettingsClient; +use OpenSRF::Utils::Cache; + +my $config = shift; +my $command = shift; +die < [enable|disable] + +USAGE + unless $command; + +OpenSRF::System->bootstrap_client(config_file => $config); + +my $cache = OpenSRF::Utils::Cache->new; +$cache->put_cache('ac.no_lookup', 1) if $command eq 'disable'; +$cache->delete_cache('ac.no_lookup') if $command eq 'enable'; + + -- 2.43.2