the context is I have a cron job - a script that I have in php. What
it does is determine the oldest few folders in a directory and deletes
them. It then also performs an update to the wordpress database.
Alone when running from browser URL, it works without any problems.
However I am using Crontrol wordpress plugin and trying to integrate my job into it.
What the plugin has suggested, is to put my job into the functions.php file
of my theme folder. And then use an action hook.
I was able to successfully set up a simple job that sends an email with
wp_mail(). But when I tried integrating my script in, it does not work.
My script has functions in it, so does it break when I use include('myfile.php') in my functions.php file?
I also tried placing the code directly in the functions.php file, but I start
having problems with my global variables.
Anyone has experience creating lengthier code in the functions.php file?
My script contains a recursive function to determine the oldest x files in a
directory, and then deletes them. It then updates the database with records of
what was deleted.
Lastly, I could not set up a cron job at the hosting settings panel, thats why
I had to try this Crontrol plugin method.