- new "activity log" for user actions (create/update/delete) of (systems/connections/signatures), resolves #280, relates #271

- new added cronjob to delete old statistics data (older 1 year) (weekly)
- updated main menu structure (added new headlines,...)
- updated "feature page", added new section for "statistics"
- updated "system delete" function. systems with no changes (description/alias) will now get deleted instead of set "active = 0", #184
- changed max expire time from file caching (/tmp/cache) from 20d -> 10d
- changed "character log" TTL from 10s to 5s
- changed cronjob interval for "deleteExpiredData" from "weekly" to "downtime"
- changed "delete" icon (e.g. context menu on map) from "eraser" to "trash"
- removed cronjob output logging (cron_deactivateMapData.log)
- fixed non click-able character panels on login page, closed #332
This commit is contained in:
Exodus4D
2016-10-17 14:01:46 +02:00
parent 5e48cce5ab
commit b2cce3cde2
54 changed files with 2995 additions and 259 deletions

View File

@@ -56,6 +56,14 @@ abstract class BasicModel extends \DB\Cortex {
*/
protected $allowActiveChange = false;
/**
* enables check for $fieldChanges on update/insert
* -> fields that should be checked need an "activity-log" flag
* in $fieldConf config
* @var bool
*/
protected $enableActivityLogging = true;
/**
* getData() cache key prefix
* -> do not change, otherwise cached data is lost
@@ -77,6 +85,12 @@ abstract class BasicModel extends \DB\Cortex {
*/
public static $enableDataImport = false;
/**
* changed fields (columns) on update/insert
* -> e.g. for character "activity logging"
* @var array
*/
protected $fieldChanges = [];
public function __construct($db = NULL, $table = NULL, $fluid = NULL, $ttl = 0){
@@ -157,10 +171,54 @@ abstract class BasicModel extends \DB\Cortex {
if(!$valid){
$this->throwValidationError($key);
}else{
$this->checkFieldForActivityLogging($key, $val);
return parent::set($key, $val);
}
}
/**
* change default "activity logging" status
* -> enable/disable
* @param $status
*/
public function setActivityLogging($status){
$this->enableActivityLogging = (bool) $status;
}
/**
* check column for value changes,
* --> if column is marked for "activity logging"
* @param string $key
* @param mixed $val
*/
protected function checkFieldForActivityLogging($key, $val){
if( $this->enableActivityLogging ){
$fieldConf = $this->fieldConf[$key];
// check for value changes if field has "activity logging" active
if($fieldConf['activity-log'] === true){
if(
is_numeric($val) ||
$fieldConf['type'] === Schema::DT_BOOL
){
$val = (int)$val;
}
if( $fieldConf['type'] === self::DT_JSON){
$currentValue = $this->get($key);
}else{
$currentValue = $this->get($key, true);
}
if($currentValue !== $val){
// field has changed
in_array($key, $this->fieldChanges) ?: $this->fieldChanges[] = $key;
}
}
}
}
/**
* setter for "active" status
* -> default: keep current "active" status
@@ -638,6 +696,18 @@ abstract class BasicModel extends \DB\Cortex {
return ['added' => $addedCount, 'updated' => $updatedCount, 'deleted' => $deletedCount];
}
/**
* buffer a new activity (action) logging
* -> increment buffered counter
* -> log character activity create/update/delete events
* @param int $characterId
* @param int $mapId
* @param string $action
*/
protected function bufferActivity($characterId, $mapId, $action){
Controller\LogController::instance()->bufferActivity($characterId, $mapId, $action);
}
/**
* get the current class name
* -> namespace not included