More fixes for #2009 - the XMLRPC calls were made to non-existent functions. The export token was stored in the user preferences even though it was empty. We now display the XMLRPC error for easier debugging.
This commit is contained in:
parent
e10129f996
commit
d77fcf6c5e
|
@ -1,8 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
|
* @author Sebastian Gobel <sebastian.goebel@web.de>
|
||||||
|
* @author Paul Baranowski <paul@paulbaranowski.org>
|
||||||
* @package Campcaster
|
* @package Campcaster
|
||||||
* @subpackage htmlUI
|
* @subpackage htmlUI
|
||||||
* @version $Revision$
|
* @version $Revision$
|
||||||
|
* @copyright 2006 MDLF, Inc.
|
||||||
|
* @license http://www.gnu.org/licenses/gpl.txt
|
||||||
|
* @link http://www.campware.org
|
||||||
*/
|
*/
|
||||||
class uiScheduler extends uiCalendar {
|
class uiScheduler extends uiCalendar {
|
||||||
/**
|
/**
|
||||||
|
@ -831,38 +836,64 @@ class uiScheduler extends uiCalendar {
|
||||||
|
|
||||||
// export methods
|
// export methods
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the token for the schedule which is currently being exported.
|
||||||
|
* It is stored in the user preferences.
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
function getExportToken()
|
function getExportToken()
|
||||||
{
|
{
|
||||||
$token = $this->Base->gb->loadPref($this->Base->sessid, UI_SCHEDULER_EXPORTTOKEN_KEY);
|
$token = $this->Base->gb->loadPref($this->Base->sessid, UI_SCHEDULER_EXPORTTOKEN_KEY);
|
||||||
|
|
||||||
if (PEAR::isError($token)) {
|
if (PEAR::isError($token) || empty($token)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $token;
|
return $token;
|
||||||
} // fn getExportToken
|
} // fn getExportToken
|
||||||
|
|
||||||
|
|
||||||
function scheduleExportOpen($from,$to)
|
/**
|
||||||
|
* Export a schedule within a certain time range.
|
||||||
|
*
|
||||||
|
* @param string $from
|
||||||
|
* Date-time format
|
||||||
|
* @param string $to
|
||||||
|
* Date-time format
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function scheduleExportOpen($from, $to)
|
||||||
{
|
{
|
||||||
$criteria = array('filetype' => UI_FILETYPE_ANY);
|
$criteria = array('filetype' => UI_FILETYPE_ANY);
|
||||||
$token = $this->spc->exportOpenMethod($this->Base->sessid, $from, $to, $criteria);
|
$token = $this->spc->exportOpenMethod($this->Base->sessid, $criteria, $from, $to);
|
||||||
|
|
||||||
if (PEAR::isError($token)) {
|
if (PEAR::isError($token)) {
|
||||||
$this->Base->_retMsg('Error initializing scheduler export: $1', $token->getMessage());
|
$this->Base->_retMsg('Error initializing scheduler export: $1', $token->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->scheduleExportCheck();
|
if (isset($token["error"])) {
|
||||||
|
$this->Base->_retMsg('Error initializing scheduler export: $1',
|
||||||
|
$token["error"]["code"].":".$token["error"]["message"]);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$this->Base->gb->savePref($this->Base->sessid, UI_SCHEDULER_EXPORTTOKEN_KEY, $token['token']);
|
$this->Base->gb->savePref($this->Base->sessid, UI_SCHEDULER_EXPORTTOKEN_KEY, $token['token']);
|
||||||
|
//$this->scheduleExportCheck();
|
||||||
return true;
|
return true;
|
||||||
} // fn scheduleExportOpen
|
} // fn scheduleExportOpen
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the status of a schedule that is being exported.
|
||||||
|
*
|
||||||
|
* @return string|false
|
||||||
|
*/
|
||||||
function scheduleExportCheck()
|
function scheduleExportCheck()
|
||||||
{
|
{
|
||||||
$token = $this->getExportToken();
|
$token = $this->getExportToken();
|
||||||
|
|
||||||
if ($token === false) {
|
if (empty($token)) {
|
||||||
|
$this->Base->_retMsg('Token not available');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,7 +910,7 @@ class uiScheduler extends uiCalendar {
|
||||||
{
|
{
|
||||||
$token = $this->getExportToken();
|
$token = $this->getExportToken();
|
||||||
|
|
||||||
if ($token === false) {
|
if (empty($token)) {
|
||||||
$this->Base->_retMsg('Token not available');
|
$this->Base->_retMsg('Token not available');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/* ================================================================= includes */
|
|
||||||
#require_once 'DB.php';
|
|
||||||
#require_once "XML/RPC.php";
|
|
||||||
#include_once "../conf.php";
|
|
||||||
|
|
||||||
/* ================================================== method definition array */
|
/* ================================================== method definition array */
|
||||||
/**
|
/**
|
||||||
* Array with methods description
|
* Array with methods description
|
||||||
|
@ -98,9 +93,9 @@ $mdefs = array(
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"ExportOpenMethod" => array(
|
"ExportOpenMethod" => array(
|
||||||
'm'=>'exportOpen',
|
'm'=>'createBackupOpen',
|
||||||
'p'=>array('sessionId'/*string*/, 'from'/*datetime*/, 'to'/*datetime*/, 'criteria'/*struct*/),
|
'p'=>array('sessionId'/*string*/, 'criteria'/*struct*/, 'from'/*datetime*/, 'to'/*datetime*/),
|
||||||
't'=>array('string', 'dateTime.iso8601', 'dateTime.iso8601', 'struct'),
|
't'=>array('string', 'struct', 'dateTime.iso8601', 'dateTime.iso8601'),
|
||||||
'r'=>array('schedulerExportToken'/*string*/),
|
'r'=>array('schedulerExportToken'/*string*/),
|
||||||
'e'=>array(
|
'e'=>array(
|
||||||
'1601'=>'invalid argument format',
|
'1601'=>'invalid argument format',
|
||||||
|
@ -111,7 +106,7 @@ $mdefs = array(
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"ExportCheckMethod" => array(
|
"ExportCheckMethod" => array(
|
||||||
'm'=>'exportCheck',
|
'm'=>'createBackupCheck',
|
||||||
'p'=>array('sessionId'/*string*/, 'token'/*string*/),
|
'p'=>array('sessionId'/*string*/, 'token'/*string*/),
|
||||||
't'=>array('string', 'string'),
|
't'=>array('string', 'string'),
|
||||||
'r'=>array('status'/*string*/),
|
'r'=>array('status'/*string*/),
|
||||||
|
@ -122,7 +117,7 @@ $mdefs = array(
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
"ExportCloseMethod" => array(
|
"ExportCloseMethod" => array(
|
||||||
'm'=>'exportClose',
|
'm'=>'createBackupClose',
|
||||||
'p'=>array('sessionId'/*string*/, 'token'/*string*/),
|
'p'=>array('sessionId'/*string*/, 'token'/*string*/),
|
||||||
't'=>array('string', 'string'),
|
't'=>array('string', 'string'),
|
||||||
'r'=>array('status'/*boolean*/),
|
'r'=>array('status'/*boolean*/),
|
||||||
|
@ -227,11 +222,8 @@ class SchedulerPhpClient {
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
$this->verbose = $verbose;
|
$this->verbose = $verbose;
|
||||||
$confPrefix = "scheduler";
|
$confPrefix = "scheduler";
|
||||||
//$confPrefix = "storage";
|
$serverPath = "http://{$config["{$confPrefix}UrlHost"]}:{$config["{$confPrefix}UrlPort"]}".
|
||||||
$serverPath =
|
"{$config["{$confPrefix}UrlPath"]}/{$config["{$confPrefix}XMLRPC"]}";
|
||||||
"http://{$config["{$confPrefix}UrlHost"]}:{$config["{$confPrefix}UrlPort"]}".
|
|
||||||
"{$config["{$confPrefix}UrlPath"]}/{$config["{$confPrefix}XMLRPC"]}";
|
|
||||||
//$serverPath = "http://localhost:80/campcasterStorageServerCVS/xmlrpc/xrLocStor.php";
|
|
||||||
if ($this->verbose) {
|
if ($this->verbose) {
|
||||||
echo "serverPath: $serverPath\n";
|
echo "serverPath: $serverPath\n";
|
||||||
}
|
}
|
||||||
|
@ -273,11 +265,9 @@ class SchedulerPhpClient {
|
||||||
' return $r;'."\n".
|
' return $r;'."\n".
|
||||||
' }'."\n";
|
' }'."\n";
|
||||||
}
|
}
|
||||||
$e =
|
$e = "class SchedulerPhpClientCore extends SchedulerPhpClient{\n".
|
||||||
"class SchedulerPhpClientCore extends SchedulerPhpClient{\n".
|
"$f\n".
|
||||||
"$f\n".
|
"}\n";
|
||||||
"}\n";
|
|
||||||
# echo $e;
|
|
||||||
if (FALSE === eval($e)) {
|
if (FALSE === eval($e)) {
|
||||||
return $dbc->raiseError("Eval failed");
|
return $dbc->raiseError("Eval failed");
|
||||||
}
|
}
|
||||||
|
@ -304,16 +294,16 @@ class SchedulerPhpClient {
|
||||||
$XML_RPC_val = new XML_RPC_Value;
|
$XML_RPC_val = new XML_RPC_Value;
|
||||||
foreach ($this->mdefs[$method]['p'] as $i => $p) {
|
foreach ($this->mdefs[$method]['p'] as $i => $p) {
|
||||||
$parr[$p] = new XML_RPC_Value;
|
$parr[$p] = new XML_RPC_Value;
|
||||||
switch ($this->mdefs[$method]['t'][$i]) { // switch ($parr[$p]->kindOf($gettedPars[$i])) {
|
switch ($this->mdefs[$method]['t'][$i]) {
|
||||||
/* array type: normal array */
|
// array type: normal array
|
||||||
case 'array':
|
case 'array':
|
||||||
$parr[$p]->addArray($gettedPars[$i]);
|
$parr[$p]->addArray($gettedPars[$i]);
|
||||||
break;
|
break;
|
||||||
/* stuct type: assoc. array */
|
// stuct type: assoc. array
|
||||||
case 'struct':
|
case 'struct':
|
||||||
$parr[$p]->addStruct($gettedPars[$i]);
|
$parr[$p]->addStruct($gettedPars[$i]);
|
||||||
break;
|
break;
|
||||||
/* scalar types: 'int' | 'boolean' | 'string' | 'double' | 'dateTime.iso8601' | 'base64'*/
|
// scalar types: 'int' | 'boolean' | 'string' | 'double' | 'dateTime.iso8601' | 'base64'
|
||||||
default:
|
default:
|
||||||
$parr[$p]->addScalar($gettedPars[$i], $this->mdefs[$method]['t'][$i]);
|
$parr[$p]->addScalar($gettedPars[$i], $this->mdefs[$method]['t'][$i]);
|
||||||
}
|
}
|
||||||
|
@ -332,28 +322,13 @@ class SchedulerPhpClient {
|
||||||
return array('error' => array('code' => -1, 'message' => '##Cannot connect to Scheduler##'));
|
return array('error' => array('code' => -1, 'message' => '##Cannot connect to Scheduler##'));
|
||||||
}
|
}
|
||||||
if ($res->faultCode() > 0) {
|
if ($res->faultCode() > 0) {
|
||||||
return array('error' => array('code' => $res->faultCode(), 'message' => $res->faultString())); ## changed by sebastian
|
return array('error' => array('code' => $res->faultCode(), 'message' => $res->faultString()));
|
||||||
/*
|
|
||||||
tomas<EFBFBD> orig. method
|
|
||||||
return $this->dbc->raiseError(
|
|
||||||
"SchedulerPhpClient::$method:".$res->faultString()." ".
|
|
||||||
$res->faultCode()."\n", $res->faultCode()
|
|
||||||
);
|
|
||||||
|
|
||||||
newer method:
|
|
||||||
return PEAR::raiseError(
|
|
||||||
"SchedulerPhpClient::$method:".$res->faultString()." ".
|
|
||||||
$res->faultCode()."\n", $res->faultCode(),
|
|
||||||
PEAR_ERROR_RETURN
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
if ($this->verbose) {
|
if ($this->verbose) {
|
||||||
echo "result:\n";
|
echo "result:\n";
|
||||||
echo $res->serialize();
|
echo $res->serialize();
|
||||||
}
|
}
|
||||||
$val = $res->value();
|
$val = $res->value();
|
||||||
# echo"<pre>\n"; var_dump($val); exit;
|
|
||||||
$resp = XML_RPC_decode($res->value());
|
$resp = XML_RPC_decode($res->value());
|
||||||
return $resp;
|
return $resp;
|
||||||
} // fn callMethod
|
} // fn callMethod
|
||||||
|
|
Loading…
Reference in New Issue