ltsecurityinc安防产品在线商城代码

This commit is contained in:
2026-09-14 17:47:10 +08:00
parent 57d8444c15
commit 6a3c9c5bd8
14539 changed files with 1775310 additions and 0 deletions
+68
View File
@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Cron;
use Amasty\AdminActionsLog\Api\LogEntryRepositoryInterface;
use Amasty\AdminActionsLog\Api\LoginAttemptRepositoryInterface;
use Amasty\AdminActionsLog\Api\VisitHistoryEntryRepositoryInterface;
use Amasty\AdminActionsLog\Model\ConfigProvider;
class LogCleaner
{
/**
* @var ConfigProvider
*/
private $configProvider;
/**
* @var LogEntryRepositoryInterface
*/
private $logEntryRepository;
/**
* @var LoginAttemptRepositoryInterface
*/
private $loginAttemptRepository;
/**
* @var VisitHistoryEntryRepositoryInterface
*/
private $visitHistoryEntryRepository;
public function __construct(
ConfigProvider $configProvider,
LogEntryRepositoryInterface $logEntryRepository,
LoginAttemptRepositoryInterface $loginAttemptRepository,
VisitHistoryEntryRepositoryInterface $visitHistoryEntryRepository
) {
$this->configProvider = $configProvider;
$this->logEntryRepository = $logEntryRepository;
$this->loginAttemptRepository = $loginAttemptRepository;
$this->visitHistoryEntryRepository = $visitHistoryEntryRepository;
}
public function execute()
{
if ($this->configProvider->isNeedCleanActionsLog()) {
$this->logEntryRepository->clean($this->configProvider->getActionsLogPeriod());
}
if ($this->configProvider->isNeedCleanLoginAttemptsLog()) {
//TODO: replace to LoginAttemptsManager->clear()
$this->loginAttemptRepository->clean($this->configProvider->getLoginAttemptsLogPeriod());
}
if ($this->configProvider->isNeedCleanVisitHistoryLog()) {
//TODO: replace to VisitHistoryManager->clear()
$this->visitHistoryEntryRepository->clean($this->configProvider->getVisitHistoryLogPeriod());
}
}
}
@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) Amasty (https://www.amasty.com)
* @package Admin Actions Log for Magento 2
*/
namespace Amasty\AdminActionsLog\Cron;
use Amasty\AdminActionsLog\Api\ActiveSessionManagerInterface;
use Amasty\AdminActionsLog\Api\VisitHistoryManagerInterface;
class UpdateActiveSessions
{
/**
* @var ActiveSessionManagerInterface
*/
private $activeSessionManager;
/**
* @var VisitHistoryManagerInterface
*/
private $visitHistoryManager;
public function __construct(
ActiveSessionManagerInterface $activeSessionManager,
VisitHistoryManagerInterface $visitHistoryManager
) {
$this->activeSessionManager = $activeSessionManager;
$this->visitHistoryManager = $visitHistoryManager;
}
public function execute(): void
{
$inactiveSessions = $this->activeSessionManager->getInactiveSessions();
foreach ($inactiveSessions as $sessionId) {
$this->activeSessionManager->terminate($sessionId);
$this->visitHistoryManager->endVisit($sessionId);
}
}
}