diff --git a/livesupport/modules/storageServer/var/GreenBox.php b/livesupport/modules/storageServer/var/GreenBox.php index b411ccf43..f7c3c24a9 100644 --- a/livesupport/modules/storageServer/var/GreenBox.php +++ b/livesupport/modules/storageServer/var/GreenBox.php @@ -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(); diff --git a/livesupport/modules/storageServer/var/LocStor.php b/livesupport/modules/storageServer/var/LocStor.php index 9db68419e..0e13fba15 100644 --- a/livesupport/modules/storageServer/var/LocStor.php +++ b/livesupport/modules/storageServer/var/LocStor.php @@ -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; + } } ?> \ No newline at end of file diff --git a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php index b13ee1ef5..fb00d0012 100644 --- a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php +++ b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php @@ -132,7 +132,7 @@ $tpldata['showMenu']=true; Home directory Upload new file Create new folder - Search + diff --git a/livesupport/modules/storageServer/var/tests/sampleData.php b/livesupport/modules/storageServer/var/tests/sampleData.php new file mode 100644 index 000000000..3ea42894d --- /dev/null +++ b/livesupport/modules/storageServer/var/tests/sampleData.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php b/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php index 193bf84c1..808667318 100644 --- a/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php +++ b/livesupport/modules/storageServer/var/xmlrpc/xrLocStor.php @@ -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: + * + * + * On errors, returns an XML-RPC error response. + * The possible error codes and error message are: + * + * + * @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(); diff --git a/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.py b/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.py index 9cef51666..7d686ecdb 100755 --- a/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.py +++ b/livesupport/modules/storageServer/var/xmlrpc/xr_cli_test.py @@ -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)