root/dev/cron/cron_import.php @ 449

Revision 449, 2.8 KB (checked in by kovell, 11 years ago)

Page cache uses subdirectories to split cache files. clearup cron script has longer expiry times on page and query cache. fetch and import cron scripts have commented code removed.

Line 
1#!/usr/bin/php
2<?php
3// check your php folder is correct as defined by the first line of this file
4
5@error_reporting(E_ALL ^ E_NOTICE);
6//
7// Simple Cronjob script - set it to run this, no more than once an hour as you can only pull info once an hour anyway
8// by Captain Thunk! (ISK donations are all gratefully received)
9//
10
11if(function_exists("set_time_limit"))
12        set_time_limit(0);
13
14// current working directory minus last 5 letters of string ("/cron")
15$KB_HOME = ereg_replace('[/\\]cron$', '', getcwd());
16
17chdir($KB_HOME); 
18
19// If the above doesn't work - place your working directory path to killboard root below - comment out the above two lines and uncomment the two below
20
21// Edit the path below with your webspace directory to the killboard root folder - also check your php folder is correct as defined by the first line of this file
22//$KB_HOME = "/home/yoursite/public_html/kb";
23//chdir($KB_HOME);
24
25require_once( "kbconfig.php" );
26require_once( "common/includes/class.config.php" );
27require_once( "common/includes/class.apicache.php" );
28require_once( "common/includes/class.event.php" );
29require_once( "common/includes/globals.php" );
30require_once( "common/includes/class.eveapi.php" );
31require_once( "common/includes/db.php" );
32
33$config = new Config(KB_SITE);
34$ApiCache = new ApiCache(KB_SITE);
35
36define('KB_TITLE', config::get('cfg_kbtitle'));
37
38// corporation OR alliance id
39if (config::get('cfg_corpid'))
40{
41    define('CORP_ID', intval(config::get('cfg_corpid')));
42    define('ALLIANCE_ID', 0);
43} else {
44    define('CORP_ID', 0);
45    define('ALLIANCE_ID', intval(config::get('cfg_allianceid')));
46}
47
48if (!$dir = config::get('cache_dir'))
49{
50    $dir = 'cache/data';
51}
52define('KB_CACHEDIR', $dir);
53
54$outhead = "Running API Mod ". APIVERSION . " on " . gmdate("M d Y H:i") . "\n\n";
55$out = '';
56
57$myEveAPI = new API_KillLog();
58$myEveAPI->iscronjob_ = true;
59
60$keycount = config::get('API_Key_count');
61
62for ($i = 1; $i <= $keycount; $i++)
63{
64    $keyindex = $i;
65    $myEveAPI->Output_ = "Importing Mails for " . $config->get("API_Name_" . $i);
66        $myEveAPI->Output_ .= "\n";
67    $typestring = $config->get("API_Type_" . $i);
68    $keystring = 'userID=' . $config->get('API_UserID_' . $i) . '&apiKey=' . $config->get('API_Key_' . $i) . '&characterID=' . $config->get('API_CharID_' . $i);
69        $myEveAPI->cachetext_ = "";
70        $myEveAPI->cacheflag_ = false;
71    $outtemp .= $myEveAPI->Import($keystring, $typestring, $keyindex);
72        //config::set('API_CachedUntil_' . $keyindex, $myEveAPI->cachetext_);
73}
74$out = $outtemp;
75
76if ($out)
77{
78    $out = str_replace("<div class=block-header2>","",$out);
79    $out = str_replace("</div>","\n",$out);
80    $out = str_replace("<br>","\n",$out);
81
82    //print $outhead . strip_tags($out, '<a>');
83    print $outhead . strip_tags($out);
84}
85?>
Note: See TracBrowser for help on using the browser.