resetStorage method moved to BasicStor.

This commit is contained in:
tomas 2005-02-18 02:55:35 +00:00
parent 901ebe2646
commit 7fa94a3d5b
2 changed files with 47 additions and 47 deletions

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.29 $
Version : $Revision: 1.30 $
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
*
* @author $Author: tomas $
* @version $Revision: 1.29 $
* @version $Revision: 1.30 $
* @see Alib
*/
class BasicStor extends Alib{
@ -1118,6 +1118,50 @@ class BasicStor extends Alib{
}
/* =============================================== test and debug methods */
/**
* Reset storageServer for debugging.
*
* @param input string
*/
function resetStorage($input='')
{
$this->deleteData();
if(!$this->config['isArchive']){
$tr =& new Transport($this->dbc, $this, $this->config);
$tr->resetData();
}
$rootHD = $this->getObjId('root', $this->storId);
include"../tests/sampleData.php";
$res = array('audioclips'=>array(), 'playlists'=>array());
foreach($sampleData as $k=>$it){
switch($it['type']){
case"audioclip":
$media = $it['media'];
$xml = $it['xml'];
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;
case"playlist":
$xml = $it['xml'];
if(isset($it['gunid'])) $gunid = $it['gunid'];
else $gunid = '';
$r = $this->bsPutFile(
$rootHD, basename($xml), '', $xml, $gunid, 'playlist'
);
if(PEAR::isError($r)){ return $r; }
$res['playlists'][] = $this->_gunidFromId($r);
break;
}
}
return $res;
}
/**
* dump
*

View File

@ -23,7 +23,7 @@
Author : $Author: tomas $
Version : $Revision: 1.31 $
Version : $Revision: 1.32 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/LocStor.php,v $
------------------------------------------------------------------------------*/
@ -457,50 +457,6 @@ class LocStor extends BasicStor{
return $ac->replaceMetaData($metadata, 'string');
}
/**
* Reset storageServer for debugging.
*
* @param input string
*/
function resetStorage($input='')
{
$this->deleteData();
if(!$this->config['isArchive']){
$tr =& new Transport($this->dbc, $this, $this->config);
$tr->resetData();
}
$rootHD = $this->getObjId('root', $this->storId);
include"../tests/sampleData.php";
$res = array('audioclips'=>array(), 'playlists'=>array());
foreach($sampleData as $k=>$it){
switch($it['type']){
case"audioclip":
$media = $it['media'];
$xml = $it['xml'];
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;
case"playlist":
$xml = $it['xml'];
if(isset($it['gunid'])) $gunid = $it['gunid'];
else $gunid = '';
$r = $this->bsPutFile(
$rootHD, basename($xml), '', $xml, $gunid, 'playlist'
);
if(PEAR::isError($r)){ return $r; }
$res['playlists'][] = $this->_gunidFromId($r);
break;
}
}
return $res;
}
/*====================================================== playlist methods */
/**
* Create a new empty playlist.