[dev] Serious problem with Ansel and possibly datatree (no, it's not datatree)

Ben Chavet ben at chavet.net
Sun Sep 19 15:11:25 PDT 2004


Sure enough, images weren't being deleted properly.  Try what I just 
committed.

I don't think we need to try to delete the base directory, since the storage
structure is a hash.  There will certainly be another image that will go into
that bucket.

--Ben

Quoting Roel Gloudemans <roel at gloudemans.info>:

>
>> 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)
>
>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the dev mailing list