Go Back   vBulletin Modification Discussions > vBulletin Discusions > Knowledge Base > Tutorials
Home Register FAQ Members List Calendar Mark Forums Read
vBSEO Info Tags

About This Page: This is a discussion on [Tutorial] Accessing vBulletin Functions in Server Cron Scripts within the Tutorials forums, part of the Knowledge Base category, at vBulletin Modification Discussions. When running a server cron script to accomplish a task with vBulletin you will run into path issues with inluded files in included files. So insert the following code at the top of your script to solve this issue. Once


Comment
 
LinkBack Tutorial Tools
<!-- google_ad_section_start -->[Tutorial] Accessing vBulletin Functions in Server Cron Scripts<!-- google_ad_section_end -->
[Tutorial] Accessing vBulletin Functions in Server Cron Scripts
Published by Code Monkey
09-16-2006
Tutorial Tools

Featured Tutorials

Want to submit your sitemap to all search engines in one shot?

Use the new sitemap standard to submit your sitemap to all search engines that recognize the standard.
[Tutorial] Accessing vBulletin Functions in Server Cron Scripts

When running a server cron script to accomplish a task with vBulletin you will run into path issues with inluded files in included files. So insert the following code at the top of your script to solve this issue.

Once the script is functioning then add the first line to stop error reporting from cloging up your logs. vBulletin has several Constants to set that stop useles code from running, but there are still a lot of var not set errors that will arise because it's not a forum member accessing the script. Turning them off is harmless and will keep your log files from getting it out of hand. You can turn it back on to solve issues when they arise.

define('DIR', (dirname(__FILE__))); Is assuming the script is in your forum home directory. If it's in a subdirectory then just wrap it in another dirname(). define('DIR', (dirname(dirname(__FILE__)))) and again if it's in a lower directory. This will give an absolute path for every included script so the cron can access them.

Enjoy

PHP Code:
error_reporting(0);
define('THIS_SCRIPT''scriptname');
define('NO_REGISTER_GLOBALS'1);
define('SKIP_SESSIONCREATE'1);
define('SESSION_BYPASS'1);
define('NOCOOKIES'1);
define('DIE_QUIETLY'1);
define('DIR', (dirname(__FILE__)));
chdir(DIR);
$globaltemplates     = array();
$specialtemplates     = array();
$actiontemplates     = array();
$phrasegroups         = array();
require_once 
DIR '/global.php'
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Comment
Tags: , , , , , ,





Currently Active Users Viewing This Tutorial: 1 (0 members and 1 guests)
 
Tutorial Tools

Posting Rules
You may not post new tutorials
You may not post comments
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


A vBSkinworks Design Recoded By vBModder.
All Code Distributed On This Site is © 2006 by it's author.
Search Engine Optimization by vBSEO 3.1.0

All times are GMT -7. The time now is 10:06 AM.
Online Users 57
Registered 1
Guests 56
Members 3146
Active Members 230
Threads 1583
Posts 7000
Top poster: Code Monkey (2194)
Welcome to our newest member, tradestore
Most users ever online was 235, 04-11-2007 at 08:59 AM.
Speak Out! vBulletin gets the web talking!


vBulletin Setup SEO

vBulletin graphics resource images