diff --git a/livesupport/modules/storageServer/var/BasicStor.php b/livesupport/modules/storageServer/var/BasicStor.php index 97af38564..db4b0d1a0 100644 --- a/livesupport/modules/storageServer/var/BasicStor.php +++ b/livesupport/modules/storageServer/var/BasicStor.php @@ -23,7 +23,7 @@ Author : $Author: tomas $ - Version : $Revision: 1.16 $ + Version : $Revision: 1.17 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/BasicStor.php,v $ ------------------------------------------------------------------------------*/ @@ -50,7 +50,7 @@ require_once "StoredFile.php"; * Core of LiveSupport file storage module * * @author $Author: tomas $ - * @version $Revision: 1.16 $ + * @version $Revision: 1.17 $ * @see Alib */ class BasicStor extends Alib{ @@ -184,6 +184,8 @@ class BasicStor extends Alib{ return PEAR::raiseError( "BasicStor::moveFile: destination is not folder ($did)", GBERR_WRTYPE ); + $parid = $this->getParent($id); + if($parid == $did) return TRUE; $this->_relocateSubtree($id, $did); } @@ -211,7 +213,6 @@ class BasicStor extends Alib{ */ function bsDeleteFile($id) { - $parid = $this->getParent($id); $res = $this->removeObj($id); if(PEAR::isError($res)) return $res; return TRUE; @@ -747,7 +748,7 @@ class BasicStor extends Alib{ "; $this->test_dump = $this->dumpTree($this->storId); if($this->test_dump==$this->test_correct) - { $this->test_log.="storageServer: OK\n"; return true; } + { $this->test_log.="# BasicStor::test: OK\n"; return true; } else PEAR::raiseError('BasicStor::test:', 1, PEAR_ERROR_DIE, '%s'. "
\ncorrect:\n.{$this->test_correct}.\n".
"dump:\n.{$this->test_dump}.\n\n");
@@ -874,7 +875,7 @@ class BasicStor extends Alib{
$this->dbc->dropSequence("{$this->mdataTable}_id_seq");
$this->dbc->query("DROP TABLE {$this->filesTable}");
$this->dbc->query("DROP TABLE {$this->accessTable}");
- $d = dir($this->storageDir);
+ $d = @dir($this->storageDir);
while (is_object($d) && (false !== ($entry = $d->read()))){
if(filetype("{$this->storageDir}/$entry")=='dir' &&
$entry!='CVS' && strlen($entry)==3)
@@ -894,7 +895,7 @@ class BasicStor extends Alib{
while (false !== ($entry = $d->read())) if(substr($entry,0,1)!='.')
{ unlink("{$this->bufferDir}/$entry"); }
$d->close();
- rmdir($this->bufferDir);
+ @rmdir($this->bufferDir);
}
parent::uninstall();
}
diff --git a/livesupport/modules/storageServer/var/GreenBox.php b/livesupport/modules/storageServer/var/GreenBox.php
index 5e7fd8353..32385e12e 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.20 $
+ Version : $Revision: 1.21 $
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.20 $
+ * @version $Revision: 1.21 $
* @see BasicStor
*/
class GreenBox extends BasicStor{
@@ -395,8 +395,9 @@ class GreenBox extends BasicStor{
{
$type = $this->getObjName($oid, 'type');
if($type == 'File'){
- $type =
+ $ftype =
StoredFile::_getType($this->_gunidFromId($oid));
+ if(!is_null($ftype)) $type=$ftype;
}
return $type;
}
@@ -411,6 +412,7 @@ class GreenBox extends BasicStor{
*/
function copyObj($id, $newParid, $after=NULL)
{
+ $parid = $this->getParent($id);
$nid = parent::copyObj($id, $newParid, $after);
if(PEAR::isError($nid)) return $nid;
switch($this->getObjType($id)){
@@ -447,7 +449,7 @@ class GreenBox extends BasicStor{
*/
function removeObj($id)
{
- switch($this->getObjType($id)){
+ switch($ot = $this->getObjType($id)){
case"audioclip":
case"playlist":
case"File":
@@ -455,15 +457,21 @@ class GreenBox extends BasicStor{
if(!PEAR::isError($ac)){
$ac->delete();
}
- parent::removeObj($id);
+ $r = parent::removeObj($id);
+ if(PEAR::isError($r)) return $r;
break;
case"Folder":
- parent::removeObj($id);
+ $r = parent::removeObj($id);
+ if(PEAR::isError($r)) return $r;
break;
case"Replica":
- parent::removeObj($id);
+ $r = parent::removeObj($id);
+ if(PEAR::isError($r)) return $r;
break;
default:
+ return PEAR::raiseError(
+ "GreenBox::removeObj: unknown obj type ($ot)"
+ );
}
return TRUE;
}
diff --git a/livesupport/modules/storageServer/var/MetaData.php b/livesupport/modules/storageServer/var/MetaData.php
index 89d7040a5..7e6fcf1f8 100644
--- a/livesupport/modules/storageServer/var/MetaData.php
+++ b/livesupport/modules/storageServer/var/MetaData.php
@@ -22,8 +22,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Author : $Author: maroy $
- Version : $Revision: 1.11 $
+ Author : $Author: tomas $
+ Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/MetaData.php,v $
------------------------------------------------------------------------------*/
@@ -128,8 +128,10 @@ class MetaData{
*/
function replace($mdata, $loc='file')
{
- if($this->exists) $res = $this->delete();
- if(PEAR::isError($res)) return $res;
+ if($this->exists){
+ $res = $this->delete();
+ if(PEAR::isError($res)) return $res;
+ }
return $this->insert($mdata, $loc);
}
/**
diff --git a/livesupport/modules/storageServer/var/StoredFile.php b/livesupport/modules/storageServer/var/StoredFile.php
index ba9c01692..872ecb820 100644
--- a/livesupport/modules/storageServer/var/StoredFile.php
+++ b/livesupport/modules/storageServer/var/StoredFile.php
@@ -23,7 +23,7 @@
Author : $Author: tomas $
- Version : $Revision: 1.13 $
+ Version : $Revision: 1.14 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/storageServer/var/StoredFile.php,v $
------------------------------------------------------------------------------*/
@@ -71,7 +71,7 @@ class StoredFile{
/* ========= 'factory' methods - should be called to construct StoredFile */
/**
- * Create instace of StoreFile object and insert new file
+ * Create instace of StoredFile object and insert new file
*
* @param gb reference to GreenBox object
* @param oid int, local object id in the tree
@@ -227,7 +227,7 @@ class StoredFile{
'', '', NULL, $src->_getType()
);
if(PEAR::isError($ac)) return $ac;
- $ac->md->replace($src->md->getMetaData());
+ $ac->md->replace($src->md->getMetaData(), 'string');
return $ac;
}
@@ -593,10 +593,11 @@ class StoredFile{
function _getType($gunid=NULL)
{
if(is_null($gunid)) $gunid = $this->gunid;
- return $this->dbc->getOne("
+ $ftype = $this->dbc->getOne("
SELECT ftype FROM {$this->filesTable}
WHERE gunid=x'$gunid'::bigint
");
+ return $ftype;
}
/**
diff --git a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
index 48b1b8043..466291da6 100644
--- a/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
+++ b/livesupport/modules/storageServer/var/html/gbHtmlBrowse.php
@@ -98,18 +98,18 @@ $tpldata['showMenu']=true;
'';
}
function fmove(id, relPath){
- var newPath=prompt('Destination folder (relative path):', relPath);
- if(newPath==null) return;
+ var newPath=prompt('Destination folder (relative path, e.g. "..", "folderName", "../folderName):', relPath);
+ if(newPath==null || newPath=='') return;
location.href='gbHttp.php?id='+id+'&act=move&newPath='+newPath;
}
function fcopy(id, relPath){
- var newPath=prompt('Destination folder (relative path):', relPath);
- if(newPath==null) return;
+ var newPath=prompt('Destination folder (relative path, e.g. "..", "folderName", "../folderName):', relPath);
+ if(newPath==null || newPath=='') return;
location.href='gbHttp.php?id='+id+'&act=copy&newPath='+newPath;
}
function freplicate(name, id){
- var np=prompt('Destination folder (relative path):', id);
- if(np==null) return;
+ var np=prompt('Destination folder (relative path, e.g. "..", "folderName", "../folderName):', id);
+ if(np==null || np=='') return;
location.href='gbHttp.php?id='+id+'&act=repl&newparid='+np;
}
function newFolder(){
@@ -168,8 +168,8 @@ $tpldata['showMenu']=true;