vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   My Cron Isn't Posted A Thread!? (https://vborg.vbsupport.ru/showthread.php?t=215741)

paul41598 06-09-2009 12:14 PM

My Cron Isn't Posted A Thread!?
 
I have a cron setup that runs once per day, that basically moves threads, and after its done it's supposed to post to an existing thread with some log information.

Theres more to the code, but this is the jist of what I'm doing. The move code..and below that, the posting code. The threads move fine..when the cron runs, however the POST IS NEVER made. I cannot figure out for the life of me why it never posts. If I run the cron manually, the move works and the post happens perfectly. Why would manually running it work, but not the actual scheduled cron timer?

PHP Code:

    //Move Thread To Archive Forum
    
require_once(DIR '/includes/functions_databuild.php');
     
$threadman =& datamanager_init('Thread'$vbulletinERRTYPE_ARRAY'threadpost');    
    
$threadman->set_existing($getthreadexpire);
    
$threadman->set('forumid'$vbulletin->options['threadexpiration_forumarchive']);
    
$threadman->save();
    
build_forum_counters($getthreadexpire['forumid']);
    
build_forum_counters($archive_forum);


        require_once(
'./includes/class_dm.php'); 
        require_once(
'./includes/class_dm_threadpost.php'); 

        
$postdm = new vB_DataManager_Post($vbulletinERRTYPE_STANDARD);
        
$postthreadid '3191';
        
$postuserid '1';
        
$threadinfo fetch_threadinfo($postthreadid);
        
$foruminfo fetch_foruminfo($threadinfo['forumid']);
        
$postdm->set_info('forum'$foruminfo);
        
$postdm->set_info('thread'$threadinfo);  
        
$postdm->set('threadid'$postthreadid);
        
$postdm->set('userid'$postuserid);
        
$postdm->set('pagetext'"Testing Body");
        
$postdm->set('allowsmilie'1);
        
$postdm->set('visible'1);
        
$postdm->set('dateline'TIMENOW);
        
$postid $postdm->save();
        unset(
$postdm); 


Lynne 06-09-2009 03:13 PM

I have had that sort of problem where it works when run manually, but not as a cron job. I had to include some variables as global - ie. global $vbulletin, $whatever - and then it worked fine. You may want to look for something like that.

paul41598 06-09-2009 03:39 PM

Thanks Lynne,

I tried all of these: still no luck. Sux. I'll keep at it...

PHP Code:

require_once('./global.php');
global 
$vbulletin$postdm$threadinfo$foruminfo


Lynne 06-09-2009 03:42 PM

I am pretty sure you do not want to include global.php. You'll probably get errors if you do. (Have you looked in your error_logs?)

paul41598 06-09-2009 03:48 PM

Yah I got errors, I had to that out. Which error logs? The scheduled tasks logs just say it completed.. so its useless. Do you mean "Log Manager" ? If so, I dont have that defined in the vboptions so its not working no. Maybe I should turn it on? hmm

Lynne 06-09-2009 03:55 PM

I'm talking about your apache error_logs. If you don't know where they are, you should ask your host.

paul41598 06-09-2009 06:18 PM

Ok whats weird is if I make another cron job with a seperate php file and put this in it:

PHP Code:

        require_once('./includes/class_dm.php'); 
        require_once(
'./includes/class_dm_threadpost.php'); 

        
$postdm = new vB_DataManager_Post($vbulletinERRTYPE_STANDARD);
        
$postthreadid '3191';
        
$postuserid '1';
        
$threadinfo fetch_threadinfo($postthreadid);
        
$foruminfo fetch_foruminfo($threadinfo['forumid']);
        
$postdm->set_info('forum'$foruminfo);
        
$postdm->set_info('thread'$threadinfo);  
        
$postdm->set('threadid'$postthreadid);
        
$postdm->set('userid'$postuserid);
        
$postdm->set('pagetext'"hello");
        
$postdm->set('allowsmilie'1);
        
$postdm->set('visible'1);
        
$postdm->set('dateline'TIMENOW);
        
$postid $postdm->save();
        unset(
$postdm); 

the cron works great and the post is made... WTH

Lynne 06-09-2009 08:00 PM

Where were you putting the code? I figured you had that in a separate file (how else would you do it?).

paul41598 06-09-2009 09:47 PM

n/m I finally figured this stupid thing out.. thank you!


All times are GMT. The time now is 05:02 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.01139 seconds
  • Memory Usage 1,753KB
  • 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
  • (3)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)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