vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Cron Job Insight Required (https://vborg.vbsupport.ru/showthread.php?t=185766)

J98680Bxxxxx 07-19-2008 06:14 PM

Cron Job Insight Required
 
Hi All,

I am having some trouble with a cron job not receiving vbulletin global variables. The cron job runs fine if activated manually from the ACP, but it fails to work as a standalone scheduled task.

The file content looks like this

<?php

error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db)) {exit;}

if ($vbulletin->options['mysettingname'] == 1){
... do something...
}
...

?>

Any call to "$vbulletin->options['mysettingname']" or to "vbphrase['myphrasename']" fails to work and even the function "construct_phrase(...)" fails to work and I ressorted to get the values directly from the "setting" and "phrase" tables in the database.

Is there any type of memory limitation in vbulletin for a hack/mod amount of settings/phrases used that might prevent global variables to be passed?

Any hint or insight is appreciated. :)

I read the recommendations by Lynne and Marco, but to no avail.

Paul M 07-19-2008 06:29 PM

$vbulletin->options should be available in cron jobs, what exactly makes you think they aren't ?

J98680Bxxxxx 07-19-2008 07:23 PM

Their content happen to be empty when the cron job runs alone. When run manually, they are not empty. :confused:

Marco van Herwaarden 07-20-2008 09:26 AM

Is the settinggroup in which these settings are stored loaded?

J98680Bxxxxx 07-20-2008 11:34 AM

Settinggroup loaded with the product file. From a manual run of the cron job, the values of the different settings are available. But on its own as a scheduled job, those values do not seem to be available. Is there any special "include" instruction that must be specified at the very beginning of a cron file?

To have the cron file working as a standalone scheduled job, I have replaced (in the cron file) for example all occurrences of:

$cron_mysetting_varname = $vbulletin->options['mysetting_varname']

(resp. $cron_myphrase = $vbphrase['myphrase'])

with:

$get_setting = $vbulletin->db->query_read("SELECT * FROM `". TABLE_PREFIX ."setting` WHERE `varname` = 'mysetting_varname'");
$fetchsetting = $vbulletin->db->fetch_array($get_setting);
$cron_mysetting_varname = $fetchsetting['value'];

(resp.
$get_phrase = $vbulletin->db->query_read("SELECT * FROM `". TABLE_PREFIX ."phrase` WHERE `varname` = 'myphrase'");
$fetchphrase = $vbulletin->db->fetch_array($get_phrase);
$cron_myphrase = $fetchphrase['text'];
)


All times are GMT. The time now is 05:55 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02345 seconds
  • Memory Usage 1,718KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete