PDA

View Full Version : Cron Job


BulliM
10-14-2018, 06:49 AM
I try to run an own cron job from /core/includes/cron, but I couldn't get it run.

<?php if (!defined('VB_ENTRY')) die('Access denied.');

$timenow = vB::getRequest()->getTimeNow();

$conditions = array();

$assertor = vB::getDbAssertor();

$rows = $assertor->select('userfield', $conditions, false, array('field1', 'field2', 'field3', 'field4', 'field6', 'field7'));

I get no result and script aborts at last line. userfield contains all columns in array. No clue what the problem is.

delicjous
10-14-2018, 09:00 AM
Do you get any information about the abort?

You need to log and turn to next cron after your code. Look into the vB crons.

BulliM
10-14-2018, 09:51 AM
Nope. Logs are empty. I run cron jobs by script (vbcron.php). Other logs (error.log,access.log,mysql.log) don't show anything.

I log steps by file (step_1, step_2 ...) , to see, how far that script works. Before last line is all ok, but at that point it stops.

delicjous
10-14-2018, 10:43 AM
At first, there is no userfield table declaration in core/vb/db... or I missed it.

You need to go to vBForum-package.

Try this:
$rows = $assertor->select('vBForum:userfield', $conditions, false, array('field1', 'field2', 'field3', 'field4', 'field6', 'field7'));

Or you could use fetchUserFields from core/vb/db... as assertQuery.

BulliM
10-14-2018, 10:54 AM
Danke delicious!

This works:
$rows = vB::getDbAssertor()->select('vBForum:userfield', false, false, array());

rekha
10-17-2018, 07:01 AM
nice codes