1 | #!/usr/bin/php |
---|
2 | <?php |
---|
3 | // check your php folder is correct as defined by the first line of this file |
---|
4 | @error_reporting(E_ALL ^ E_NOTICE); |
---|
5 | // |
---|
6 | // Simple Cronjob script - set it to run this, no more than once an hour as you can only pull info once an hour anyway |
---|
7 | // by Captain Thunk! (ISK donations are all gratefully received) |
---|
8 | // |
---|
9 | |
---|
10 | if(function_exists("set_time_limit")) |
---|
11 | set_time_limit(0); |
---|
12 | |
---|
13 | // current working directory minus last 5 letters of string ("/cron") |
---|
14 | //$KB_HOME = substr(getcwd(), 0, strlen(getcwd())-5); // current working directory minus last 5 letters of string ("/cron") |
---|
15 | $KB_HOME = preg_replace('/[\/\\\\]cron$/', '', getcwd()); |
---|
16 | |
---|
17 | |
---|
18 | chdir($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 | |
---|
26 | require_once( "kbconfig.php" ); |
---|
27 | require_once( "common/includes/class.config.php" ); |
---|
28 | require_once( "common/includes/class.apicache.php" ); |
---|
29 | require_once( "common/includes/class.event.php" ); |
---|
30 | require_once( "common/includes/globals.php" ); |
---|
31 | require_once( "common/includes/class.eveapi.php" ); |
---|
32 | require_once( "common/includes/db.php" ); |
---|
33 | |
---|
34 | $config = new Config(KB_SITE); |
---|
35 | $ApiCache = new ApiCache(KB_SITE); |
---|
36 | |
---|
37 | $outhead = "Running Cron_Cache - with API Mod ". APIVERSION . " on " . gmdate("M d Y H:i") . "\n\n"; |
---|
38 | $out = ''; |
---|
39 | |
---|
40 | // Sovereignty |
---|
41 | $mySovAPI = new API_Sovereignty(); |
---|
42 | $Sovtemp = $mySovAPI->fetchXML(); |
---|
43 | $out .= "Caching Sovereignty XML - cached until:" . ConvertTimestamp($mySovAPI->CachedUntil_) . "\n"; |
---|
44 | |
---|
45 | // Alliance |
---|
46 | $myAlliAPI = new AllianceAPI(); |
---|
47 | $Allitemp .= $myAlliAPI->initXML(); |
---|
48 | $out .= "Caching Alliance XML - cached until:" . ConvertTimestamp($myAlliAPI->CachedUntil_) . "\n"; |
---|
49 | |
---|
50 | // Conquerable Station and Outposts list |
---|
51 | $myConqAPI = new API_ConquerableStationList(); |
---|
52 | $Conqtemp .= $myConqAPI->fetchXML(); |
---|
53 | $out .= "Caching Conquerable Station XML - cached until:" . ConvertTimestamp($myConqAPI->CachedUntil_) . "\n"; |
---|
54 | |
---|
55 | // Factional Warfare Systems |
---|
56 | $myFacAPI = new API_FacWarSystems(); |
---|
57 | $Factemp .= $myFacAPI->fetchXML(); |
---|
58 | $out .= "Caching Factional Warfare Systems XML - cached until:" . ConvertTimestamp($myFacAPI->CachedUntil_) . "\n"; |
---|
59 | |
---|
60 | if ($out) |
---|
61 | { |
---|
62 | $out = str_replace("<div class=block-header2>","",$out); |
---|
63 | $out = str_replace("</div>","\n",$out); |
---|
64 | $out = str_replace("<br>","\n",$out); |
---|
65 | |
---|
66 | //print $outhead . strip_tags($out, '<a>'); |
---|
67 | print $outhead . strip_tags($out); |
---|
68 | } |
---|