From 2b77b8d613eacf0a730cf2ab95f8276cd3b938d9 Mon Sep 17 00:00:00 2001 From: csikosjanos Date: Mon, 19 Jun 2006 07:50:23 +0000 Subject: [PATCH] some fixes --- .../modules/storageServer/var/GreenBox.php | 92 ------ .../src/modules/storageServer/var/LocStor.php | 91 ------ .../src/modules/storageServer/var/Restore.php | 10 +- .../modules/storageServer/var/Schedule.php | 104 ------- .../storageServer/var/xmlrpc/XR_LocStor.php | 290 +----------------- 5 files changed, 9 insertions(+), 578 deletions(-) delete mode 100644 livesupport/src/modules/storageServer/var/Schedule.php diff --git a/livesupport/src/modules/storageServer/var/GreenBox.php b/livesupport/src/modules/storageServer/var/GreenBox.php index 368e560dd..c51f6d6ac 100644 --- a/livesupport/src/modules/storageServer/var/GreenBox.php +++ b/livesupport/src/modules/storageServer/var/GreenBox.php @@ -1102,98 +1102,6 @@ class GreenBox extends BasicStor{ if (PEAR::isError($rs)) return $rs; return $rs->closeRestore($token); } - /*===================================================== scheduler methods */ - - /** - * Open schedule import - * - * @param filename : string - import file - * @return status : hasharray - fields: - * token: string - schedule import token - */ - function scheduleImportOpen($sessid,$filename) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->openImport($sessid,$filename); - } - - /** - * Check status of schedule import - * - * @param token : string - schedule import token - * @return status : hasharray - fields: - * token: string - schedule import token - * status: string - working | fault | success - */ - function scheduleImportCheck($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->checkImport($token); - } - - /** - * Close schedule import - * - * @param token : string - schedule import token - * @return status : hasharray - fields: - * token: string - schedule import token - */ - function scheduleImportClose($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->closeImport($token); - } - - /** - * Open schedule export - * - * @param sessid : string - schedule import token - * @param criteria : struct - see search criteria - * @param fromTime : time - begining time of schedule export - * @param toTime : time - ending time of schedule export - * @return status : hasharray - fields: - * token: string - schedule export token - */ - function scheduleExportOpen($sessid,$criteria,$fromTime,$toTime) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->openExport($sessid,$criteria,$fromTime,$toTime); - } - - /** - * Check status of schedule export - * - * @param token : string - schedule export token - * @return status : hasharray - fields: - * token: string - schedule export token - * status: string - working | fault | success - * file : string - exported file location (available if status is success) - */ - function scheduleExportCheck($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->checkExport($token); - } - - /** - * Close schedule export - * - * @param token : string - schedule export token - * @return status : hasharray - fields: - * token: string - schedule export token - */ - function scheduleExportClose($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->closeExport($token); - } - /* ============================================== methods for preferences */ /** diff --git a/livesupport/src/modules/storageServer/var/LocStor.php b/livesupport/src/modules/storageServer/var/LocStor.php index 1f501215c..5fc8c90ed 100644 --- a/livesupport/src/modules/storageServer/var/LocStor.php +++ b/livesupport/src/modules/storageServer/var/LocStor.php @@ -1041,97 +1041,6 @@ class LocStor extends BasicStor{ return $rs->closeRestore($token); } - /*===================================================== scheduler methods */ - - /** - * Open schedule import - * - * @param filename : string - import file - * @return status : hasharray - fields: - * token: string - schedule import token - */ - function scheduleImportOpen($sessid,$filename) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->openImport($sessid,$filename); - } - - /** - * Check status of schedule import - * - * @param token : string - schedule import token - * @return status : hasharray - fields: - * token: string - schedule import token - * status: string - working | fault | success - */ - function scheduleImportCheck($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->checkImport($token); - } - - /** - * Close schedule import - * - * @param token : string - schedule import token - * @return hasharray - fields: - * token: string - schedule import token - */ - function scheduleImportClose($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->closeImport($token); - } - - /** - * Open schedule export - * - * @param sessid : string - schedule import token - * @param criteria : struct - see search criteria - * @param fromTime : time - begining time of schedule export - * @param toTime : time - ending time of schedule export - * @return status : hasharray - fields: - * token: string - schedule export token - */ - function scheduleExportOpen($sessid,$criteria,$fromTime,$toTime) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->openExport($sessid,$criteria,$fromTime,$toTime); - } - - /** - * Check status of schedule export - * - * @param token : string - schedule export token - * @return status : hasharray - fields: - * token: string - schedule export token - * status: string - working | fault | success - */ - function scheduleExportCheck($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->checkExport($token); - } - - /** - * Close schedule export - * - * @param token : string - schedule export token - * @return status : hasharray - fields: - * token: string - schedule export token - */ - function scheduleExportClose($token) { - require_once 'Schedule.php'; - $sc = new Schedule($this); - if (PEAR::isError($sc)) return $sc; - return $sc->closeExport($token); - } - /*===================================================== auxiliary methods */ /** * Dummy method - only returns livesupport version diff --git a/livesupport/src/modules/storageServer/var/Restore.php b/livesupport/src/modules/storageServer/var/Restore.php index c54073fec..54ac85833 100644 --- a/livesupport/src/modules/storageServer/var/Restore.php +++ b/livesupport/src/modules/storageServer/var/Restore.php @@ -97,9 +97,13 @@ class Restore { } $this->token = $token; $this->setEnviroment(); - $r['status'] = file_get_contents($this->statusFile); - $r['token'] = $token; - return $r; + if (is_file($this->statusFile)) { + $r['status'] = file_get_contents($this->statusFile); + $r['token'] = $token; + return $r; + } else { + return PEAR::raiseError('Restore::checkRestore: invalid token!'); + } } /** diff --git a/livesupport/src/modules/storageServer/var/Schedule.php b/livesupport/src/modules/storageServer/var/Schedule.php deleted file mode 100644 index bfcdb3228..000000000 --- a/livesupport/src/modules/storageServer/var/Schedule.php +++ /dev/null @@ -1,104 +0,0 @@ - 'abcdef0123456789'); - } - - /** - * Check status of schedule import - * - * @param token : string - schedule import token - * @return status : hasharray - fields: - * token: string - schedule import token - * status: string - working | fault | success - */ - function checkImport($token) { - if ($token == 'abcdef0123456789') { - return array( - 'token' => $token, - 'status' => 'working' - ); - } else { - return PEAR::raiseError('Schedule::checkImport: invalid token'); - } - } - - /** - * Close schedule import - * - * @param token : string - schedule import token - * @return status : hasharray - fields: - * token: string - schedule import token - */ - function closeImport($token) { - if ($token == 'abcdef0123456789') { - return array( - 'token' => $token - ); - } else { - return PEAR::raiseError('Schedule::closeImport: invalid token'); - } - } - - /** - * Open schedule export - * - * @param sessid : string - schedule import token - * @param criteria : struct - see search criteria - * @param fromTime : time - begining time of schedule export - * @param toTime : time - ending time of schedule export - * @return status : hasharray - fields: - * token: string - schedule export token - */ - function openExport($sessid,$criteria,$fromTime,$toTime) { - return array ('token' => '123456789abcdef0'); - } - - /** - * Check status of schedule export - * - * @param token : string - schedule export token - * @return status : hasharray - fields: - * token: string - schedule export token - * status: string - working | fault | success - * file : string - exported file location (available if status is success) - */ - function checkExport($token) { - if ($token == '123456789abcdef0') { - return array( - 'token' => $token, - 'status' => 'working' - ); - } else { - PEAR::raiseError('Schedule::checkExport: invalid token'); - } - } - - /** - * Close schedule export - * - * @param token : string - schedule export token - * @return status : hasharray - fields: - * token: string - schedule export token - */ - function closeExport($token) { - if ($token == '123456789abcdef0') { - return array( - 'token' => $token - ); - } else { - PEAR::raiseError('Schedule::closeExport: invalid token'); - } - } -} -?> diff --git a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php index bfdbb6626..e541b0344 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php @@ -1949,7 +1949,7 @@ class XR_LocStor extends LocStor{ * fields: * * * On success, returns a XML-RPC struct with following fields: @@ -1975,7 +1975,7 @@ class XR_LocStor extends LocStor{ { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; - $res = $this->restoreBackupOpen($r['sessid'], $r['chsum']); + $res = $this->restoreBackupOpen($r['sessid'], $r['filename']); if(PEAR::isError($res)){ return new XML_RPC_Response(0, 805, "xr_restoreBackupOpen: ".$res->getMessage(). @@ -2081,292 +2081,6 @@ class XR_LocStor extends LocStor{ ))); } - /*===================================================== scheduler methods */ - /** - * Open import a schedule export file - * - * The XML-RPC name of this method is "locstor.scheduleImportOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - * - * - * On success, returns a XML-RPC struct with following fields: - * - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - * - * - * @param input XMLRPC struct - * @return XMLRPC struct - * @see LocStor::scheduleImportOpen - */ - function xr_scheduleImportOpen($input) - { - list($ok, $r) = $this->_xr_getPars($input); - if(!$ok) return $r; - $res = $this->scheduleImportOpen($r['sessid'], $r['chsum']); - if(PEAR::isError($res)){ - return new XML_RPC_Response(0, 805, - "xr_scheduleImportOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'token'=>$res['token'], - ))); - } - - /** - * Check the state of schedule importing - * - * The XML-RPC name of this method is "locstor.scheduleImportCheck". - * - * The input parameters are an XML-RPC struct with the following - * fields: - * - * - * On success, returns a XML-RPC struct with following fields: - * - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - * - * - * @param input XMLRPC struct - * @return XMLRPC struct - * @see LocStor::scheduleImportCheck - */ - function xr_scheduleImportCheck($input) - { - list($ok, $r) = $this->_xr_getPars($input); - if(!$ok) return $r; - $res = $this->scheduleImportCheck($r['token']); - if(PEAR::isError($res)){ - return new XML_RPC_Response(0, 805, - "xr_scheduleImportCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'status'=>$res, - ))); - } - - /** - * Close import schedule - * - * The XML-RPC name of this method is "locstor.scheduleImportClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - * - * - * On success, returns a XML-RPC struct with following fields: - * - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - * - * - * @param input XMLRPC struct - * @return XMLRPC struct - * @see LocStor::scheduleImportClose - */ - function xr_scheduleImportClose($input) - { - list($ok, $r) = $this->_xr_getPars($input); - if(!$ok) return $r; - $res = $this->scheduleImportClose($r['token']); - if(PEAR::isError($res)){ - return new XML_RPC_Response(0, 805, - "xr_restoreBackupClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'gunid'=>$res, - ))); - } - - /** - * Open export schedule - * - * The XML-RPC name of this method is "locstor.scheduleExportOpen". - * - * The input parameters are an XML-RPC struct with the following - * fields: - * - * - * On success, returns a XML-RPC struct with following fields: - * - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - * - * - * @param input XMLRPC struct - * @return XMLRPC struct - * @see LocStor::scheduleExportOpen - */ - function xr_scheduleExportOpen($input) - { - list($ok, $r) = $this->_xr_getPars($input); - if(!$ok) return $r; - $res = $this->scheduleImportOpen($r['sessid'], $r['criteria'], $r['fromTime'], $r['toTime']); - if(PEAR::isError($res)){ - return new XML_RPC_Response(0, 805, - "xr_scheduleImportOpen: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'token'=>$res['token'], - ))); - } - - /** - * Check the state of schedule export - * - * The XML-RPC name of this method is "locstor.scheduleExportCheck". - * - * The input parameters are an XML-RPC struct with the following - * fields: - * - * - * On success, returns a XML-RPC struct with following fields: - * - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - * - * - * @param input XMLRPC struct - * @return XMLRPC struct - * @see LocStor::scheduleExportCheck - */ - function xr_scheduleExportCheck($input) - { - list($ok, $r) = $this->_xr_getPars($input); - if(!$ok) return $r; - $res = $this->scheduleExportCheck($r['token']); - if(PEAR::isError($res)){ - return new XML_RPC_Response(0, 805, - "xr_scheduleExportCheck: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'status'=>$res, - ))); - } - - /** - * Close export schedule - * - * The XML-RPC name of this method is "locstor.scheduleExportClose". - * - * The input parameters are an XML-RPC struct with the following - * fields: - * - * - * On success, returns a XML-RPC struct with following fields: - * - * - * On errors, returns an XML-RPC error response. - * The possible error codes and error message are: - * - * - * @param input XMLRPC struct - * @return XMLRPC struct - * @see LocStor::scheduleExportClose - */ - function xr_scheduleExportClose($input) - { - list($ok, $r) = $this->_xr_getPars($input); - if(!$ok) return $r; - $res = $this->scheduleExportClose($r['token']); - if(PEAR::isError($res)){ - return new XML_RPC_Response(0, 805, - "xr_restoreBackupClose: ".$res->getMessage(). - " ".$res->getUserInfo() - ); - } - return new XML_RPC_Response(XML_RPC_encode(array( - 'status'=>$res, - ))); - } - /*========================================================== info methods */ /** * Check if audio clip exists and return TRUE/FALSE