- New cronjob "cleanUpCharacterData()" cleans up outdated "kicked until" timestamps
This commit is contained in:
@@ -44,6 +44,9 @@ importSystemData = Cron\CcpSystemsUpdate->importSystemData,
|
||||
; disable outdated maps
|
||||
deactivateMapData = Cron\MapUpdate->deactivateMapData, @hourly
|
||||
|
||||
; clean up character data (kick, ban,..)
|
||||
cleanUpCharacterData = Cron\CharacterUpdate->cleanUpCharacterData, @hourly
|
||||
|
||||
; delete disabled maps
|
||||
deleteMapData = Cron\MapUpdate->deleteMapData, @downtime
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class CharacterUpdate {
|
||||
* @param \Base $f3
|
||||
* @return int
|
||||
*/
|
||||
protected function getCharacterLogActiveTime($f3){
|
||||
protected function getCharacterLogActiveTime(\Base $f3){
|
||||
$logActiveTime = (int)$f3->get('PATHFINDER.CACHE.CHARACTER_LOG_ACTIVE');
|
||||
return ($logActiveTime >= 0) ? $logActiveTime : self::CHARACTER_LOG_ACTIVE;
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class CharacterUpdate {
|
||||
* @param \Base $f3
|
||||
* @return int
|
||||
*/
|
||||
protected function getCharacterLogInactiveTime($f3){
|
||||
protected function getCharacterLogInactiveTime(\Base $f3){
|
||||
$logInactiveTime = (int)$f3->get('PATHFINDER.CACHE.CHARACTER_LOG_INACTIVE');
|
||||
return ($logInactiveTime >= 0) ? $logInactiveTime : self::CHARACTER_LOG_INACTIVE;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ class CharacterUpdate {
|
||||
* >> php index.php "/cron/deactivateLogData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
function deactivateLogData($f3){
|
||||
public function deactivateLogData(\Base $f3){
|
||||
DB\Database::instance()->getDB('PF');
|
||||
$logActiveTime = $this->getCharacterLogActiveTime($f3);
|
||||
|
||||
@@ -75,7 +75,7 @@ class CharacterUpdate {
|
||||
* >> php index.php "/cron/deleteLogData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
function deleteLogData($f3){
|
||||
public function deleteLogData(\Base $f3){
|
||||
DB\Database::instance()->getDB('PF');
|
||||
$logInactiveTime = $this->getCharacterLogInactiveTime($f3);
|
||||
|
||||
@@ -101,13 +101,43 @@ class CharacterUpdate {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* clean up outdated character data e.g. kicked until status
|
||||
* >> php index.php "/cron/cleanUpCharacterData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
public function cleanUpCharacterData(\Base $f3){
|
||||
DB\Database::instance()->getDB('PF');
|
||||
|
||||
/**
|
||||
* @var $characterModel Model\CharacterModel
|
||||
*/
|
||||
$characterModel = Model\BasicModel::getNew('CharacterModel', 0);
|
||||
|
||||
$characters = $characterModel->find([
|
||||
'active = :active AND TIMESTAMPDIFF(SECOND, kicked, NOW() ) > 0',
|
||||
':active' => 1
|
||||
]);
|
||||
|
||||
|
||||
if(is_object($characters)){
|
||||
foreach($characters as $character){
|
||||
/**
|
||||
* @var $character Model\CharacterModel
|
||||
*/
|
||||
$character->kick();
|
||||
$character->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* delete expired character authentication data
|
||||
* authentication data is used for cookie based login
|
||||
* >> php index.php "/cron/deleteAuthenticationData"
|
||||
* @param \Base $f3
|
||||
*/
|
||||
function deleteAuthenticationData($f3){
|
||||
public function deleteAuthenticationData($f3){
|
||||
DB\Database::instance()->getDB('PF');
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user