[dev] Serious problem with Ansel and possibly datatree (no,
it's not datatree)
Roel Gloudemans
roel at gloudemans.info
Sun Sep 19 11:10:28 PDT 2004
> Okay, this is useful, especially knowing you use SQL VFS. Two steps
> from here:
>
> - Log the queries sent to your SQL server when you delete that image (VFS
> doesn't have logging support currently, which is why you need to do it on the
> server end, but I'll try and work on that).
Well, looking at the delete method used in Ansel (quote from lib/Gallery.php):
function delete()
{
// Delete files from VFS.
$this->_vfs->deleteFolder('.horde/ansel', substr($this->getId(),
-2), true);
// Remove from DataTree backend.
$this->_imageOb->removeImage($this);
}
I can imagine why this happens. All images are in the same directory.
Looking at
the code to delete images you'd suspect that there should be one image per
directory. (Which is not the case)
With the current setup the delete code should be like:
/**
* Removes this image from the VFS and DataTree backends.
*/
function delete()
{
// Get the filenames
$fullname = $this->getVFSName('full');
$screenname = $this->getVFSName('screen');
$basepath = '.horde/ansel/' . substr($this->getId(), -2);
// Delete files from VFS.
$this->_vfs->deleteFile($basepath . '/screen', $screenname);
$this->_vfs->deleteFile($basepath . '/thumb', $screenname);
$this->_vfs->deleteFile($basepath . '/full', $fullname);
// Delete folder if no more images left
if (count($this->_vfs->listFolder($basepath . '/full') == 0) {
$this->_vfs->deleteFolder($basepath, true);
}
// Remove from DataTree backend.
$this->_imageOb->removeImage($this);
}
Darn, I think I solved it :-) (pleeeeeeaaaaaase say that I'm correct ;-) )
Cheers,
Roel.
(PS. Patch attached)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Gallery.patch
Type: text/x-patch
Size: 1017 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/20040919/91a41c85/Gallery.bin
More information about the dev
mailing list