lukescotty
04-23-2012, 03:41 PM
Hiya
I've been at this for days, posting on vbulletin.org & vbulletin.com trying to get a resolution, but theres no joy.
Heres what I'm after
On vbulletin, I have a rssposter which pulls rss feeds and automatically posts them as a thread. This is brilliant but it only runs the task when a user enters the forum and triggers the cronimage file. I want it to run without the need of a user to trigger it. I would like it to run say every 30min indefinite.
So i've set up a cron job on my server, to run this cron file, which runs the rssposter, but it still doesn't work. I don't know whether its the cron coding, or my server messing things up. Heres the code:
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
ignore_user_abort(1);
@set_time_limit(0);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('SKIP_SESSIONCREATE', 1);
define('NOCOOKIES', 1);
define('THIS_SCRIPT', 'cron');
define('CSRF_PROTECTION', true);
// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/functions_cron.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$filedata = vb_base64_decode('R0lGODlhAQABAIAAAMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
$filesize = strlen($filedata);
// browser will think there is no more data if content-length is what is returned
// regardless of how long the script continues to execute, apart from IIS + CGI
header('Content-type: image/gif');
if (!(strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false AND strpos(SAPI_NAME, 'cgi') !== false))
{
header('Content-Length: ' . $filesize);
header('Connection: Close');
}
if (!$vbulletin->options['crontab'])
{
echo $filedata;
flush();
}
($hook = vBulletinHook::fetch_hook('cron_start')) ? eval($hook) : false;
exec_cron(17);
$db->close();
}
}
If anyone could help me out, i would much appreciate it. Or if anyone else could give me a solution to the task I want to create. I would be most greatful
Thanks for reading
Lukescotty
I've been at this for days, posting on vbulletin.org & vbulletin.com trying to get a resolution, but theres no joy.
Heres what I'm after
On vbulletin, I have a rssposter which pulls rss feeds and automatically posts them as a thread. This is brilliant but it only runs the task when a user enters the forum and triggers the cronimage file. I want it to run without the need of a user to trigger it. I would like it to run say every 30min indefinite.
So i've set up a cron job on my server, to run this cron file, which runs the rssposter, but it still doesn't work. I don't know whether its the cron coding, or my server messing things up. Heres the code:
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
ignore_user_abort(1);
@set_time_limit(0);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('SKIP_SESSIONCREATE', 1);
define('NOCOOKIES', 1);
define('THIS_SCRIPT', 'cron');
define('CSRF_PROTECTION', true);
// #################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array();
// get special data templates from the datastore
$specialtemplates = array();
// pre-cache templates used by all actions
$globaltemplates = array();
// pre-cache templates used by specific actions
$actiontemplates = array();
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once(DIR . '/includes/functions_cron.php');
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// #######################################################################
$filedata = vb_base64_decode('R0lGODlhAQABAIAAAMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==');
$filesize = strlen($filedata);
// browser will think there is no more data if content-length is what is returned
// regardless of how long the script continues to execute, apart from IIS + CGI
header('Content-type: image/gif');
if (!(strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false AND strpos(SAPI_NAME, 'cgi') !== false))
{
header('Content-Length: ' . $filesize);
header('Connection: Close');
}
if (!$vbulletin->options['crontab'])
{
echo $filedata;
flush();
}
($hook = vBulletinHook::fetch_hook('cron_start')) ? eval($hook) : false;
exec_cron(17);
$db->close();
}
}
If anyone could help me out, i would much appreciate it. Or if anyone else could give me a solution to the task I want to create. I would be most greatful
Thanks for reading
Lukescotty