diff --git a/livesupport/src/modules/storageServer/var/GreenBox.php b/livesupport/src/modules/storageServer/var/GreenBox.php index c137ae733..58e11743c 100644 --- a/livesupport/src/modules/storageServer/var/GreenBox.php +++ b/livesupport/src/modules/storageServer/var/GreenBox.php @@ -1047,7 +1047,7 @@ class GreenBox extends BasicStor{ /* ===================================================== restore funcitons*/ /** - * Restore a beckup file + * Restore a backup file * * @param sessid : string - session id * @param filename : string - backup file path @@ -1081,9 +1081,7 @@ class GreenBox extends BasicStor{ * Close a restore procedure * * @param token : string - restore token - * @return status : hasharray - fields: - * token: string - restore token - * status: string - working | fault | success + * @return status : bool - is success */ function backupRestoreClose($token) { require_once 'Restore.php'; @@ -1091,6 +1089,97 @@ 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 02eb2d9b8..635c728be 100644 --- a/livesupport/src/modules/storageServer/var/LocStor.php +++ b/livesupport/src/modules/storageServer/var/LocStor.php @@ -1054,6 +1054,97 @@ 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/Schedule.php b/livesupport/src/modules/storageServer/var/Schedule.php new file mode 100644 index 000000000..bfcdb3228 --- /dev/null +++ b/livesupport/src/modules/storageServer/var/Schedule.php @@ -0,0 +1,104 @@ + '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 bb2fe2c92..0b2defaa9 100644 --- a/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php +++ b/livesupport/src/modules/storageServer/var/xmlrpc/XR_LocStor.php @@ -1937,7 +1937,7 @@ class XR_LocStor extends LocStor{ } /* ------------------------------------------------------ restore methods */ /** - * Open writable URL for restore a backup file + * Open restore a backup file * * The XML-RPC name of this method is "locstor.restoreBackupOpen". * @@ -1950,7 +1950,6 @@ class XR_LocStor extends LocStor{ * * On success, returns a XML-RPC struct with following fields: * * @@ -1980,7 +1979,6 @@ class XR_LocStor extends LocStor{ ); } return new XML_RPC_Response(XML_RPC_encode(array( - 'url'=>$res['url'], 'token'=>$res['token'], ))); } @@ -1998,7 +1996,9 @@ class XR_LocStor extends LocStor{ * * On success, returns a XML-RPC struct with following fields: * * * On errors, returns an XML-RPC error response. @@ -2015,7 +2015,7 @@ class XR_LocStor extends LocStor{ * @return XMLRPC struct * @see LocStor::restoreBackupCheck */ - function restoreBackupCheck($input) + function xr_restoreBackupCheck($input) { list($ok, $r) = $this->_xr_getPars($input); if(!$ok) return $r; @@ -2027,7 +2027,7 @@ class XR_LocStor extends LocStor{ ); } return new XML_RPC_Response(XML_RPC_encode(array( - 'gunid'=>$res, + 'status'=>$res, ))); } @@ -2077,6 +2077,292 @@ 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