Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions

Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2004, 06:55 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vB3 cron system

What is the CLEAN (i.e., not exit!) way of ending a cron script?

For example, I have this function:
PHP Code:
function autoimapdie($result)
{
    global 
$logprefix;
    
    if (
$result === false)
    {
        
$errors imap_errors();
        
$warnings imap_warnings();
        
$messages array_merge($errors$warnings);
        
        foreach (
$messages as $key => $value)
        {
            
$messages[$key] = htmlspecialchars_uni($value);
        }
        
        if (!empty(
$messages))
        {
            
$messages htmlspecialchars("\"" implode("\", \""$messages) . "\"");
            
            
log_cron_action("$logprefix Failed due to imap errors or warnings: $messages",
                    
$nextitem);
        }
    }

After the log_cron_action line, how can I return control back to the original cron control script?
Reply With Quote
  #2  
Old 02-08-2004, 07:07 PM
MindTrix's Avatar
MindTrix MindTrix is offline
 
Join Date: Apr 2002
Location: United Kingdom
Posts: 1,833
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

My host says return;

dunno if thats any help
Reply With Quote
  #3  
Old 02-08-2004, 08:12 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MindTrix
My host says return;

dunno if thats any help
That will merely exit out of the function. There is code calling the function that will continue to get executed.

I don't want to edit any of vB's files, if possible, as this is for vBMS and I'm avoiding that for this release.
Reply With Quote
  #4  
Old 02-08-2004, 08:29 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A thought occurs: is there an exit handler function that will make a graceful exit anyway when exit is used?
Reply With Quote
  #5  
Old 02-08-2004, 08:32 PM
MindTrix's Avatar
MindTrix MindTrix is offline
 
Join Date: Apr 2002
Location: United Kingdom
Posts: 1,833
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How do you mean? (me lost) my host still swears u should use exit at the end of the cron line
Reply With Quote
  #6  
Old 02-08-2004, 08:33 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MindTrix
How do you mean? (me lost) my host still swears u should use exit at the end of the cron line
Does your host know that I'm talking about vB3's cron system and not a standard Unix cron (i.e., crontab, etc.) setup?
Reply With Quote
  #7  
Old 02-08-2004, 08:36 PM
MindTrix's Avatar
MindTrix MindTrix is offline
 
Join Date: Apr 2002
Location: United Kingdom
Posts: 1,833
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Doh! Sorry for wasting your time Filburt.
Reply With Quote
  #8  
Old 02-08-2004, 11:23 PM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Filburt isn't control given automatically given back to the main cron script as it loops through each required file? Unless your function isn't itself going to be a cron script.

Cheers,
g-force2k2
Reply With Quote
  #9  
Old 02-09-2004, 12:17 AM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by g-force2k2
Filburt isn't control given automatically given back to the main cron script as it loops through each required file? Unless your function isn't itself going to be a cron script.

Cheers,
g-force2k2
Well for example:
PHP Code:
// is vBMS even enabled?
debugecho("Checking for vBMS enabled...");
if (!
$vboptions['vbms_enabled'])
{
    
log_cron_action("$logprefix mail check ignored: vBMS is not enabled"$nextitem);

After that log entry, the script should hand control over to the next scheduled cron job (if any). As it is now (as I understand it, at least), it will just continue running, even though a known failure point was effectively ignored.
Reply With Quote
  #10  
Old 02-09-2004, 02:16 AM
g-force2k2 g-force2k2 is offline
 
Join Date: Mar 2002
Location: Everywhere you wanna be..
Posts: 1,608
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Could not not define a global variable that is ran through each loop and if an error is occured then instead of continuing the while loop it could instead break out, and if necessary first build a new cron log? Just an idea.

Cheers,
g-force2k2
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:09 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.04527 seconds
  • Memory Usage 2,256KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete