Posted on: 2011/12/6 11:09
Re: How to create a cron in Xoops
i managed to figure this out, so here are my observations.
if you would like to run a cron job and use existing xoops functions, constants etc you would have to
1. include the mainfile.php
where root_path is the absolute root path to your site
2. include the xoopslogger class and disable it (in case it is on)
$xoopsLogger =& XoopsLogger::getInstance();
$xoopsLogger->activated = false;
as you can see i disabled error reporting as well, this is not mandatory (i think) but I did it anyway since I finished my debugging.
3. set the cron in your cpanel/plesk or whatever
Thats actually it. Now you can use any core functionality like xoops_load(), $xoopsDB etc, or load any languages on the fly as we would do in a module function.
I implemented this for a newsletter module i'm writing and its working fine so far. I hope it helps someone.
Maybe when i'm done with the module i will share it with the rest, although it is designed to serve my websites needs, and its based on the same logic as my Xoops Global RSS Hack/Solution
I just want to share the logic.
Both global RSS and Newsletter functionality is missing from xoops but that doesn't mean we cant have it :) (without touching core files)