added:
resetStorage XML-RPC method in xrLocStor and var/tests/sampleData.php file (and minor changes)
This commit is contained in:
parent
3d733bb524
commit
29844f9a3a
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.8 $
|
||||
Version : $Revision: 1.9 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -48,7 +48,7 @@ require_once "Transport.php";
|
|||
* LiveSupport file storage module
|
||||
*
|
||||
* @author $Author: tomas $
|
||||
* @version $Revision: 1.8 $
|
||||
* @version $Revision: 1.9 $
|
||||
* @see Alib
|
||||
*/
|
||||
class GreenBox extends Alib{
|
||||
|
@ -446,10 +446,10 @@ class GreenBox extends Alib{
|
|||
function localSearch($searchData, $sessid='')
|
||||
{
|
||||
$ftsrch = $searchData;
|
||||
$res = $this->dbc->getAll("SELECT md.gunid as gunid
|
||||
$res = $this->dbc->getCol("SELECT md.gunid as gunid
|
||||
FROM {$this->filesTable} f, {$this->mdataTable} md
|
||||
WHERE f.gunid=md.gunid AND md.objns='_L' AND
|
||||
md.object like '$ftsrch'
|
||||
md.object like '%$ftsrch%'
|
||||
GROUP BY md.gunid
|
||||
");
|
||||
if(!is_array($res)) $res = array();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.7 $
|
||||
Version : $Revision: 1.8 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -209,5 +209,27 @@ class LocStor extends GreenBox{
|
|||
if(PEAR::isError($md)) return $md;
|
||||
return $md;
|
||||
}
|
||||
/**
|
||||
* Reset storageServer for debugging.
|
||||
*
|
||||
* @param input string
|
||||
*/
|
||||
function resetStorage($input='')
|
||||
{
|
||||
$this->deleteData();
|
||||
$rootHD = $this->getObjId('root', $this->storId);
|
||||
$this->login('root', $this->config['tmpRootPass']);
|
||||
$s = $this->sessid;
|
||||
include"../tests/sampleData.php";
|
||||
$res = array();
|
||||
foreach($sampleData as $k=>$it){
|
||||
list($media, $meta) = $it;
|
||||
$r = $this->putFile($rootHD, "file".($k+1), $media, $meta, $s);
|
||||
if(PEAR::isError($r)){ return $r; }
|
||||
$res[] = $this->_gunidFromId($r);
|
||||
}
|
||||
$this->logout($this->sessid);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -132,7 +132,7 @@ $tpldata['showMenu']=true;
|
|||
<a href="gbHtmlBrowse.php?act=getHomeDir" class="button">Home directory</a>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo$tpldata['id']?>&act=newfile" class="button"><span class="hidden">[</span>Upload new file<span class="hidden">]</span></a>
|
||||
<a href="javascript:newFolder()" class="button"><span class="hidden">[</span>Create new folder<span class="hidden">]</span></a>
|
||||
<a href="gbHtmlBrowse.php?id=<?php echo$tpldata['id']?>&act=sform" class="button"><span class="hidden">[</span>Search<span class="hidden">]</span></a>
|
||||
<!-- <a href="gbHtmlBrowse.php?id=<?php echo$tpldata['id']?>&act=sform" class="button"><span class="hidden">[</span>Search<span class="hidden">]</span></a>-->
|
||||
</h3>
|
||||
<?php }?>
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
<?
|
||||
$sampleData = array(
|
||||
array('../tests/ex1.mp3', '../tests/mdata1.xml'),
|
||||
array('../tests/ex2.ogg', '../tests/mdata2.xml'),
|
||||
array('../tests/ex2.wav', '../tests/mdata3.xml'),
|
||||
// array('', ''),
|
||||
);
|
||||
?>
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
Author : $Author: tomas $
|
||||
Version : $Revision: 1.6 $
|
||||
Version : $Revision: 1.7 $
|
||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -56,7 +56,7 @@ require_once '../LocStor.php';
|
|||
function errHndl($errno, $errmsg, $filename, $linenum, $vars){
|
||||
if($errno == 8 /*E_NOTICE*/) return;
|
||||
$xr =& new XML_RPC_Response(0, 805,
|
||||
"ERROR:xrLoctor: $errno $errmsg ($filename:$linenum)");
|
||||
"ERROR:xrLocStor: $errno $errmsg ($filename:$linenum)");
|
||||
header("Content-type: text/xml");
|
||||
echo $xr->serialize();
|
||||
exit($errno);
|
||||
|
@ -495,7 +495,7 @@ class XR_LocStor extends LocStor{
|
|||
if(!$ok) return $r;
|
||||
$res = $this->searchMetadata($r['sessid'], $r['criteria']);
|
||||
if(!PEAR::isError($res))
|
||||
return new XML_RPC_Response(new XML_RPC_Value($res, "boolean"));
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
else
|
||||
return new XML_RPC_Response(0, 803,
|
||||
"xr_searchAudioClip: ".$res->getMessage().
|
||||
|
@ -637,6 +637,45 @@ class XR_LocStor extends LocStor{
|
|||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset storageServer for debugging.
|
||||
*
|
||||
* The XML-RPC name of this method is "locstor.resetStorage".
|
||||
*
|
||||
* There are no input parameters
|
||||
*
|
||||
* On success, returns a single XML-RPC value:
|
||||
* <ul>
|
||||
* <li> array - array with gunids of inserted files </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_getAudioClip:
|
||||
* <message from lower layer> </li>
|
||||
* </ul>
|
||||
*
|
||||
* @param input XMLRPC struct
|
||||
* @return string
|
||||
* @see LocStor::getAudioClip
|
||||
*/
|
||||
function xr_resetStorage($input)
|
||||
{
|
||||
list($ok, $r) = $this->_xr_getPars($input);
|
||||
if(!$ok) return $r;
|
||||
$res = $this->resetStorage();
|
||||
if(!PEAR::isError($res))
|
||||
return new XML_RPC_Response(XML_RPC_encode($res));
|
||||
else
|
||||
return new XML_RPC_Response(0, 805,
|
||||
"xr_getAudioClip: ".$res->getMessage()." ".$res->getUserInfo()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$locStor = &new XR_LocStor(&$dbc, $config);
|
||||
|
@ -658,7 +697,8 @@ $methods = array(
|
|||
'AudioClips, return all matching clip ids.',
|
||||
'accessRawAudioData' => 'Get access to raw audio data.',
|
||||
'releaseRawAudioData' => 'Release access to raw audio data.',
|
||||
'getAudioClip' => 'Return the contents of an Audio clip.'
|
||||
'getAudioClip' => 'Return the contents of an Audio clip.',
|
||||
'resetStorage' => 'Reset storageServer for debugging.',
|
||||
);
|
||||
|
||||
$defs = array();
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#
|
||||
#
|
||||
# Author : $Author: tomas $
|
||||
# Version : $Revision: 1.2 $
|
||||
# Version : $Revision: 1.3 $
|
||||
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/Attic/xr_cli_test.py,v $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
@ -105,6 +105,8 @@ try:
|
|||
print server.locstor.releaseRawAudioData({'sessid':pars[0], 'tmpLink':pars[1]})
|
||||
elif method=="getAudioClip":
|
||||
print server.locstor.getAudioClip({'sessid':pars[0], 'gunid':pars[1]})
|
||||
elif method=="resetStorage":
|
||||
print server.locstor.resetStorage({})
|
||||
else:
|
||||
print "Unknown command: "+method
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Reference in New Issue