diff --git a/Admin/Install/db.json b/Admin/Install/db.json index b26d2fc..f4dd8af 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -26,9 +26,9 @@ "type": "INT", "null": false }, - "auditor_audit_subtype": { - "name": "auditor_audit_subtype", - "type": "INT", + "auditor_audit_trigger": { + "name": "auditor_audit_trigger", + "type": "VARCHAR(255)", "null": false }, "auditor_audit_content": { diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 6e8d00d..44ec491 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -36,7 +36,7 @@ final class ApiController extends Controller * @param mixed $old Old value (always null) * @param mixed $new New value * @param int $type Module model type - * @param int $subtype Module model subtype + * @param string $trigger What triggered this log? * @param string $module Module name * @param string $ref Reference to other model * @param string $content Message @@ -50,10 +50,10 @@ final class ApiController extends Controller */ public function apiLogCreate( int $account, - $old, - $new, + mixed $old, + mixed $new, int $type = 0, - int $subtype = 0, + string $trigger = '', string $module = null, string $ref = null, string $content = null, @@ -61,7 +61,7 @@ final class ApiController extends Controller ) : void { $newString = StringUtils::stringify($new, \JSON_PRETTY_PRINT); - $audit = new Audit(new NullAccount($account), null, $newString, $type, $subtype, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1')); + $audit = new Audit(new NullAccount($account), null, $newString, $type, $trigger, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1')); AuditMapper::create($audit); } @@ -73,7 +73,7 @@ final class ApiController extends Controller * @param mixed $old Old value * @param mixed $new New value * @param int $type Module model type - * @param int $subtype Module model subtype + * @param string $trigger What triggered this log? * @param string $module Module name * @param string $ref Reference to other model * @param string $content Message @@ -87,10 +87,10 @@ final class ApiController extends Controller */ public function apiLogUpdate( int $account, - $old, - $new, + mixed $old, + mixed $new, int $type = 0, - int $subtype = 0, + string $trigger = '', string $module = null, string $ref = null, string $content = null, @@ -104,7 +104,7 @@ final class ApiController extends Controller return; } - $audit = new Audit(new NullAccount($account), $oldString, $newString, $type, $subtype, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1')); + $audit = new Audit(new NullAccount($account), $oldString, $newString, $type, $trigger, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1')); AuditMapper::create($audit); } @@ -116,7 +116,7 @@ final class ApiController extends Controller * @param mixed $old Old value * @param mixed $new New value (always null) * @param int $type Module model type - * @param int $subtype Module model subtype + * @param string $trigger What triggered this log? * @param string $module Module name * @param string $ref Reference to other model * @param string $content Message @@ -130,10 +130,10 @@ final class ApiController extends Controller */ public function apiLogDelete( int $account, - $old, - $new, + mixed $old, + mixed $new, int $type = 0, - int $subtype = 0, + string $trigger = '', string $module = null, string $ref = null, string $content = null, @@ -141,7 +141,7 @@ final class ApiController extends Controller ) : void { $oldString = StringUtils::stringify($old, \JSON_PRETTY_PRINT); - $audit = new Audit(new NullAccount($account), $oldString, null, $type, $subtype, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1')); + $audit = new Audit(new NullAccount($account), $oldString, null, $type, $trigger, $module, $ref, $content, (int) \ip2long($ip ?? '127.0.0.1')); AuditMapper::create($audit); } diff --git a/Models/Audit.php b/Models/Audit.php index 9c0fb89..ba07548 100755 --- a/Models/Audit.php +++ b/Models/Audit.php @@ -44,12 +44,12 @@ class Audit private int $type; /** - * Audit subtype. + * Audit trigger. * - * @var int + * @var string * @since 1.0.0 */ - private int $subtype; + private string $trigger; /** * Audit module. @@ -126,7 +126,7 @@ class Audit * @param null|string $old Old value * @param null|string $new New value * @param int $type Type of the audit - * @param int $subtype Subtype of the audit + * @param string $trigger Subtype of the audit * @param null|string $module Module id * @param null|string $ref Dynamic reference to model * @param null|string $content Additional audit information @@ -139,7 +139,7 @@ class Audit string $old = null, string $new = null, int $type = 0, - int $subtype = 0, + string $trigger = '', string $module = null, string $ref = null, string $content = null, @@ -150,7 +150,7 @@ class Audit $this->old = $old; $this->new = $new; $this->type = $type; - $this->subtype = $subtype; + $this->trigger = $trigger; $this->module = $module; $this->ref = $ref; $this->content = $content; @@ -188,9 +188,9 @@ class Audit * * @since 1.0.0 */ - public function getSubType() : int + public function getTrigger() : string { - return $this->subtype; + return $this->trigger; } /** diff --git a/Models/AuditMapper.php b/Models/AuditMapper.php index 805181a..6426b34 100755 --- a/Models/AuditMapper.php +++ b/Models/AuditMapper.php @@ -42,7 +42,7 @@ final class AuditMapper extends DataMapperAbstract 'auditor_audit_module' => ['name' => 'auditor_audit_module', 'type' => 'string', 'internal' => 'module'], 'auditor_audit_ref' => ['name' => 'auditor_audit_ref', 'type' => 'string', 'internal' => 'ref'], 'auditor_audit_type' => ['name' => 'auditor_audit_type', 'type' => 'int', 'internal' => 'type'], - 'auditor_audit_subtype' => ['name' => 'auditor_audit_subtype', 'type' => 'int', 'internal' => 'subtype'], + 'auditor_audit_trigger' => ['name' => 'auditor_audit_trigger', 'type' => 'string', 'internal' => 'trigger'], 'auditor_audit_content' => ['name' => 'auditor_audit_content', 'type' => 'string', 'internal' => 'content'], 'auditor_audit_old' => ['name' => 'auditor_audit_old', 'type' => 'string', 'internal' => 'old'], 'auditor_audit_new' => ['name' => 'auditor_audit_new', 'type' => 'string', 'internal' => 'new'], diff --git a/Theme/Backend/audit-list.tpl.php b/Theme/Backend/audit-list.tpl.php index 8e9f928..4267390 100755 --- a/Theme/Backend/audit-list.tpl.php +++ b/Theme/Backend/audit-list.tpl.php @@ -36,8 +36,6 @@ echo $this->getData('nav')->render(); ?>