Forum OpenACS Q&A: using content_item__delete(item_id)

Collapse
Posted by Jun Yamog on
Hi,

I have been using CR on OpenACS for quite some time.  I have used the
DB api content_item__delete(item_id) to delete items.  I have been
using the storage_type "file" so the real data are stored on the file
system.  Since its a db api it would not be able to delete the files
in the file system... silly me I though everything is doing ok.  Until
I noticed that files are not being nuked out.  I have looked around
the CR tcl files it seems I cant find something that delete the file
and db entry.

Is there are tcl api to delete the CR item and file?  If not what is
the best way to accomplish this?  Create a proc the deletes a file
immediately once its called?  Or create a scheduled proc that acts out
as a janitor that checks orphaned files in the file system?

Collapse
Posted by Dan Wickstrom on
The files should be deleted automatically by a sweeper proc that runs once a day.  When a revision is deleted and the revision is file-based, a trigger logs the event in the table cr_files_to_delete.  The sweeper proc  checks the cr_files_to_delete table and removes the files that are no longer being used by the sweeper proc.  Check to see if the cr_delete_scheduled_files proc has run and check to see if there are any entries in the cr_files_to_delete table.
Collapse
Posted by Jun Yamog on
Thanks Dan!

I will checkout if the sweeper proc is indeed running.