StoredFile::recallByGunid method added for more clear recalling by gunid.
This commit is contained in:
parent
a0eba92d89
commit
496e49a68c
|
@ -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/GreenBox.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -48,7 +48,7 @@ require_once "Transport.php";
|
|||
* LiveSupport file storage module
|
||||
*
|
||||
* @author $Author: tomas $
|
||||
* @version $Revision: 1.7 $
|
||||
* @version $Revision: 1.8 $
|
||||
* @see Alib
|
||||
*/
|
||||
class GreenBox extends Alib{
|
||||
|
@ -548,7 +548,7 @@ class GreenBox extends Alib{
|
|||
{
|
||||
if(!$gunid) $gunid = $this->_gunidFromId($id);
|
||||
else $id = $this->_idFromGunid($gunid);
|
||||
$ac =& StoredFile::recall(&$this, '', $gunid);
|
||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||
if(PEAR::isError($ac)) return $ac;
|
||||
$mediaTarget = $ac->_getRealRADFname();
|
||||
$mediaFile = "$gunid";
|
||||
|
|
|
@ -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/LocStor.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -46,7 +46,7 @@ class LocStor extends GreenBox{
|
|||
*/
|
||||
function existsAudioClip($sessid, $gunid)
|
||||
{
|
||||
$ac =& StoredFile::recall(&$this, '', $gunid);
|
||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||
if(PEAR::isError($ac)){
|
||||
// catch some exceptions
|
||||
switch($ac->getCode()){
|
||||
|
@ -73,7 +73,7 @@ class LocStor extends GreenBox{
|
|||
function storeAudioClip($sessid, $gunid, $mediaFileLP, $mdataFileLP)
|
||||
{
|
||||
// test if specified gunid exists:
|
||||
$ac =& StoredFile::recall(&$this, '', $gunid);
|
||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||
if(!PEAR::isError($ac)){
|
||||
// gunid exists - do replace
|
||||
if(($res = $this->_authorize(
|
||||
|
@ -117,7 +117,7 @@ class LocStor extends GreenBox{
|
|||
*/
|
||||
function deleteAudioClip($sessid, $gunid)
|
||||
{
|
||||
$ac =& StoredFile::recall(&$this, '', $gunid);
|
||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||
if(PEAR::isError($ac)) return $ac;
|
||||
if(($res = $this->_authorize('write', $ac->getId(), $sessid)) !== TRUE)
|
||||
return $res;
|
||||
|
@ -135,7 +135,7 @@ class LocStor extends GreenBox{
|
|||
*/
|
||||
function updateAudioClipMetadata($sessid, $gunid, $mdataFileLP)
|
||||
{
|
||||
$ac =& StoredFile::recall(&$this, '', $gunid);
|
||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||
if(PEAR::isError($ac)) return $ac;
|
||||
if(($res = $this->_authorize('write', $ac->getId(), $sessid)) !== TRUE)
|
||||
return $res;
|
||||
|
@ -150,7 +150,7 @@ class LocStor extends GreenBox{
|
|||
*/
|
||||
function accessRawAudioData($sessid, $gunid)
|
||||
{
|
||||
$ac =& StoredFile::recall(&$this, '', $gunid);
|
||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||
if(PEAR::isError($ac)) return $ac;
|
||||
if(($res = $this->_authorize('read', $ac->getId(), $sessid)) !== TRUE)
|
||||
return $res;
|
||||
|
@ -193,7 +193,7 @@ class LocStor extends GreenBox{
|
|||
*/
|
||||
function getAudioClip($sessid, $gunid)
|
||||
{
|
||||
$ac =& StoredFile::recall(&$this, '', $gunid);
|
||||
$ac =& StoredFile::recallByGunid(&$this, $gunid);
|
||||
if(PEAR::isError($ac)) return $ac;
|
||||
if(($res = $this->_authorize('read', $ac->getId(), $sessid)) !== TRUE)
|
||||
return $res;
|
||||
|
|
|
@ -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/StoredFile.php,v $
|
||||
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -131,7 +131,7 @@ class StoredFile{
|
|||
*/
|
||||
function recall(&$gb, $oid='', $gunid='')
|
||||
{
|
||||
$cond = ($gunid=='' ? "id='$oid'" : "gunid='$gunid'" );
|
||||
$cond = ($oid != '' ? "id='".intval($oid)."'" : "gunid='$gunid'" );
|
||||
$row = $gb->dbc->getRow("SELECT id, gunid, type, name
|
||||
FROM {$gb->filesTable} WHERE $cond");
|
||||
if(PEAR::isError($row)) return $row;
|
||||
|
@ -147,6 +147,18 @@ class StoredFile{
|
|||
$ac->id = $row['id'];
|
||||
return $ac;
|
||||
}
|
||||
/**
|
||||
* Create instace of StoreFile object and recall existing file
|
||||
* by gunid.<br>
|
||||
*
|
||||
* @param gb reference to GreenBox object
|
||||
* @param gunid string, optional, global unique id of file
|
||||
* @return instace of StoredFile object
|
||||
*/
|
||||
function recallByGunid(&$gb, $gunid='')
|
||||
{
|
||||
return StoredFile::recall(&$gb, '', $gunid);
|
||||
}
|
||||
/**
|
||||
* Create instace of StoreFile object and recall existing file from tmpLink
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue