Gunid format change!

Gunid is internally bigint (8B int).
Gunid is transported as 16 hex digits string in input parameters and output
results.
This commit is contained in:
tomas 2004-12-27 14:49:25 +00:00
parent 4f23838731
commit a9e52421d9
9 changed files with 174 additions and 83 deletions

View file

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.3 $
Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
------------------------------------------------------------------------------*/
@ -48,7 +48,7 @@ require_once "Transport.php";
* Core of LiveSupport file storage module
*
* @author $Author: tomas $
* @version $Revision: 1.3 $
* @version $Revision: 1.4 $
* @see Alib
*/
class BasicStor extends Alib{
@ -215,7 +215,7 @@ class BasicStor extends Alib{
{
$cnt = $this->dbc->getOne("
SELECT count(token) FROM {$this->accessTable}
WHERE token='{$token}' AND type='$type'
WHERE token=x'{$token}'::bigint AND type='$type'
");
if(PEAR::isError($cnt)){ return FALSE; }
return ($cnt == 1);
@ -236,9 +236,11 @@ class BasicStor extends Alib{
$token = StoredFile::_createGunid();
$res = $this->dbc->query("
INSERT INTO {$this->accessTable}
(gunid, sessid, token, ext, type, ts)
(gunid, sessid, token,
ext, type, ts)
VALUES
('{$gunid}', '$sessid', '$token', '$ext', '$type', now())
(x'{$gunid}'::bigint, '$sessid', x'$token'::bigint,
'$ext', '$type', now())
");
if(PEAR::isError($res)){ return $res; }
$linkFname = "{$this->accessDir}/$token.$ext";
@ -271,15 +273,15 @@ class BasicStor extends Alib{
);
}
$acc = $this->dbc->getRow("
SELECT gunid, ext FROM {$this->accessTable}
WHERE token='{$token}' AND type='$type'
SELECT to_hex(gunid)as gunid, ext FROM {$this->accessTable}
WHERE token=x'{$token}'::bigint AND type='$type'
");
$ext = $acc['ext'];
$gunid = $acc['gunid'];
$gunid = StoredFile::_normalizeGunid($acc['gunid']);
if(PEAR::isError($acc)){ return $acc; }
$linkFname = "{$this->accessDir}/$token.$ext";
$res = $this->dbc->query("
DELETE FROM {$this->accessTable} WHERE token='$token'
DELETE FROM {$this->accessTable} WHERE token=x'$token'::bigint
");
if(PEAR::isError($res)){ return $res; }
if(! @unlink($linkFname)){
@ -339,10 +341,11 @@ class BasicStor extends Alib{
{
if($part == 'metadata'){
$gunid = $this->dbc->getOne("
SELECT gunid FROM {$this->accessTable}
WHERE token='{$token}' AND type='download'
SELECT to_hex(gunid)as gunid FROM {$this->accessTable}
WHERE token=x'{$token}'::bigint AND type='download'
");
if(PEAR::isError($gunid)){ return $gunid; }
$gunid = StoredFile::_normalizeGunid($gunid);
$fname = "{$this->bufferDir}/$gunid";
@unlink($fname);
}
@ -365,7 +368,7 @@ class BasicStor extends Alib{
INSERT INTO {$this->accessTable}
(gunid, sessid, token, ext, chsum, type, ts)
VALUES
('{$gunid}', '$sessid', '$token',
(x'{$gunid}'::bigint, '$sessid', x'$token'::bigint,
'$ext', '$chsum', 'put', now())
");
if(PEAR::isError($res)){ return $res; }
@ -390,7 +393,7 @@ class BasicStor extends Alib{
}
$chsum = $this->dbc->getOne("
SELECT chsum FROM {$this->accessTable}
WHERE token='{$token}'
WHERE token=x'{$token}'::bigint
");
$fname = "{$this->accessDir}/$token";
$md5sum = md5_file($fname);
@ -400,7 +403,7 @@ class BasicStor extends Alib{
);
}
$res = $this->dbc->query("
DELETE FROM {$this->accessTable} WHERE token='$token'
DELETE FROM {$this->accessTable} WHERE token=x'$token'::bigint
");
if(PEAR::isError($res)){ return $res; }
return $fname;
@ -544,14 +547,54 @@ class BasicStor extends Alib{
*/
function bsLocalSearch($criteria)
{
$ftsrch = $criteria;
$res = $this->dbc->getCol("SELECT md.gunid as gunid
$types = array('and'=>'AND', 'or'=>'OR');
$ops = array('full'=>"='%s'", 'partial'=>"like '%%%s%%'", 'prefix'=>"like '%s%%'",
'<'=>"< '%s'", '='=>"= '%s'", '>'=>"> '%s'", '<='=>"<= '%s'", '>='=>">= '%s'"
);
# var_dump($criteria);
echo "\n";
$type = strtolower($criteria['type']);
$conds = $criteria['conds'];
$whereArr = array();
foreach($conds as $cond){
$cat = strtolower($cond['cat']);
$opVal = sprintf($ops[$cond['op']], strtolower($cond['val']));
$sqlCond = "
%s.predicate = '".str_replace("%", "%%", $cat)."' AND
%s.objns='_L' AND lower(%s.object) ".str_replace("%", "%%", $opVal)."\n
";
# echo "$sqlCond\n";
$whereArr[] = "$sqlCond";
}
if($type == 'and'){
$from = array(); $joinArr = array();
foreach($whereArr as $i=>$v){
$from[] = "{$this->mdataTable} md$i";
$whereArr[$i] = sprintf($v, "md$i", "md$i", "md$i");
$joinArr[] = "md$i.gunid = md".($i+1).".gunid";
}
array_pop($joinArr);
$sql = "SELECT to_hex(md0.gunid)as gunid \nFROM ".join(", ", $from).
"\nWHERE ".join(' AND ', $whereArr);
if(count($joinArr)>0){ $sql .= " AND ".join(" AND ", $joinArr); }
}else{
foreach($whereArr as $i=>$v){
$whereArr[$i] = sprintf($v, "md", "md", "md");
}
$sql = "\nSELECT to_hex(gunid)as gunid \n".
"FROM {$this->mdataTable} md \nWHERE ".join(' OR ', $whereArr);
}
echo "$sql\n";
# var_dump($whereArr);
$sql0 = "SELECT to_hex(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 '%$criteria%'
GROUP BY md.gunid
");
";
$res = $this->dbc->getCol($sql);
if(!is_array($res)) $res = array();
// $res = array_map("StoredFile::_normalizeGunid", $res); // TODO: correct!
return $res;
}
@ -931,14 +974,16 @@ class BasicStor extends Alib{
function install()
{
parent::install();
$this->dbc->query("CREATE TABLE {$this->filesTable} (
echo "{$this->filesTable}\n";
$r = $this->dbc->query("CREATE TABLE {$this->filesTable} (
id int not null,
gunid char(32) not null, -- global unique ID
gunid bigint not null, -- global unique ID
name varchar(255) not null default'', -- human file id ;)
type varchar(255) not null default'', -- mime type
state varchar(128) not null default'empty', -- file state
currentlyAccessing int not null default 0 -- access counter
)");
if(PEAR::isError($r)) return $r;
$this->dbc->query("CREATE UNIQUE INDEX {$this->filesTable}_id_idx
ON {$this->filesTable} (id)");
$this->dbc->query("CREATE UNIQUE INDEX {$this->filesTable}_gunid_idx
@ -946,10 +991,11 @@ class BasicStor extends Alib{
$this->dbc->query("CREATE INDEX {$this->filesTable}_name_idx
ON {$this->filesTable} (name)");
echo "{$this->mdataTable}\n";
$this->dbc->createSequence("{$this->mdataTable}_id_seq");
$this->dbc->query("CREATE TABLE {$this->mdataTable} (
$r = $this->dbc->query("CREATE TABLE {$this->mdataTable} (
id int not null,
gunid char(32),
gunid bigint,
subjns varchar(255), -- subject namespace shortcut/uri
subject varchar(255) not null default '',
predns varchar(255), -- predicate namespace shortcut/uri
@ -958,6 +1004,7 @@ class BasicStor extends Alib{
objns varchar(255), -- object namespace shortcut/uri
object text
)");
if(PEAR::isError($r)) return $r;
$this->dbc->query("CREATE UNIQUE INDEX {$this->mdataTable}_id_idx
ON {$this->mdataTable} (id)");
$this->dbc->query("CREATE INDEX {$this->mdataTable}_gunid_idx
@ -967,15 +1014,17 @@ class BasicStor extends Alib{
$this->dbc->query("CREATE INDEX {$this->mdataTable}_pred_idx
ON {$this->mdataTable} (predns, predicate)");
$this->dbc->query("CREATE TABLE {$this->accessTable} (
gunid char(32) not null default'',
echo "{$this->accessTable}\n";
$r = $this->dbc->query("CREATE TABLE {$this->accessTable} (
gunid bigint,
sessid char(32) not null default'',
token char(32) not null default'',
token bigint,
chsum char(32) not null default'',
ext varchar(128) not null default'',
type varchar(20) not null default'',
ts timestamp
)");
if(PEAR::isError($r)) return $r;
$this->dbc->query("CREATE INDEX {$this->accessTable}_token_idx
ON {$this->accessTable} (token)");
$this->dbc->query("CREATE INDEX {$this->accessTable}_gunid_idx

View file

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.12 $
Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/GreenBox.php,v $
------------------------------------------------------------------------------*/
@ -35,7 +35,7 @@ require_once "BasicStor.php";
* LiveSupport file storage module
*
* @author $Author: tomas $
* @version $Revision: 1.12 $
* @version $Revision: 1.13 $
* @see BasicStor
*/
class GreenBox extends BasicStor{
@ -522,7 +522,7 @@ class GreenBox extends BasicStor{
function _idFromGunid($gunid)
{
return $this->dbc->getOne(
"SELECT id FROM {$this->filesTable} WHERE gunid='$gunid'"
"SELECT id FROM {$this->filesTable} WHERE gunid=x'$gunid'::bigint"
);
}
@ -535,9 +535,12 @@ class GreenBox extends BasicStor{
function _gunidFromId($id)
{
if(!is_numeric($id)) return NULL;
return $this->dbc->getOne(
"SELECT gunid FROM {$this->filesTable} WHERE id='$id'"
);
$gunid = $this->dbc->getOne("
SELECT to_hex(gunid)as gunid FROM {$this->filesTable}
WHERE id='$id'
");
if(is_null($gunid)) return NULL;
return StoredFile::_normalizeGunid($gunid);
}
}

View file

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/MetaData.php,v $
------------------------------------------------------------------------------*/
@ -111,8 +111,10 @@ class MetaData{
*/
function delete()
{
$res = $this->dbc->query("DELETE FROM {$this->mdataTable}
WHERE gunid='{$this->gunid}'");
$res = $this->dbc->query("
DELETE FROM {$this->mdataTable}
WHERE gunid=x'{$this->gunid}'::bigint
");
if(PEAR::isError($res)) return $res;
$this->exists = FALSE;
return TRUE;
@ -135,8 +137,11 @@ class MetaData{
*/
function dbCheck($gunid)
{
$cnt = $this->dbc->getOne("SELECT count(*)as cnt
FROM {$this->mdataTable} WHERE gunid='$gunid'");
$cnt = $this->dbc->getOne("
SELECT count(*)as cnt
FROM {$this->mdataTable}
WHERE gunid=x'$gunid'::bigint
");
if(PEAR::isError($cnt)) return $cnt;
return (intval($cnt) > 0);
}
@ -192,7 +197,7 @@ class MetaData{
$nameSpaces = array();
$arr = $this->dbc->getAll("SELECT subject, object
FROM {$this->mdataTable}
WHERE gunid='{$this->gunid}'
WHERE gunid=x'{$this->gunid}'::bigint
AND subjns='_L'
AND predns is null AND predicate='_namespace'
AND objns='_L'
@ -218,16 +223,19 @@ class MetaData{
function storeXMLNode($node, $parid=NULL, $mode='insert')
{
//echo $node->node_name().", ".$node->node_type().", ".$node->prefix().", $parid.\n";
// preprocessing:
switch($node->node_type()){
case 1: // element
case 2: // attribute
$subjns = (is_null($parid)? '_G' : '_I');
$subject = (is_null($parid)? $this->gunid : $parid);
// DOM XML extension doesn't like empty prefix - use '_d'
$prefix = $node->prefix(); $prefix = ($prefix === '' ? '_d' : $prefix);
if(!isset($this->nameSpaces[$prefix]))
$this->nameSpaces[$prefix] = $node->namespace_uri();
break;
}
// main processing:
switch($node->node_type()){
case 9: // document
$this->storeXMLNode($node->document_element(), $parid, $mode);
@ -264,6 +272,7 @@ class MetaData{
# echo"T\n";
if($node->is_blank_node()) break;
$objns_sql = "'_L'";
// coalesce ... returns the first of its arguments that is not NULL
$object_sql = "coalesce(object,'')||'".$node->node_value()."'";
$res = $this->dbc->query("
UPDATE {$this->mdataTable}
@ -297,7 +306,7 @@ class MetaData{
{
$res = $this->dbc->query("UPDATE {$this->mdataTable}
SET objns = '$objns', object = '$object'
WHERE gunid = '{$this->gunid}' AND id='$mdid'
WHERE gunid = x'{$this->gunid}'::bigint AND id='$mdid'
");
if(PEAR::isError($res)) return $res;
return TRUE;
@ -327,7 +336,7 @@ class MetaData{
$objns_sql = (is_null($objns) ? "NULL":"'$objns'" );
$object_sql = (is_null($object)? "NULL":"'$object'");
if($mode == 'update'){
$cond = "gunid = '{$this->gunid}' AND predns=$predns_sql
$cond = "gunid = x'{$this->gunid}'::bigint AND predns=$predns_sql
AND predicate='$predicate'";
if($subjns == '_I'){
$cond .= " AND subjns='_I' AND subject='$subject'";
@ -349,7 +358,7 @@ class MetaData{
objns , object
)
VALUES
($id, '{$this->gunid}', '$subjns', '$subject',
($id, x'{$this->gunid}'::bigint, '$subjns', '$subject',
$predns_sql, '$predicate', '$predxml',
$objns_sql, $object_sql
)
@ -376,8 +385,8 @@ class MetaData{
$domd =& domxml_new_xmldoc('1.0');
$row = $this->dbc->getRow("
SELECT * FROM {$this->mdataTable}
WHERE gunid='{$this->gunid}'
AND subjns='_G' AND subject='{$this->gunid}'
WHERE gunid=x'{$this->gunid}'::bigint
AND subjns='_G' AND subject=x'{$this->gunid}'::bigint
");
if(PEAR::isError($row)) return $row;
if(is_null($row)){
@ -412,7 +421,7 @@ class MetaData{
$xn->append_child(&$nxn);
$uri = $this->dbc->getOne("
SELECT object FROM {$this->mdataTable}
WHERE gunid='{$this->gunid}' AND predicate='_namespace'
WHERE gunid=x'{$this->gunid}'::bigint AND predicate='_namespace'
AND subjns='_L' AND subject='{$row['predns']}'
");
if(!is_null($uri) && $uri !== ''){
@ -440,7 +449,8 @@ class MetaData{
{
$qh = $this->dbc->query("
SELECT * FROM {$this->mdataTable}
WHERE gunid='{$this->gunid}' AND subjns='_I' AND subject='$parid'
WHERE gunid=x'{$this->gunid}'::bigint AND subjns='_I'
AND subject='$parid'
ORDER BY id
");
if(PEAR::isError($qh)) return $qh;

View file

@ -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/StoredFile.php,v $
------------------------------------------------------------------------------*/
@ -96,8 +96,8 @@ class StoredFile{
INSERT INTO {$ac->filesTable}
(id, name, gunid, type, state)
VALUES
('$oid', '{$ac->name}', '{$ac->gunid}', '{$ac->type}',
'incomplete')
('$oid', '{$ac->name}', x'{$ac->gunid}'::bigint,
'{$ac->type}', 'incomplete')
");
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
// --- metadata insert:
@ -154,9 +154,12 @@ class StoredFile{
*/
function recall(&$gb, $oid='', $gunid='')
{
$cond = ($oid != '' ? "id='".intval($oid)."'" : "gunid='$gunid'" );
$cond = ($oid != ''
? "id='".intval($oid)."'"
: "gunid=x'$gunid'::bigint"
);
$row = $gb->dbc->getRow("
SELECT id, gunid, type, name
SELECT id, to_hex(gunid)as gunid, type, name
FROM {$gb->filesTable} WHERE $cond
");
if(PEAR::isError($row)) return $row;
@ -166,7 +169,8 @@ class StoredFile{
GBERR_FOBJNEX
);
}
$ac =& new StoredFile(&$gb, $row['gunid']);
$gunid = StoredFile::_normalizeGunid($row['gunid']);
$ac =& new StoredFile(&$gb, $gunid);
$ac->type = $row['type'];
$ac->name = $row['name'];
$ac->id = $row['id'];
@ -196,11 +200,15 @@ class StoredFile{
*/
function recallByToken(&$gb, $token)
{
$gunid = $gb->dbc->getOne("SELECT gunid FROM {$gb->accessTable}
WHERE token='$token'");
$gunid = $gb->dbc->getOne("
SELECT to_hex(gunid)as gunid
FROM {$gb->accessTable}
WHERE token=x'$token'::bigint
");
if(PEAR::isError($gunid)) return $gunid;
if(is_null($gunid)) return PEAR::raiseError(
"StoredFile::recallByToken: invalid token ($token)", GBERR_AOBJNEX);
$gunid = StoredFile::_normalizeGunid($gunid);
return StoredFile::recall(&$gb, '', $gunid);
}
@ -270,7 +278,7 @@ class StoredFile{
$res = $this->dbc->query("
UPDATE {$this->filesTable}
SET currentlyAccessing=currentlyAccessing+1
WHERE gunid='{$this->gunid}'
WHERE gunid=x'{$this->gunid}'::bigint
");
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
# $token = $this->_createGunid();
@ -298,7 +306,7 @@ class StoredFile{
$this->dbc->query("BEGIN");
$res = $this->dbc->query("UPDATE {$this->filesTable}
SET currentlyAccessing=currentlyAccessing-1
WHERE gunid='{$this->gunid}' AND currentlyAccessing>0
WHERE gunid=x'{$this->gunid}'::bigint AND currentlyAccessing>0
");
if(PEAR::isError($res)){ $this->dbc->query("ROLLBACK"); return $res; }
$res = $this->gb->bsRelease($token);
@ -408,7 +416,7 @@ class StoredFile{
{
$res = $this->dbc->query("
UPDATE {$this->filesTable} SET name='$newname'
WHERE gunid='{$this->gunid}'
WHERE gunid=x'{$this->gunid}'::bigint
");
if(PEAR::isError($res)) return $res;
return TRUE;
@ -424,7 +432,7 @@ class StoredFile{
{
$res = $this->dbc->query("
UPDATE {$this->filesTable} SET state='$state'
WHERE gunid='{$this->gunid}'
WHERE gunid=x'{$this->gunid}'::bigint
");
if(PEAR::isError($res)){ return $res; }
return TRUE;
@ -440,7 +448,7 @@ class StoredFile{
{
$res = $this->dbc->query("
UPDATE {$this->filesTable} SET type='$type'
WHERE gunid='{$this->gunid}'
WHERE gunid=x'{$this->gunid}'::bigint
");
if(PEAR::isError($res)){ return $res; }
return TRUE;
@ -458,17 +466,23 @@ class StoredFile{
if(PEAR::isError($res)) return $res;
$res = $this->md->delete();
if(PEAR::isError($res)) return $res;
$tokens = $this->dbc->getAll("SELECT token, ext FROM {$this->accessTable}
WHERE gunid='{$this->gunid}'");
$tokens = $this->dbc->getAll("
SELECT to_hex(token)as token, ext FROM {$this->accessTable}
WHERE gunid=x'{$this->gunid}'::bigint
");
if(is_array($tokens)) foreach($tokens as $i=>$item){
$file = $this->_getAccessFname($item['token'], $item['ext']);
if(file_exists($file)){ @unlink($file); }
}
$res = $this->dbc->query("DELETE FROM {$this->accessTable}
WHERE gunid='{$this->gunid}'");
$res = $this->dbc->query("
DELETE FROM {$this->accessTable}
WHERE gunid=x'{$this->gunid}'::bigint
");
if(PEAR::isError($res)) return $res;
$res = $this->dbc->query("DELETE FROM {$this->filesTable}
WHERE gunid='{$this->gunid}'");
$res = $this->dbc->query("
DELETE FROM {$this->filesTable}
WHERE gunid=x'{$this->gunid}'::bigint
");
if(PEAR::isError($res)) return $res;
return TRUE;
}
@ -484,7 +498,7 @@ class StoredFile{
if(is_null($gunid)) $gunid = $this->gunid;
return (0 < $this->dbc->getOne("
SELECT currentlyAccessing FROM {$this->filesTable}
WHERE gunid='$gunid'
WHERE gunid=x'$gunid'::bigint
"));
}
@ -504,8 +518,8 @@ class StoredFile{
function exists()
{
$indb = $this->dbc->getRow("
SELECT gunid FROM {$this->filesTable}
WHERE gunid='{$this->gunid}'
SELECT to_hex(gunid) FROM {$this->filesTable}
WHERE gunid=x'{$this->gunid}'::bigint
");
return (!is_null($indb) && $this->rmd->exists());
}
@ -517,9 +531,21 @@ class StoredFile{
*/
function _createGunid()
{
return md5(
microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport"
);
$initString =
microtime().$_SERVER['SERVER_ADDR'].rand()."org.mdlf.livesupport";
$hash = md5($initString);
// int8
$res = substr($hash, 0, 16);
return StoredFile::_normalizeGunid($res);
}
/**
* Create new global unique id
*
*/
function _normalizeGunid($gunid0)
{
return str_pad($gunid0, 16, "0", STR_PAD_LEFT);
}
/**
@ -532,8 +558,10 @@ class StoredFile{
function _idFromGunid($gunid=NULL)
{
if(is_null($gunid)) $gunid = $this->$gunid;
$id = $this->dbc->getOne("SELECT id FROM {$this->filesTable}
WHERE gunid='$gunid'");
$id = $this->dbc->getOne("
SELECT id FROM {$this->filesTable}
WHERE gunid=x'$gunid'::bigint
");
if(is_null($id)) return PEAR::raiseError(
"StoredFile::_idFromGunid: no such global unique id ($gunid)"
);
@ -566,7 +594,7 @@ class StoredFile{
{
return $this->dbc->getOne("
SELECT type FROM {$this->filesTable}
WHERE gunid='$gunid'
WHERE gunid=x'$gunid'::bigint
");
}
@ -600,8 +628,7 @@ class StoredFile{
*/
function _getAccessFname($token, $ext='EXT')
{
$spart = md5($token);
return "{$this->accessDir}/$spart.$ext";
return "{$this->accessDir}/$token.$ext";
}
}
?>

View file

@ -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/install/install.php,v $
------------------------------------------------------------------------------*/
@ -63,7 +63,8 @@ echo "\n# storageServer: Install ...\n";
$dbc->setErrorHandling(PEAR_ERROR_RETURN);
$gb->uninstall();
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "%s<hr>\n");
$gb->install();
$r = $gb->install();
if(PEAR::isError($r)){ echo $r->getUserInfo()."\n"; exit; }
echo "# Testing ...\n";
$gb->test();

View file

@ -26,7 +26,7 @@
<xbmf:episodetitle >Episode Title txt</xbmf:episodetitle>
<xbmf:episodesequence >Episode sequence</xbmf:episodesequence>
<xbmf:contributor>
<xbmf:role>Editor</xbmf:role>
<xbmf:role>Author</xbmf:role>
<xbmf:name>John X</xbmf:name>
<xbmf:phone>123456789</xbmf:phone>
</xbmf:contributor>

View file

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/put.php,v $
------------------------------------------------------------------------------*/
@ -71,7 +71,7 @@ function http_error($code, $err){
exit;
}
if(preg_match("|^[0-9a-f]{32}$|", $_REQUEST['token'])){
if(preg_match("|^[0-9a-f]{16}$|", $_REQUEST['token'])){
$token = $_REQUEST['token'];
}else{
http_error(400, "Error on token parameter. ({$_REQUEST['token']})");

View file

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.4 $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/simpleGet.php,v $
------------------------------------------------------------------------------*/
@ -76,7 +76,7 @@ if(preg_match("|^[0-9a-f]{32}$|", $_REQUEST['sessid'])){
}else{
http_error(400, "Error on sessid parameter. ({$_REQUEST['sessid']})");
}
if(preg_match("|^[0-9a-f]{32}$|", $_REQUEST['id'])){
if(preg_match("|^[0-9a-f]{16}$|", $_REQUEST['id'])){
$gunid = $_REQUEST['id'];
}else{
http_error(400, "Error on id parameter. ({$_REQUEST['id']})");

View file

@ -24,7 +24,7 @@
#
#
# Author : $Author: tomas $
# Version : $Revision: 1.6 $
# Version : $Revision: 1.7 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/Attic/xr_cli_test.py,v $
#
#------------------------------------------------------------------------------
@ -117,7 +117,8 @@ try:
elif method=="updateAudioClipMetadata":
print server.locstor.updateAudioClipMetadata({'sessid':pars[0], 'gunid':pars[1], 'mdataFileLP':pars[2]})
elif method=="searchMetadata":
print server.locstor.searchMetadata({'sessid':pars[0], 'criteria':pars[1]})
# print server.locstor.searchMetadata({'sessid':pars[0], 'criteria':pars[1]})
print server.locstor.searchMetadata({'sessid':pars[0], 'criteria':{'type':'and', 'conds':['a', 'b']}})
elif method=="getAudioClip":
r = server.locstor.getAudioClip({'sessid':pars[0], 'gunid':pars[1]})
print r['metadata']