diff options
Diffstat (limited to 'main/app/sprinkles/account/src/Log')
-rw-r--r-- | main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php | 33 | ||||
-rw-r--r-- | main/app/sprinkles/account/src/Log/UserActivityProcessor.php | 44 |
2 files changed, 0 insertions, 77 deletions
diff --git a/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php b/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php deleted file mode 100644 index eb57f43..0000000 --- a/main/app/sprinkles/account/src/Log/UserActivityDatabaseHandler.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php
-/**
- * UserFrosting (http://www.userfrosting.com)
- *
- * @link https://github.com/userfrosting/UserFrosting
- * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\Account\Log;
-
-use UserFrosting\Sprinkle\Core\Log\DatabaseHandler;
-
-/**
- * Monolog handler for storing user activities to the database.
- *
- * @author Alex Weissman (https://alexanderweissman.com)
- */
-class UserActivityDatabaseHandler extends DatabaseHandler
-{
- /**
- * {@inheritDoc}
- */
- protected function write(array $record) {
- $log = $this->classMapper->createInstance($this->modelName, $record['extra']);
- $log->save();
-
- if (isset($record['extra']['user_id'])) {
- $user = $this->classMapper->staticMethod('user', 'find', $record['extra']['user_id']);
- $user->last_activity_id = $log->id;
- $user->save();
- }
- }
-}
diff --git a/main/app/sprinkles/account/src/Log/UserActivityProcessor.php b/main/app/sprinkles/account/src/Log/UserActivityProcessor.php deleted file mode 100644 index a5c0d98..0000000 --- a/main/app/sprinkles/account/src/Log/UserActivityProcessor.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php
-/**
- * UserFrosting (http://www.userfrosting.com)
- *
- * @link https://github.com/userfrosting/UserFrosting
- * @license https://github.com/userfrosting/UserFrosting/blob/master/licenses/UserFrosting.md (MIT License)
- */
-
-namespace UserFrosting\Sprinkle\Account\Log;
-
-use Monolog\Logger;
-
-/**
- * Monolog processor for constructing the user activity message.
- *
- * @author Alex Weissman (https://alexanderweissman.com)
- */
-class UserActivityProcessor
-{
- /**
- * @var int
- */
- protected $userId;
-
- /**
- * @param int $userId The id of the user for whom we will be logging activities.
- */
- public function __construct($userId) {
- $this->userId = $userId;
- }
-
- public function __invoke(array $record) {
- $additionalFields = [
- 'ip_address' => $_SERVER['REMOTE_ADDR'],
- 'user_id' => $this->userId,
- 'occurred_at' => $record['datetime'],
- 'description' => $record['message']
- ];
-
- $record['extra'] = array_replace_recursive($record['extra'], $additionalFields, $record['context']);
-
- return $record;
- }
-}
|