cron question

I’m trying to get a CLI cron setup. I already put this:

<br />
define('AREA', 'A');<br />
define('AREA_NAME' ,'admin');<br />
//define('DEBUG_QUERIES','true');<br />
//define('PROFILER','true');<br />
require dirname(__FILE__) . '/../prepare.php';<br />
require dirname(__FILE__) . '/../init.php';<br />

```<br />
<br />
At the top of my file and it runs fine with some other crons I have setup.<br />
<br />
The core functions all work.<br />
<br />
The issue now is I'm trying to use some functions that are part of an addon in its func.php file.  Normally when it initializes on a page, it includes those by default.  What do I need to add to include the add-on loading?  Or should I just manually include the func.php file?

The addons should be “init”'d, but they won’t be ‘loaded’. You have to have a SESSION and valid authentication for addon controllers to be loaded and run.

See this chunk of code in core/fn.control.php:

} elseif (!empty($_SESSION['auth']['usergroup_ids'])) {
$run_controllers = fn_check_permissions(CONTROLLER, MODE, 'admin', '', $_REQUEST);

This is a good security option. Otherwise, all sorts of vulnerablilities might come out given that most addons are not written to be run anonymously and securly.

I ended up adding:

require dirname(FILE) . ‘/…/addons/my_addon/func.php’;

and it worked just fine.

I could have manually set some session vars at the begining of the file. Seems better this way though since I only really need one addon and it works that way. I actually do that in the addon where it wants some auth data, I just set $auth=array(‘usergroup_ids’=>array(0,1,2))