root/dev/cron/cron_import.php @ 461

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

Fixes: eve-dev changed to eve-id, recursive clearup scripts recurse more than one level, defunct admin sync removed.

RevLine 
[365]1#!/usr/bin/php
2<?php
[370]3// check your php folder is correct as defined by the first line of this file
4
[365]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
[370]11if(function_exists("set_time_limit"))
12        set_time_limit(0);
[365]13
[370]14// current working directory minus last 5 letters of string ("/cron")
[461]15$KB_HOME = preg_replace('/[\/\\\\]cron$/', '', getcwd());
[365]16
17chdir($KB_HOME); 
18
[370]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
[365]25require_once( "kbconfig.php" );
26require_once( "common/includes/class.config.php" );
[370]27require_once( "common/includes/class.apicache.php" );
[365]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);
[370]34$ApiCache = new ApiCache(KB_SITE);
[365]35
36define('KB_TITLE', config::get('cfg_kbtitle'));
37
38// corporation OR alliance id
39if (config::get('cfg_corpid'))
40{
[400]41    define('CORP_ID', intval(config::get('cfg_corpid')));
[365]42    define('ALLIANCE_ID', 0);
43} else {
44    define('CORP_ID', 0);
[400]45    define('ALLIANCE_ID', intval(config::get('cfg_allianceid')));
[365]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);
[370]69        $myEveAPI->cachetext_ = "";
70        $myEveAPI->cacheflag_ = false;
[365]71    $outtemp .= $myEveAPI->Import($keystring, $typestring, $keyindex);
[370]72        //config::set('API_CachedUntil_' . $keyindex, $myEveAPI->cachetext_);
[365]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}
Note: See TracBrowser for help on using the browser.