- added new cronjob that updates 2 systems every minute from ESI with new data, #628
This commit is contained in:
@@ -56,5 +56,8 @@ deleteExpiredCacheData = Cron\Cache->deleteExpiredData, @downtime
|
||||
; delete old statistics (activity log) data
|
||||
deleteStatisticsData = Cron\StatisticsUpdate->deleteStatisticsData, @weekly
|
||||
|
||||
; updates small amount of static system data from CCP API
|
||||
updateUniverseSystems = Cron\Universe->updateUniverseSystems, @instant
|
||||
|
||||
; setup universe DB with static data from ESI
|
||||
setup = Cron\Universe->setup, @instant
|
||||
;setup = Cron\Universe->setup, @instant
|
||||
@@ -14,18 +14,6 @@ use Model;
|
||||
|
||||
class Universe extends Controller {
|
||||
|
||||
/**
|
||||
* Set up "Universe" Database
|
||||
* @param \Base $f3
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function setupDB(\Base $f3){
|
||||
//$this->setupWormholes($f3);
|
||||
//var_dump($this->getSystemsIndex());
|
||||
//var_dump($this->getSystemData(30000001));
|
||||
//var_dump($this->getSystemData(30000002));
|
||||
//var_dump($this->getSystemData('Lashesih'));
|
||||
}
|
||||
|
||||
/* currently not used
|
||||
protected function setupRegions(\Base $f3){
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Cron;
|
||||
|
||||
use Model;
|
||||
|
||||
class Universe {
|
||||
class Universe extends AbstractCron {
|
||||
|
||||
const LOG_TEXT = '%s type: %s %s/%s peak: %s total: %s msg: %s';
|
||||
|
||||
@@ -242,5 +242,23 @@ class Universe {
|
||||
$this->formatSeconds(microtime(true) - $timeTotalStart), $msg) );
|
||||
}
|
||||
|
||||
/**
|
||||
* update static universe system data from ESI
|
||||
* -> updates small chunk of systems at once
|
||||
* >> php index.php "/cron/updateUniverseSystems"
|
||||
* @param \Base $f3
|
||||
* @throws \Exception
|
||||
*/
|
||||
function updateUniverseSystems(\Base $f3){
|
||||
$this->setMaxExecutionTime();
|
||||
|
||||
$system = Model\Universe\BasicUniverseModel::getNew('SystemModel');
|
||||
$systems = $system->find( null, ['order' => 'updated', 'limit' => 2]);
|
||||
if($systems){
|
||||
foreach ($systems as $system){
|
||||
$system->updateModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -317,6 +317,16 @@ class SystemModel extends BasicUniverseModel {
|
||||
return $stargatesData;
|
||||
}
|
||||
|
||||
/**
|
||||
* update system from ESI
|
||||
*/
|
||||
public function updateModel(){
|
||||
if( !$this->dry() ){
|
||||
$this->loadData($this->_id);
|
||||
$this->loadPlanetsData();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @param string $accessToken
|
||||
|
||||
Reference in New Issue
Block a user