diff --git a/livesupport/modules/storageServer/bin/resetStorage.sh b/livesupport/modules/storageServer/bin/resetStorage.sh index c7b6dc6bf..a1a6b15de 100755 --- a/livesupport/modules/storageServer/bin/resetStorage.sh +++ b/livesupport/modules/storageServer/bin/resetStorage.sh @@ -39,7 +39,7 @@ echo "# storageServer root URL: $WWW_ROOT" cd $reldir/var/xmlrpc php -q xr_cli_test.php -s $WWW_ROOT/xmlrpc/xrLocStor.php \ - resetStorage || exit $? + resetStorage 1 0 || exit $? echo "# resetStorage: OK" exit 0 diff --git a/livesupport/modules/storageServer/var/BasicStor.php b/livesupport/modules/storageServer/var/BasicStor.php index b5cff5b7d..0a8ea097c 100644 --- a/livesupport/modules/storageServer/var/BasicStor.php +++ b/livesupport/modules/storageServer/var/BasicStor.php @@ -1278,23 +1278,26 @@ class BasicStor extends Alib{ /** * Reset storageServer for debugging. * - * @param loadSampleData boolean - allows deny sample data loading + * @param loadSampleData boolean - flag for allow sample data loading + * @param filesOnly boolean - flag for operate only on files in storage */ - function resetStorage($loadSampleData=TRUE) + function resetStorage($loadSampleData=TRUE, $filesOnly=FALSE) { - $this->deleteData(); + if($filesOnly) $this->deleteFiles(); + else $this->deleteData(); if(!$this->config['isArchive']){ $tr =& new Transport($this->dbc, $this, $this->config); $tr->resetData(); } + $res = array( + 'audioclips'=>array(), 'playlists'=>array(), 'webstreams'=>array() + ); + if(!$loadSampleData) return $res; $rootHD = $this->getObjId('root', $this->storId); $samples = dirname(__FILE__)."/tests/sampleData.php"; if(file_exists($samples)){ include $samples; }else $sampleData = array(); - $res = array( - 'audioclips'=>array(), 'playlists'=>array(), 'webstreams'=>array() - ); foreach($sampleData as $k=>$it){ $type = $it['type']; $xml = $it['xml']; @@ -1353,6 +1356,18 @@ class BasicStor extends Alib{ echo"
\n"; print_r($va); #exit; } + /** + * deleteFiles + * + * @return void + */ + function deleteFiles() + { + $ids = $this->dbc->getAll("SELECT id FROM {$this->filesTable}"); + if(is_array($ids)) foreach($ids as $i=>$item){ + $this->bsDeleteFile($item['id'], TRUE); + } + } /** * deleteData * @@ -1360,11 +1375,7 @@ class BasicStor extends Alib{ */ function deleteData() { -// $this->dbc->query("DELETE FROM {$this->filesTable}"); - $ids = $this->dbc->getAll("SELECT id FROM {$this->filesTable}"); - if(is_array($ids)) foreach($ids as $i=>$item){ - $this->bsDeleteFile($item['id'], TRUE); - } + $this->deleteFiles(); parent::deleteData(); $this->initData(); } diff --git a/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php b/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php index 1368f4be6..ddbe56413 100644 --- a/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php +++ b/livesupport/modules/storageServer/var/xmlrpc/XR_LocStor.php @@ -1870,7 +1870,15 @@ class XR_LocStor extends LocStor{ * * The XML-RPC name of this method is "locstor.resetStorage". * - * The input parameters are an empty XML-RPC struct. + * The input parameters are an empty XML-RPC struct, + * or struct with the following optional fields: + *