Skip to content

Commit 54c455e

Browse files
committed
[ADD] Ability to log module events.
1 parent 6654bf6 commit 54c455e

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

core/src/Legacy/LogHandler.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ public static function getAction($actionId, $itemid = '')
3737
$text = get_by_key(self::$actions, $actionId, 'Idle (unknown)');
3838

3939
if ($actionId == 112) {
40-
$text .= ' ' . $itemid;
40+
if (isset($_SESSION['itemaction']) && trim($_SESSION['itemaction'])) {
41+
$text = $_SESSION['itemaction'];
42+
} else {
43+
$text .= ' ' . $itemid;
44+
}
4145
}
4246

4347
return sprintf($text, $itemid);
@@ -61,15 +65,19 @@ public function initAndWriteLog(
6165
$itemname = ""
6266
) {
6367
$this->entry['msg'] = $msg; // writes testmessage to the object
64-
$this->entry['action'] = empty($action) ? evo()->getManagerApi()->action : $action; // writes the action to the object
68+
$this->entry['action'] = empty($action) ? evo()->getManagerApi()->action : $action; // writes the action to the object
6569

6670
// User Credentials
6771
$this->entry['internalKey'] = $internalKey == "" ? evo()->getLoginUserID() : $internalKey;
6872
$this->entry['username'] = $username == "" ? evo()->getLoginUserName() : $username;
6973

70-
$this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object
74+
$this->entry['itemId'] = (empty($itemid) && isset($_REQUEST['id'])) ? (int)$_REQUEST['id'] : $itemid; // writes the id to the object
7175
if ($this->entry['itemId'] == 0) {
72-
$this->entry['itemId'] = "-";
76+
if (isset($_REQUEST['i']) && (int)$_REQUEST['i'] > 0) {
77+
$this->entry['itemId'] = (int)$_REQUEST['i'];
78+
} else {
79+
$this->entry['itemId'] = "-";
80+
}
7381
} // to stop items having id 0
7482

7583
$this->entry['itemName'] = ($itemname == "" && isset($_SESSION['itemname'])) ? $_SESSION['itemname'] : $itemname; // writes the id to the object

core/src/ManagerTheme.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ public function handle($action, array $data = [])
450450
}
451451
/********************************************************************/
452452

453-
unset($_SESSION['itemname']); // clear this, because it's only set for logging purposes
453+
unset($_SESSION['itemname'], $_SESSION['itemaction']); // clear this, because it's only set for logging purposes
454454

455455
return $out;
456456
}

0 commit comments

Comments
 (0)