freeside/FS/FS/ClientAPI MyAccount.pm,1.33,1.34 Signup.pm,1.20,1.21 Agent.pm,1.5,1.6
ivan
ivan at pouncequick.420.am
Tue Feb 8 12:22:51 PST 2005
- Previous message: freeside/FS/FS clientapi_session.pm,NONE,1.1 clientapi_session_field.pm,NONE,1.1 ClientAPI_SessionCache.pm,NONE,1.1 Conf.pm,1.119,1.120
- Next message: freeside/FS FS.pm,1.28,1.29 MANIFEST,1.81,1.82
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/ClientAPI
In directory pouncequick:/tmp/cvs-serv9349/FS/FS/ClientAPI
Modified Files:
MyAccount.pm Signup.pm Agent.pm
Log Message:
make self-service session cache module configurable, start framework for in-database session cache
Index: Signup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/Signup.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- Signup.pm 5 Feb 2005 23:39:43 -0000 1.20
+++ Signup.pm 8 Feb 2005 20:22:46 -0000 1.21
@@ -5,6 +5,7 @@
use FS::Conf;
use FS::Record qw(qsearch qsearchs dbdef);
use FS::Msgcat qw(gettext);
+use FS::ClientAPI_SessionCache;
use FS::agent;
use FS::cust_main_county;
use FS::part_pkg;
@@ -88,7 +89,7 @@
my $session = '';
if ( exists $packet->{'session_id'} ) {
- my $cache = new Cache::SharedMemoryCache( {
+ my $cache = new FS::ClientAPI_SessionCache( {
'namespace' => 'FS::ClientAPI::Agent',
} );
$session = $cache->get($packet->{'session_id'});
@@ -164,7 +165,7 @@
my $agentnum;
if ( exists $packet->{'session_id'} ) {
- my $cache = new Cache::SharedMemoryCache( {
+ my $cache = new FS::ClientAPI_SessionCache( {
'namespace' => 'FS::ClientAPI::Agent',
} );
my $session = $cache->get($packet->{'session_id'});
Index: MyAccount.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/MyAccount.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- MyAccount.pm 5 Feb 2005 23:39:43 -0000 1.33
+++ MyAccount.pm 8 Feb 2005 20:22:46 -0000 1.34
@@ -2,14 +2,15 @@
use strict;
use vars qw($cache);
+use subs qw(_cache);
use Digest::MD5 qw(md5_hex);
use Date::Format;
use Business::CreditCard;
-use Cache::SharedMemoryCache; #store in db?
use FS::CGI qw(small_custview); #doh
use FS::Conf;
use FS::Record qw(qsearch qsearchs);
use FS::Msgcat qw(gettext);
+use FS::ClientAPI_SessionCache;
use FS::svc_acct;
use FS::svc_domain;
use FS::svc_external;
@@ -30,10 +31,11 @@
use subs qw(_provision);
-#store in db?
-my $cache = new Cache::SharedMemoryCache( {
- 'namespace' => 'FS::ClientAPI::MyAccount',
-} );
+sub _cache {
+ $cache ||= new FS::ClientAPI_SessionCache( {
+ 'namespace' => 'FS::ClientAPI::MyAccount',
+ } );
+}
#false laziness w/FS::ClientAPI::passwd::passwd
sub login {
@@ -69,9 +71,9 @@
my $session_id;
do {
$session_id = md5_hex(md5_hex(time(). {}. rand(). $$))
- } until ( ! defined $cache->get($session_id) ); #just in case
+ } until ( ! defined _cache->get($session_id) ); #just in case
- $cache->set( $session_id, $session, '1 hour' );
+ _cache->set( $session_id, $session, '1 hour' );
return { 'error' => '',
'session_id' => $session_id,
@@ -81,7 +83,7 @@
sub logout {
my $p = shift;
if ( $p->{'session_id'} ) {
- $cache->remove($p->{'session_id'});
+ _cache->remove($p->{'session_id'});
return { 'error' => '' };
} else {
return { 'error' => "Can't resume session" }; #better error message
@@ -150,7 +152,7 @@
sub edit_info {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
my $custnum = $session->{'custnum'}
@@ -190,7 +192,7 @@
sub payment_info {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
##
@@ -267,7 +269,7 @@
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
my %return;
@@ -357,7 +359,7 @@
sub invoice {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
my $custnum = $session->{'custnum'};
@@ -379,7 +381,7 @@
sub list_invoices {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
my $custnum = $session->{'custnum'};
@@ -400,7 +402,7 @@
sub cancel {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
my $custnum = $session->{'custnum'};
@@ -571,7 +573,7 @@
sub cancel_pkg {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
my $custnum = $session->{'custnum'};
@@ -740,14 +742,14 @@
if ( $p->{'session_id'} ) {
$context = 'customer';
- $session = $cache->get($p->{'session_id'})
+ $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
$custnum = $session->{'custnum'};
} elsif ( $p->{'agent_session_id'} ) {
$context = 'agent';
- my $agent_cache = new Cache::SharedMemoryCache( {
+ my $agent_cache = new FS::ClientAPI_SessionCache( {
'namespace' => 'FS::ClientAPI::Agent',
} );
$session = $agent_cache->get($p->{'agent_session_id'})
@@ -761,7 +763,6 @@
($context, $session, $custnum);
}
-
1;
Index: Agent.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/ClientAPI/Agent.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Agent.pm 5 Feb 2005 23:39:43 -0000 1.5
+++ Agent.pm 8 Feb 2005 20:22:46 -0000 1.6
@@ -4,16 +4,18 @@
use strict;
use vars qw($cache);
+use subs qw(_cache);
use Digest::MD5 qw(md5_hex);
-use Cache::SharedMemoryCache; #store in db?
use FS::Record qw(qsearchs); # qsearch dbdef dbh);
+use FS::ClientAPI_SessionCache;
use FS::agent;
use FS::cust_main qw(smart_search);
-#store in db?
-my $cache = new Cache::SharedMemoryCache( {
- 'namespace' => 'FS::ClientAPI::Agent',
-} );
+sub _cache {
+ $cache ||= new FS::ClientAPI_SessionCache( {
+ 'namespace' => 'FS::ClientAPI::Agent',
+ } );
+}
sub agent_login {
my $p = shift;
@@ -37,9 +39,9 @@
my $session_id;
do {
$session_id = md5_hex(md5_hex(time(). {}. rand(). $$))
- } until ( ! defined $cache->get($session_id) ); #just in case
+ } until ( ! defined _cache->get($session_id) ); #just in case
- $cache->set( $session_id, $session, '1 hour' );
+ _cache->set( $session_id, $session, '1 hour' );
{ 'error' => '',
'session_id' => $session_id,
@@ -49,7 +51,7 @@
sub agent_logout {
my $p = shift;
if ( $p->{'session_id'} ) {
- $cache->remove($p->{'session_id'});
+ _cache->remove($p->{'session_id'});
return { 'error' => '' };
} else {
return { 'error' => "Can't resume session" }; #better error message
@@ -59,7 +61,7 @@
sub agent_info {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
#my %return;
@@ -84,7 +86,7 @@
sub agent_list_customers {
my $p = shift;
- my $session = $cache->get($p->{'session_id'})
+ my $session = _cache->get($p->{'session_id'})
or return { 'error' => "Can't resume session" }; #better error message
#my %return;
@@ -120,3 +122,4 @@
}
+1;
- Previous message: freeside/FS/FS clientapi_session.pm,NONE,1.1 clientapi_session_field.pm,NONE,1.1 ClientAPI_SessionCache.pm,NONE,1.1 Conf.pm,1.119,1.120
- Next message: freeside/FS FS.pm,1.28,1.29 MANIFEST,1.81,1.82
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list