1 |
joko |
1.1 |
<? |
2 |
|
|
// --------------------------------------------------------------------------- |
3 |
joko |
1.4 |
// $Id: AbstractBackend.php,v 1.3 2003/02/28 04:16:19 joko Exp $ |
4 |
joko |
1.1 |
// --------------------------------------------------------------------------- |
5 |
jonen |
1.2 |
// $Log: AbstractBackend.php,v $ |
6 |
joko |
1.4 |
// Revision 1.3 2003/02/28 04:16:19 joko |
7 |
|
|
// fix: getStatus now return status in bool |
8 |
|
|
// |
9 |
joko |
1.3 |
// Revision 1.2 2003/02/27 14:37:56 jonen |
10 |
|
|
// + added function 'saveObjectByGuid()' |
11 |
|
|
// |
12 |
jonen |
1.2 |
// Revision 1.1 2003/02/22 16:19:38 joko |
13 |
|
|
// + initial commit |
14 |
|
|
// |
15 |
joko |
1.1 |
// --------------------------------------------------------------------------- |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
class Application_AbstractBackend { |
19 |
|
|
|
20 |
|
|
var $rpcinfo; |
21 |
|
|
|
22 |
|
|
function Application_AbstractBackend($rpcinfo) { |
23 |
|
|
$this->rpcinfo = $rpcinfo; |
24 |
|
|
// debug |
25 |
|
|
//print Dumper($this->rpcinfo); |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
function _remote_method() { |
29 |
|
|
$arg_list = func_get_args(); |
30 |
|
|
|
31 |
|
|
$command = array_shift($arg_list); |
32 |
|
|
|
33 |
|
|
$cache_key = join("-", array(session_id(), $command, join('_', $arg_list) )); |
34 |
|
|
//print "cache_key: $cache_key<br>"; |
35 |
|
|
|
36 |
|
|
// FIXME: what if arg_list still contains more elements after doing this? |
37 |
|
|
$query = array_shift($arg_list); |
38 |
|
|
|
39 |
|
|
// -------------------- clone this & modify ---------- |
40 |
|
|
$rpcinfo = $this->rpcinfo; |
41 |
|
|
//$rpcinfo[to_latin] = 1; // FIXME! implement this into Data::Driver::RPC::Remote! |
42 |
|
|
$resultHandle = mkObject('Data::Driver::Proxy', $cache_key, array( key => 1, command => $command, query => $query, remote => 1, rpcinfo => $rpcinfo, cache => array( db => 0, session => 1 ) ) ); |
43 |
|
|
$result = $resultHandle->getAttributes(); |
44 |
|
|
return $result; |
45 |
|
|
// -------------------- clone this & modify ---------- |
46 |
|
|
|
47 |
|
|
} |
48 |
|
|
|
49 |
|
|
function getStatus() { |
50 |
|
|
global $app; |
51 |
|
|
$proxy = mkObject('Data::Driver::Proxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo") ) ); |
52 |
joko |
1.3 |
return $proxy->backend->isConnected(); |
53 |
joko |
1.1 |
} |
54 |
joko |
1.3 |
|
55 |
joko |
1.1 |
function forceConnect() { |
56 |
|
|
global $app; |
57 |
|
|
//print Dumper($app); |
58 |
|
|
$proxy = mkObject('Data::Driver::Proxy', null, array( remote => 1, rpcinfo => $app->getConfig("rpcinfo"), connect => 1 ) ); |
59 |
|
|
//print Dumper($proxy); |
60 |
|
|
$proxy->backend->ping(); |
61 |
|
|
$status_bool = $proxy->backend->isConnected(); |
62 |
|
|
$status_yesno = $status_bool ? 'yes' : 'no'; |
63 |
|
|
return $status_yesno; |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
?> |