root/dev/cron/cron_import.php @ 370

Revision 370, 2.9 KB (checked in by kovell, 11 years ago)

- SQL queries optimised for speed and error protection.
- feed syndication optimised
- front page includes optional clock and optional kill/loss display
- mysqli support added
- transaction protection of kills added where supported (mysqli and InnoDB)
- summary tables and contracts show total destroyed value instead of ship value
- html errors reduced
- related kill calculation improved
- query caching errors reduced
- minor bugfixes
- Smarty 2.6.25 added
- apoc fitting mod added and modded
- code optimisations
- code comments added (doxygen format)
- conflicting mods are now identified

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 = substr(getcwd(), 0, strlen(getcwd())-5); // current working directory minus last 5 letters of string ("/cron")
16$KB_HOME = ereg_replace('[/\\]cron$', '', getcwd());
17
18chdir($KB_HOME); 
19
20// 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
21
22// 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
23//$KB_HOME = "/home/yoursite/public_html/kb";
24//chdir($KB_HOME);
25
26require_once( "kbconfig.php" );
27require_once( "common/includes/class.config.php" );
28require_once( "common/includes/class.apicache.php" );
29require_once( "common/includes/class.event.php" );
30require_once( "common/includes/globals.php" );
31require_once( "common/includes/class.eveapi.php" );
32require_once( "common/includes/db.php" );
33
34$config = new Config(KB_SITE);
35$ApiCache = new ApiCache(KB_SITE);
36
37define('KB_TITLE', config::get('cfg_kbtitle'));
38
39// corporation OR alliance id
40if (config::get('cfg_corpid'))
41{
42    define('CORP_ID', config::get('cfg_corpid'));
43    define('ALLIANCE_ID', 0);
44} else {
45    define('CORP_ID', 0);
46    define('ALLIANCE_ID', config::get('cfg_allianceid'));
47}
48
49if (!$dir = config::get('cache_dir'))
50{
51    $dir = 'cache/data';
52}
53define('KB_CACHEDIR', $dir);
54
55$outhead = "Running API Mod ". APIVERSION . " on " . gmdate("M d Y H:i") . "\n\n";
56$out = '';
57
58$myEveAPI = new API_KillLog();
59$myEveAPI->iscronjob_ = true;
60
61$keycount = config::get('API_Key_count');
62
63for ($i = 1; $i <= $keycount; $i++)
64{
65    $keyindex = $i;
66    $myEveAPI->Output_ = "Importing Mails for " . $config->get("API_Name_" . $i);
67        $myEveAPI->Output_ .= "\n";
68    $typestring = $config->get("API_Type_" . $i);
69    $keystring = 'userID=' . $config->get('API_UserID_' . $i) . '&apiKey=' . $config->get('API_Key_' . $i) . '&characterID=' . $config->get('API_CharID_' . $i);
70        $myEveAPI->cachetext_ = "";
71        $myEveAPI->cacheflag_ = false;
72    $outtemp .= $myEveAPI->Import($keystring, $typestring, $keyindex);
73        //config::set('API_CachedUntil_' . $keyindex, $myEveAPI->cachetext_);
74}
75$out = $outtemp;
76
77if ($out)
78{
79    $out = str_replace("<div class=block-header2>","",$out);
80    $out = str_replace("</div>","\n",$out);
81    $out = str_replace("<br>","\n",$out);
82
83    //print $outhead . strip_tags($out, '<a>');
84    print $outhead . strip_tags($out);
85}
86?>
Note: See TracBrowser for help on using the browser.