some fixes
This commit is contained in:
parent
182518dc1d
commit
2b77b8d613
5 changed files with 9 additions and 578 deletions
|
@ -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 */
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,104 +0,0 @@
|
|||
<?php
|
||||
class Schedule
|
||||
{
|
||||
function Schedule() {}
|
||||
|
||||
/**
|
||||
* Open schedule import
|
||||
*
|
||||
* @param filename : string - import file
|
||||
* @return status : hasharray - fields:
|
||||
* token: string - schedule import token
|
||||
*/
|
||||
function openImport($sessid,$filename) {
|
||||
return array ('token' => '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');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -1949,7 +1949,7 @@ class XR_LocStor extends LocStor{
|
|||
* fields:
|
||||
* <ul>
|
||||
* <li> sessid : string - session id </li>
|
||||
* <li> chsum : string - md5 checksum of backup file</li>
|
||||
* <li> filename: string - backup file</li>
|
||||
* </ul>
|
||||
*
|
||||
* 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:
|
||||
* <ul>
|
||||
* <li> sessid : string - session id </li>
|
||||
* <li> chsum : string - md5 checksum of backup file</li>
|
||||
* </ul>
|
||||
*
|
||||
* On success, returns a XML-RPC struct with following fields:
|
||||
* <ul>
|
||||
* <li> token : string - PUT token</li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
* The possible error codes and error message are:
|
||||
* <ul>
|
||||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_restoreBackupOpen:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul>
|
||||
* <li> token : string - access token </li>
|
||||
* </ul>
|
||||
*
|
||||
* On success, returns a XML-RPC struct with following fields:
|
||||
* <ul>
|
||||
* <li> status : hasharray - fields:
|
||||
* token: string - schedule import token
|
||||
* status: string - working | fault | success</li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
* The possible error codes and error message are:
|
||||
* <ul>
|
||||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_restoreBackupCheck:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul>
|
||||
* <li> token : string - access token </li>
|
||||
* </ul>
|
||||
*
|
||||
* On success, returns a XML-RPC struct with following fields:
|
||||
* <ul>
|
||||
* <li> status : string - status</li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
* The possible error codes and error message are:
|
||||
* <ul>
|
||||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_restoreBackupClose:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul>
|
||||
* <li> sessid : string - session id </li>
|
||||
* <li> criteria : struct - see search criteria</li>
|
||||
* <li> fromTime : time - begining time of schedule export</li>
|
||||
* <li> toTime : time - ending time of schedule export</li>
|
||||
* </ul>
|
||||
*
|
||||
* On success, returns a XML-RPC struct with following fields:
|
||||
* <ul>
|
||||
* <li> hasharray - fields:
|
||||
* token: string - schedule export token</li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
* The possible error codes and error message are:
|
||||
* <ul>
|
||||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_restoreBackupOpen:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul>
|
||||
* <li> token : string - schedule export token </li>
|
||||
* </ul>
|
||||
*
|
||||
* On success, returns a XML-RPC struct with following fields:
|
||||
* <ul>
|
||||
* <li> status: hasharray - fields:
|
||||
* token: string - schedule export token
|
||||
* status: string - working | fault | success</li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
* The possible error codes and error message are:
|
||||
* <ul>
|
||||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_restoreBackupCheck:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @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:
|
||||
* <ul>
|
||||
* <li> token : string - access token </li>
|
||||
* </ul>
|
||||
*
|
||||
* On success, returns a XML-RPC struct with following fields:
|
||||
* <ul>
|
||||
* <li> status : string - status</li>
|
||||
* </ul>
|
||||
*
|
||||
* On errors, returns an XML-RPC error response.
|
||||
* The possible error codes and error message are:
|
||||
* <ul>
|
||||
* <li> 3 - Incorrect parameters passed to method:
|
||||
* Wanted ... , got ... at param </li>
|
||||
* <li> 801 - wrong 1st parameter, struct expected.</li>
|
||||
* <li> 805 - xr_restoreBackupClose:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue