existsFile/existsAudioClip/existsPlaylist corrected.
+BasicStor: webstream support added to resetStorage.
This commit is contained in:
parent
2fdac68efa
commit
9f224b6fb5
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.30 $
|
Version : $Revision: 1.31 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -52,7 +52,7 @@ require_once "Transport.php";
|
||||||
* Core of LiveSupport file storage module
|
* Core of LiveSupport file storage module
|
||||||
*
|
*
|
||||||
* @author $Author: tomas $
|
* @author $Author: tomas $
|
||||||
* @version $Revision: 1.30 $
|
* @version $Revision: 1.31 $
|
||||||
* @see Alib
|
* @see Alib
|
||||||
*/
|
*/
|
||||||
class BasicStor extends Alib{
|
class BasicStor extends Alib{
|
||||||
|
@ -825,8 +825,12 @@ class BasicStor extends Alib{
|
||||||
default: return $ac;
|
default: return $ac;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!is_null($ftype) && ($this->_getType($ac->gunid) != $ftype))
|
$realFtype = $this->_getType($ac->gunid);
|
||||||
return FALSE;
|
if(!is_null($ftype) && (
|
||||||
|
($realFtype != $ftype)
|
||||||
|
// webstreams are subset of audioclips
|
||||||
|
&& !($realFtype == 'webstream' && $ftype == 'audioclip')
|
||||||
|
)) return FALSE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1132,32 +1136,31 @@ class BasicStor extends Alib{
|
||||||
}
|
}
|
||||||
$rootHD = $this->getObjId('root', $this->storId);
|
$rootHD = $this->getObjId('root', $this->storId);
|
||||||
include"../tests/sampleData.php";
|
include"../tests/sampleData.php";
|
||||||
$res = array('audioclips'=>array(), 'playlists'=>array());
|
$res = array(
|
||||||
|
'audioclips'=>array(), 'playlists'=>array(), 'webstreams'=>array()
|
||||||
|
);
|
||||||
foreach($sampleData as $k=>$it){
|
foreach($sampleData as $k=>$it){
|
||||||
switch($it['type']){
|
$type = $it['type'];
|
||||||
|
$xml = $it['xml'];
|
||||||
|
if(isset($it['gunid'])) $gunid = $it['gunid'];
|
||||||
|
else $gunid = '';
|
||||||
|
switch($type){
|
||||||
case"audioclip":
|
case"audioclip":
|
||||||
$media = $it['media'];
|
$media = $it['media'];
|
||||||
$xml = $it['xml'];
|
$fname = basename($media);
|
||||||
if(isset($it['gunid'])) $gunid = $it['gunid'];
|
|
||||||
else $gunid = '';
|
|
||||||
$r = $this->bsPutFile(
|
|
||||||
$rootHD, basename($media),
|
|
||||||
$media, $xml, $gunid, 'audioclip'
|
|
||||||
);
|
|
||||||
if(PEAR::isError($r)){ return $r; }
|
|
||||||
$res['audioclips'][] = $this->_gunidFromId($r);
|
|
||||||
break;
|
break;
|
||||||
case"playlist":
|
case"playlist":
|
||||||
$xml = $it['xml'];
|
case"webstream":
|
||||||
if(isset($it['gunid'])) $gunid = $it['gunid'];
|
$media = '';
|
||||||
else $gunid = '';
|
$fname = basename($xml);
|
||||||
$r = $this->bsPutFile(
|
|
||||||
$rootHD, basename($xml), '', $xml, $gunid, 'playlist'
|
|
||||||
);
|
|
||||||
if(PEAR::isError($r)){ return $r; }
|
|
||||||
$res['playlists'][] = $this->_gunidFromId($r);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
$r = $this->bsPutFile(
|
||||||
|
$rootHD, $fname,
|
||||||
|
$media, $xml, $gunid, $type
|
||||||
|
);
|
||||||
|
if(PEAR::isError($r)){ return $r; }
|
||||||
|
$res["{$type}s"][] = $this->_gunidFromId($r);
|
||||||
}
|
}
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: tomas $
|
Author : $Author: tomas $
|
||||||
Version : $Revision: 1.32 $
|
Version : $Revision: 1.33 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -394,9 +394,10 @@ class LocStor extends BasicStor{
|
||||||
function existsAudioClip($sessid, $gunid)
|
function existsAudioClip($sessid, $gunid)
|
||||||
{
|
{
|
||||||
$ex = $this->existsFile($sessid, $gunid, 'audioclip');
|
$ex = $this->existsFile($sessid, $gunid, 'audioclip');
|
||||||
if($ex === FALSE ){
|
// webstreams are subset of audioclips - moved to BasicStor
|
||||||
$ex = $this->existsFile($sessid, $gunid, 'webstream');
|
// if($ex === FALSE ){
|
||||||
}
|
// $ex = $this->existsFile($sessid, $gunid, 'webstream');
|
||||||
|
// }
|
||||||
if($ex === FALSE ) return FALSE;
|
if($ex === FALSE ) return FALSE;
|
||||||
if(PEAR::isError($ex)){ return $ex; }
|
if(PEAR::isError($ex)){ return $ex; }
|
||||||
$ac =& StoredFile::recallByGunid($this, $gunid);
|
$ac =& StoredFile::recallByGunid($this, $gunid);
|
||||||
|
@ -416,10 +417,10 @@ class LocStor extends BasicStor{
|
||||||
{
|
{
|
||||||
$id = $this->_idFromGunid($gunid);
|
$id = $this->_idFromGunid($gunid);
|
||||||
if(is_null($id)) return FALSE;
|
if(is_null($id)) return FALSE;
|
||||||
$ex = $this->bsExistsFile($id, $ftype);
|
|
||||||
if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE)
|
if(($res = $this->_authorize('read', $id, $sessid)) !== TRUE)
|
||||||
return $res;
|
return $res;
|
||||||
return TRUE;
|
$ex = $this->bsExistsFile($id, $ftype);
|
||||||
|
return $ex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue