From 2d9bb23bbea74927ea4ea8dd77079b89e35e15d3 Mon Sep 17 00:00:00 2001 From: tomas Date: Thu, 28 Jul 2005 11:49:34 +0000 Subject: [PATCH] The revertEditedPlaylist method moved to LocStor. --- .../modules/storageServer/var/GreenBox.php | 20 +++++----------- .../modules/storageServer/var/LocStor.php | 24 ++++++++++++++++++- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/livesupport/modules/storageServer/var/GreenBox.php b/livesupport/modules/storageServer/var/GreenBox.php index fb790549a..8ca6b3f30 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.65 $ + Version : $Revision: 1.66 $ 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.65 $ + * @version $Revision: 1.66 $ * @see BasicStor */ class GreenBox extends BasicStor{ @@ -611,19 +611,11 @@ class GreenBox extends BasicStor{ * @param sessid string, session ID * @return string gunid of playlist */ - function revertEditedPlaylist($token, $sessid) + function revertEditedPlaylist($token, $sessid='') { - $gunid = $this->bsCloseDownload($token, 'metadata'); - if(PEAR::isError($gunid)) return $gunid; - $ac =& StoredFile::recallByGunid($this, $gunid); - if(PEAR::isError($ac)){ return $ac; } - $id = $ac->getId(); - $mdata = $ac->getMetaData(); - if(PEAR::isError($mdata)){ return $mdata; } - $res = $ac->replaceMetaData($mdata, 'string'); - if(PEAR::isError($res)){ return $res; } - $this->_setEditFlag($gunid, FALSE, $sessid); - return $gunid; + require_once"LocStor.php"; + $lc =& new LocStor($this->dbc, $this->config); + return $lc->revertEditedPlaylist($token, $sessid); } /** diff --git a/livesupport/modules/storageServer/var/LocStor.php b/livesupport/modules/storageServer/var/LocStor.php index 4d75b3431..786a2ca09 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.39 $ + Version : $Revision: 1.40 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $ ------------------------------------------------------------------------------*/ @@ -562,6 +562,28 @@ class LocStor extends BasicStor{ return $playlistId; } + /** + * RollBack playlist changes to the locked state + * + * @param token string, playlist access token + * @param sessid string, session ID + * @return string gunid of playlist + */ + function revertEditedPlaylist($playlistToken, $sessid='') + { + $gunid = $this->bsCloseDownload($playlistToken, 'metadata'); + if(PEAR::isError($gunid)) return $gunid; + $ac =& StoredFile::recallByGunid($this, $gunid); + if(PEAR::isError($ac)){ return $ac; } + $id = $ac->getId(); + $mdata = $ac->getMetaData(); + if(PEAR::isError($mdata)){ return $mdata; } + $res = $ac->replaceMetaData($mdata, 'string'); + if(PEAR::isError($res)){ return $res; } + $this->_setEditFlag($gunid, FALSE, $sessid); + return $gunid; + } + /** * Delete a Playlist metafile. *