diff --git a/livesupport/modules/storageServer/Makefile b/livesupport/modules/storageServer/Makefile
index 98582cc81..9fcb3fe12 100644
--- a/livesupport/modules/storageServer/Makefile
+++ b/livesupport/modules/storageServer/Makefile
@@ -20,7 +20,7 @@
#
#
# Author : $Author: tomas $
-# Version : $Revision: 1.7 $
+# Version : $Revision: 1.8 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/Attic/Makefile,v $
#
# @configure_input@
@@ -124,6 +124,8 @@ testonly: ${TEST_RUNNER}
check: all testonly
+recheck: clean check
+
#-------------------------------------------------------------------------------
# Specific targets
#-------------------------------------------------------------------------------
diff --git a/livesupport/modules/storageServer/var/BasicStor.php b/livesupport/modules/storageServer/var/BasicStor.php
index ebcc7832f..521f3c031 100644
--- a/livesupport/modules/storageServer/var/BasicStor.php
+++ b/livesupport/modules/storageServer/var/BasicStor.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/BasicStor.php,v $
------------------------------------------------------------------------------*/
@@ -48,7 +48,7 @@ require_once "Transport.php";
* Core of LiveSupport file storage module
*
* @author $Author: tomas $
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
* @see Alib
*/
class BasicStor extends Alib{
@@ -184,9 +184,9 @@ class BasicStor extends Alib{
*/
function bsCopyFile($id, $did)
{
- if($this->getObjType($did)!=='Folder')
+ if($this->getObjType($did) !== 'Folder')
return PEAR::raiseError(
- 'GreenBox::copyFile: destination is not folder', GBERR_WRTYPE
+ 'BasicStor::bsCopyFile: destination is not folder', GBERR_WRTYPE
);
return $this->_copySubtree($id, $did);
}
@@ -424,12 +424,12 @@ class BasicStor extends Alib{
function bsCreateReplica($id, $did, $replicaName)
{
return PEAR::raiseError(
- 'GreenBox::createVersion: not implemented', GBERR_NOTIMPL
+ 'BasicStor::bsCreateReplica: not implemented', GBERR_NOTIMPL
);
// ---
- if($this->getObjType($did)!=='Folder')
+ if($this->getObjType($did) !== 'Folder')
return PEAR::raiseError(
- 'GreenBox::createReplica: dest is not folder', GBERR_WRTYPE
+ 'BasicStor::bsCreateReplica: dest is not folder', GBERR_WRTYPE
);
if($replicaName=='') $replicaName = $this->getObjName($id);
while(($exid = $this->getObjId($replicaName, $did))<>'')
@@ -452,7 +452,7 @@ class BasicStor extends Alib{
function bsCreateVersion($id, $did, $versionLabel)
{
return PEAR::raiseError(
- 'GreenBox::createVersion: not implemented', GBERR_NOTIMPL
+ 'BasicStor::bsCreateVersion: not implemented', GBERR_NOTIMPL
);
}
@@ -562,9 +562,9 @@ class BasicStor extends Alib{
*/
function bsListFolder($id)
{
- if($this->getObjType($id)!=='Folder')
+ if($this->getObjType($id) !== 'Folder')
return PEAR::raiseError(
- 'GreenBox::listFolder: not a folder', GBERR_NOTF
+ 'BasicStor::bsListFolder: not a folder', GBERR_NOTF
);
$a = $this->getDir($id, 'id, name, type, param as target', 'name');
return $a;
@@ -580,7 +580,7 @@ class BasicStor extends Alib{
function getObjIdFromRelPath($id, $relPath='.')
{
$a = split('/', $relPath);
- if($this->getObjType($id)!=='Folder') $nid = $this->getparent($id);
+ if($this->getObjType($id) !== 'Folder') $nid = $this->getparent($id);
else $nid = $id;
foreach($a as $i=>$item){
switch($item){
@@ -700,7 +700,7 @@ class BasicStor extends Alib{
$this->test_dump = $this->dumpTree($this->storId);
if($this->test_dump==$this->test_correct)
{ $this->test_log.="storageServer: OK\n"; return true; }
- else PEAR::raiseError('GreenBox::test:', 1, PEAR_ERROR_DIE, '%s'.
+ else PEAR::raiseError('BasicStor::test:', 1, PEAR_ERROR_DIE, '%s'.
"
\ncorrect:\n.{$this->test_correct}.\n".
"dump:\n.{$this->test_dump}.\n
\n");
}
diff --git a/livesupport/modules/storageServer/var/GreenBox.php b/livesupport/modules/storageServer/var/GreenBox.php
index 0c37d008c..b4619991b 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.15 $
+ Version : $Revision: 1.16 $
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.15 $
+ * @version $Revision: 1.16 $
* @see BasicStor
*/
class GreenBox extends BasicStor{
@@ -290,7 +290,16 @@ class GreenBox extends BasicStor{
{
if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE)
return $res;
- return $this->bsListFolder($id);
+ $listArr = $this->bsListFolder($id);
+ foreach($listArr as $i=>$v){
+ if($v['type'] == 'File'){
+ $gunid = $this->_gunidFromId($v['id']);
+ $listArr[$i]['type'] =
+ StoredFile::_getType($gunid);
+ $listArr[$i]['gunid'] = $gunid;
+ }
+ }
+ return $listArr;
}
/* ---------------------------------------------------- redefined methods */
@@ -362,6 +371,23 @@ class GreenBox extends BasicStor{
return $pa;
}
+ /**
+ * Get object type by id.
+ * (RootNode, Folder, File, )
+ *
+ * @param oid int, local object id
+ * @return string/err
+ */
+ function getObjType($oid)
+ {
+ $type = $this->getObjName($oid, 'type');
+ if($type == 'File'){
+ $type =
+ StoredFile::_getType($this->_gunidFromId($oid));
+ }
+ return $type;
+ }
+
/* ==================================================== "private" methods */
/**
@@ -373,10 +399,15 @@ class GreenBox extends BasicStor{
function copyObj($id, $newParid, $after='')
{
$nid = parent::copyObj($id, $newParid, $after='');
- if($this->getObjType($id)==='File'){
- $ac =& StoredFile::recall(&$this, $id);
- if(PEAR::isError($ac)){ return $ac; }
- $ac2 =& StoredFile::copyOf(&$ac, $nid);
+ switch($this->getObjType($id)){
+ case"audioclip":
+ case"playlist":
+ case"File":
+ $ac =& StoredFile::recall(&$this, $id);
+ if(PEAR::isError($ac)){ return $ac; }
+ $ac2 =& StoredFile::copyOf(&$ac, $nid);
+ break;
+ default:
}
return $nid;
}
@@ -403,6 +434,8 @@ class GreenBox extends BasicStor{
function removeObj($id)
{
switch($this->getObjType($id)){
+ case"audioclip":
+ case"playlist":
case"File":
$ac =& StoredFile::recall(&$this, $id);
if(!PEAR::isError($ac)){
diff --git a/livesupport/modules/storageServer/var/MetaData.php b/livesupport/modules/storageServer/var/MetaData.php
index 38835ed5f..72151fc11 100644
--- a/livesupport/modules/storageServer/var/MetaData.php
+++ b/livesupport/modules/storageServer/var/MetaData.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/MetaData.php,v $
------------------------------------------------------------------------------*/
@@ -34,6 +34,7 @@
* LiveSupport file storage support class.
* Store metadata tree in relational database.
* requires DOMXML support in PHP!
+ * TODO: use SAX parser instead of DOMXML
*
* @see StoredFile
*/
@@ -53,7 +54,11 @@ class MetaData{
$this->gunid = $gunid;
$this->resDir = $resDir;
$this->fname = $this->makeFname();
- $this->exists = $this->dbCheck($gunid) && file_exists($this->fname);
+ $this->exists =
+ $this->dbCheck($gunid) &&
+ is_file($this->fname) &&
+ is_readable($this->fname)
+ ;
}
/**
* Parse and store metadata from XML file or XML string
@@ -213,11 +218,16 @@ class MetaData{
{
switch($loc){
case"file":
- if(!file_exists($mdata)){
+ if(!is_file($mdata)){
return PEAR::raiseError(
"MetaData::storeXMLDoc: metadata file not found ($mdata)"
);
}
+ if(!is_readable($mdata)){
+ return PEAR::raiseError(
+ "MetaData::storeXMLDoc: can't read metadata file ($mdata)"
+ );
+ }
$xml = domxml_open_file($mdata);
break;
case"string":
diff --git a/livesupport/modules/storageServer/var/RawMediaData.php b/livesupport/modules/storageServer/var/RawMediaData.php
index ae0ab1e40..17b555039 100644
--- a/livesupport/modules/storageServer/var/RawMediaData.php
+++ b/livesupport/modules/storageServer/var/RawMediaData.php
@@ -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/RawMediaData.php,v $
------------------------------------------------------------------------------*/
@@ -52,7 +52,10 @@ class RawMediaData{
$this->gunid = $gunid;
$this->resDir = $resDir;
$this->fname = $this->makeFname();
- $this->exists = file_exists($this->fname);
+ $this->exists =
+ is_file($this->fname) &&
+ is_readable($this->fname)
+ ;
}
/**
@@ -116,41 +119,6 @@ class RawMediaData{
return $this->fname;
}
-/*
- /**
- * Make access symlink to the media file
- *
- * @param accLinkName string, access symlink name
- * @return string, access symlink name
- * /
- function access($accLinkName)
- {
- if(!$this->exists) return FALSE;
- if(file_exists($accLinkName)) return $accLinkName;
- if(@symlink($this->fname, $accLinkName)){
- return $accLinkName;
- }else return PEAR::raiseError(
- "RawMediaData::access: symlink create failed ($accLinkName)",
- GBERR_FILEIO
- );
- }
-
- /**
- * Delete access symlink
- *
- * @param accLinkName string, access symlink name
- * @return boolean or PEAR::error
- * /
- function release($accLinkName)
- {
- if(!$this->exists) return FALSE;
- if(@unlink($accLinkName)) return TRUE;
- else return PEAR::raiseError(
- "RawMediaData::release: unlink failed ($accLinkName)", GBERR_FILEIO
- );
- }
-*/
-
/**
* Delete media file from filesystem
*
diff --git a/livesupport/modules/storageServer/var/StoredFile.php b/livesupport/modules/storageServer/var/StoredFile.php
index a4d66981c..93339c958 100644
--- a/livesupport/modules/storageServer/var/StoredFile.php
+++ b/livesupport/modules/storageServer/var/StoredFile.php
@@ -23,7 +23,7 @@
Author : $Author: tomas $
- Version : $Revision: 1.11 $
+ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/StoredFile.php,v $
------------------------------------------------------------------------------*/
@@ -107,7 +107,7 @@ class StoredFile{
if($mdataLoc=='file' && !file_exists($metadata))
{
return PEAR::raiseError("StoredFile::insert: ".
- "metadata file doesn't exists ($metadata)");
+ "metadata file not found ($metadata)");
}
$res = $ac->md->insert($metadata, $mdataLoc);
if(PEAR::isError($res)){
@@ -120,7 +120,7 @@ class StoredFile{
if(!file_exists($mediaFileLP))
{
return PEAR::raiseError("StoredFile::insert: ".
- "media file doesn't exists ($mediaFileLP)");
+ "media file not found ($mediaFileLP)");
}
$res = $ac->rmd->insert($mediaFileLP);
if(PEAR::isError($res)){
@@ -550,11 +550,18 @@ class StoredFile{
*/
function _getExt()
{
- switch($this->mime){
- case"audio/mpeg": $ext="mp3"; break;
- case"audio/x-wave": $ext="wav"; break;
- case"application/x-ogg": $ext="ogg"; break;
- default: $ext="bin"; break;
+ switch(strtolower($this->mime)){
+ case"audio/mpeg":
+ $ext="mp3"; break;
+ case"audio/x-wav":
+ case"audio/x-wave":
+ $ext="wav"; break;
+ case"audio/x-ogg":
+ case"application/x-ogg":
+ case"application/x-ogg":
+ $ext="ogg"; break;
+ default:
+ $ext="bin"; break;
}
return $ext;
}
diff --git a/livesupport/modules/storageServer/var/conf.php b/livesupport/modules/storageServer/var/conf.php
index 9716798f2..590eea080 100644
--- a/livesupport/modules/storageServer/var/conf.php
+++ b/livesupport/modules/storageServer/var/conf.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/conf.php,v $
------------------------------------------------------------------------------*/
@@ -88,12 +88,16 @@ $config = array(
'Storage' => array('Folder', 'File', 'Replica'),
'Folder' => array('Folder', 'File', 'Replica'),
'File' => array(),
+ 'audioclip' => array(),
+ 'playlist' => array(),
'Replica' => array(),
),
'allowedActions'=> array(
'RootNode' => array('classes', 'subjects'),
'Folder' => array('editPrivs', 'write', 'read'),
'File' => array('editPrivs', 'write', 'read'),
+ 'audioclip' => array('editPrivs', 'write', 'read'),
+ 'playlist' => array('editPrivs', 'write', 'read'),
'Replica' => array('editPrivs', 'write', 'read'),
'_class' => array('editPrivs', 'write', 'read'),
),
diff --git a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
index fb00d0012..a7f9b9d41 100644
--- a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
+++ b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
@@ -100,22 +100,22 @@ $tpldata['showMenu']=true;
function fmove(id, relPath){
var newPath=prompt('Destination folder (relative path):', relPath);
if(newPath==null) return;
- location.href='gbHttp.php?id='+id+'&act=move&newPath='+newPath;
+ location.href='gbHttp.php?id='+id+'&act=move&newPath='+newPath;
}
function fcopy(id, relPath){
var newPath=prompt('Destination folder (relative path):', relPath);
if(newPath==null) return;
- location.href='gbHttp.php?id='+id+'&act=copy&newPath='+newPath;
+ location.href='gbHttp.php?id='+id+'&act=copy&newPath='+newPath;
}
function freplicate(name, id){
var np=prompt('Destination folder (relative path):', id);
if(np==null) return;
- location.href='gbHttp.php?id='+id+'&act=repl&newparid='+np;
+ location.href='gbHttp.php?id='+id+'&act=repl&newparid='+np;
}
function newFolder(){
var nn=prompt('New folder name:');
if(nn==null) return;
- location.href='gbHttp.php?id=&act=newFolder&newname='+nn;
+ location.href='gbHttp.php?id=&act=newFolder&newname='+nn;
}
-->
@@ -130,15 +130,15 @@ $tpldata['showMenu']=true;
- Tree
+ Tree
/
@@ -157,13 +157,16 @@ $tpldata['showMenu']=true;
+ fname | gunid | actions |
href="gbHtmlBrowse.php?id=">
+ |
+ ()
|
- 'D', 'File'=>'F', 'Replica'=>'R'); echo$a[$o['type']]?>
+ 'D', 'File'=>'F', 'Replica'=>'R', 'audioclip'=>'A', 'playlist'=>'P'); echo$a[$o['type']]?>
rename
move
copy
@@ -171,12 +174,15 @@ $tpldata['showMenu']=true;
replicate
permissions
- DEL
-
- Access
- Analyze
- MetaData
+
+ simpleGet
+ Analyze
+ MetaData
+
+
+ MetaData
(->)
@@ -228,7 +234,7 @@ $tpldata['showMenu']=true;
$v){?>
- -
+
-
No items found
diff --git a/livesupport/modules/storageServer/var/html/gbHttp.php b/livesupport/modules/storageServer/var/html/gbHttp.php
index 9fe27e961..e6cd210af 100644
--- a/livesupport/modules/storageServer/var/html/gbHttp.php
+++ b/livesupport/modules/storageServer/var/html/gbHttp.php
@@ -23,7 +23,7 @@
Author : $Author: tomas $
- Version : $Revision: 1.9 $
+ Version : $Revision: 1.10 $
Location : $ $
------------------------------------------------------------------------------*/
@@ -33,7 +33,7 @@ require_once"gbHtml_h.php";
* storageServer WWW-form interface
*
* @author $Author: tomas $
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
* @see Alib
* @see GreenBox
*/
@@ -244,6 +244,7 @@ switch($_REQUEST['act']){
header("Content-type: text/plain");
$ia = $gb->analyzeFile($id, $sessid);
echo"fileformat: {$ia['fileformat']}\n";
+ echo"mime: {$ia['mime_type']}\n";
echo"channels: {$ia['audio']['channels']}\n";
echo"sample_rate: {$ia['audio']['sample_rate']}\n";
echo"bits_per_sample: {$ia['audio']['bits_per_sample']}\n";
diff --git a/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh b/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh
index 326986f95..d18e3c449 100755
--- a/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh
+++ b/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh
@@ -23,7 +23,7 @@
#
#
# Author : $Author: tomas $
-# Version : $Revision: 1.10 $
+# Version : $Revision: 1.11 $
# Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/xmlrpc/testRunner.sh,v $
#-------------------------------------------------------------------------------
@@ -220,7 +220,7 @@ existsPlaylist() {
}
deletePlaylist() {
- echo -n "# deletePlaylist: "
+ echo -n "# deletePlaylist (${PLID}): "
$XR_CLI deletePlaylist $SESSID $PLID
# || exit $?
echo "# status: $?"
@@ -280,7 +280,7 @@ elif [ "$COMM" == "playlists" ]; then
accessPlaylist
editPlaylist
accessPlaylist
-# deletePlaylist
+ deletePlaylist
existsPlaylist
logout
echo "#XMLRPC: playlists: OK."
|