- fixed "online" status for characters, closed #507

- reduced "afk" wait time until cronjob location check for a character from 5min to 3min
This commit is contained in:
Exodus4D
2017-07-16 15:39:20 +02:00
parent 24e006230d
commit 5d57f30782
3 changed files with 21 additions and 6 deletions

View File

@@ -13,7 +13,10 @@ use Model;
class CharacterUpdate {
const CHARACTER_LOG_INACTIVE = 300;
/**
* default character_log time until a log entry get re-checked by cronjob
*/
const CHARACTER_LOG_INACTIVE = 180;
/**
* max count of "inactive" character log data that will be checked for offline status
@@ -31,7 +34,7 @@ class CharacterUpdate {
}
/**
* delete all character log data that were set to "active = 0" after X seconds of no changes
* delete all character log data that have not changed since X seconds
* -> see deactivateLogData()
* >> php index.php "/cron/deleteLogData"
* @param \Base $f3

View File

@@ -632,6 +632,14 @@ class CharacterModel extends BasicModel {
return $rolesData;
}
/**
* check whether this char has accepted all "basic" api scopes
* @return bool
*/
public function hasBasicScopes(){
return empty( array_diff(Sso::getScopesByAuthType(), $this->esiScopes) );
}
/**
* check whether this char has accepted all admin api scopes
* @return bool
@@ -650,8 +658,12 @@ class CharacterModel extends BasicModel {
$deleteLog = false;
$invalidResponse = false;
//check if log update is enabled for this user
if( $this->logLocation ){
//check if log update is enabled for this character
// check if character has accepted all scopes. (This fkt is called by cron as well)
if(
$this->logLocation &&
$this->hasBasicScopes()
){
// Try to pull data from API
if( $accessToken = $this->getAccessToken() ){
$onlineData = self::getF3()->ccpClient->getCharacterOnlineData($this->_id, $accessToken, $additionalOptions);

View File

@@ -126,8 +126,8 @@ EXECUTION_LIMIT = 50
; CACHE ===========================================================================================
[PATHFINDER.CACHE]
; delete character log data if if nothing (ship/system/...) for X seconds (seconds) (default: 5min)
CHARACTER_LOG_INACTIVE = 300
; delete character log data if if nothing (ship/system/...) for X seconds (seconds) (default: 3min)
CHARACTER_LOG_INACTIVE = 180
; expire time for static system data (seconds) (default: 20d)
CONSTELLATION_SYSTEMS = 1728000
; max expire time. Expired cache files will be deleted by cronjob (seconds) (default: 10d)