By jazzitup on
I'd like to select image nodes by MySQL SELECT statement and then to be able to delete all of the selected node id's at cron run. When nodes are deleted, I would also like to delete all of their image files with every single instance as well (such as thumbnails, etc.).
Is there any example how would I achieve this?
Comments
It depends on what version of Drupal you are running.
For the 5.x releases you could look at the following:
https://drupal.org/project/auto_expire or http://drupal.org/project/node_expire
I know D6 has an easier way to do it. There has been some discussion about here in the past.
Drupal 5
I need it for D5... I'll take a look at those 2 similar modules, but it seems that they use unpublishing of nodes only. They don't delete anything. I like the feature of notifying users upon deleting.
Maybe I don't need the whole module, I thought I could add a piece of code in a custom "cron.php" to achieve this?
--
www.jazzit.hr
custom module
For something this specific most likely you'll need to create a small custom module consisting of only a hook_cron(). The function would select the nodes for deletion using whatever criteria required then loop through the recordset deleting the file(s) and record accordingly. You could then send an e-mail to admin or create a log entry (preferred) reporting how many nodes were deleted. Piece of cake.
-------------------------------------------------------
"The sting in any rebuke is the truth." - Benjamin Franklin