GC (Garbage Collector, of course) is actually a "poor man's" alternative for cron - i.e. is a lightweight replacement for cron.
However it gets triggered only when somebody uses the admin-panel. Therefore, it won't be ideal for cases (like yours) where a certain event has to be triggered at a predefined time. That would need proper cron.
That said, deleting pages from cron should be no different from how it is done through Couch's GC. Mosaic makes use of GC heavily to delete orphaned entries (pages) and, I think, you should be able to adapt its code for your purposes.
As pointers, please refer to the following two functions -
1. function process_gc() in addons/mosaic/mosaic.php
2. function db_delete() in addons/data-bound-form/data-bound-form.php (this is the actual implementation of <cms:db_delete> tag).
As you'll notice, essentially it only involves first getting the ID's for all the pages that are to be deleted and then doing the following for each page -
- Code: Select all
$pg = new KWebpage( $tpl_id, $page_id );
Hope this helps.