diff --git a/lib/Console/ConnectCommand.php b/lib/Console/ConnectCommand.php index 0080613..10ed846 100644 --- a/lib/Console/ConnectCommand.php +++ b/lib/Console/ConnectCommand.php @@ -13,7 +13,7 @@ use KTXM\ProviderImap\Providers\Provider; use KTXM\ProviderImap\Providers\Service; use KTXM\ProviderImap\Providers\ServiceIdentityBasic; use KTXM\ProviderImap\Providers\ServiceLocation; -use KTXC\SessionTenant; +use KTXC\Context\TenantContext; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -41,7 +41,7 @@ class ConnectCommand extends Command { public function __construct( private readonly Provider $provider, - private readonly SessionTenant $sessionTenant, + private readonly TenantContext $tenantContext, ) { parent::__construct(); } @@ -186,7 +186,7 @@ class ConnectCommand extends Command // ── Persist ────────────────────────────────────────────────────────── - $this->sessionTenant->configureById($tenantId); + $this->tenantContext->resolveIdentifier($tenantId); $label = $io->ask('Service label', $username); if ($label) { diff --git a/lib/Console/DisconnectCommand.php b/lib/Console/DisconnectCommand.php index 5ea6a88..c7d2e23 100644 --- a/lib/Console/DisconnectCommand.php +++ b/lib/Console/DisconnectCommand.php @@ -11,7 +11,7 @@ namespace KTXM\ProviderImap\Console; use KTXM\ProviderImap\Providers\Provider; use KTXM\ProviderImap\Providers\Service; -use KTXC\SessionTenant; +use KTXC\Context\TenantContext; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -37,7 +37,7 @@ class DisconnectCommand extends Command { public function __construct( private readonly Provider $provider, - private readonly SessionTenant $sessionTenant, + private readonly TenantContext $tenantContext, ) { parent::__construct(); } @@ -86,7 +86,7 @@ class DisconnectCommand extends Command $userId = (string) ($input->getOption('user') ?? ''); if ($tenantId !== '' && $userId !== '') { - $this->sessionTenant->configureById($tenantId); + $this->tenantContext->resolveIdentifier($tenantId); $services = $this->provider->serviceList($tenantId, $userId); if (empty($services)) { @@ -130,7 +130,7 @@ class DisconnectCommand extends Command } // ── Fetch service for display ──────────────────────────────────────── - $this->sessionTenant->configureById($tenantId); + $this->tenantContext->resolveIdentifier($tenantId); $service = $this->provider->serviceFetch($tenantId, $userId, $serviceId); if ($service === null) { diff --git a/lib/Console/DiscoverCommand.php b/lib/Console/DiscoverCommand.php index 6d4c08e..9d80bfc 100644 --- a/lib/Console/DiscoverCommand.php +++ b/lib/Console/DiscoverCommand.php @@ -14,7 +14,7 @@ use KTXM\ProviderImap\Providers\Service; use KTXM\ProviderImap\Providers\ServiceIdentityBasic; use KTXM\ProviderImap\Providers\ServiceLocation; use KTXM\ProviderImap\Service\Discovery; -use KTXC\SessionTenant; +use KTXC\Context\TenantContext; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; @@ -43,7 +43,7 @@ class DiscoverCommand extends Command public function __construct( private readonly Provider $provider, private readonly Discovery $discovery, - private readonly SessionTenant $sessionTenant, + private readonly TenantContext $tenantContext, ) { parent::__construct(); } @@ -210,7 +210,7 @@ class DiscoverCommand extends Command // ── Persist ────────────────────────────────────────────────────────── - $this->sessionTenant->configureById($tenantId); + $this->tenantContext->resolveIdentifier($tenantId); $label = $io->ask('Service label', $address); if ($label) { diff --git a/lib/Console/TestCommand.php b/lib/Console/TestCommand.php index 9aba99e..c1f1bfb 100644 --- a/lib/Console/TestCommand.php +++ b/lib/Console/TestCommand.php @@ -9,7 +9,7 @@ declare(strict_types=1); namespace KTXM\ProviderImap\Console; -use KTXC\SessionTenant; +use KTXC\Context\TenantContext; use KTXM\ProviderImap\Client\Command\SelectCommand; use KTXM\ProviderImap\Client\FetchOptions; use KTXM\ProviderImap\Client\FetchTarget; @@ -41,7 +41,7 @@ class TestCommand extends Command { public function __construct( private readonly Provider $provider, - private readonly SessionTenant $sessionTenant, + private readonly TenantContext $tenantContext, ) { parent::__construct(); } @@ -108,7 +108,7 @@ class TestCommand extends Command return Command::FAILURE; } - $this->sessionTenant->configureById($tenantId); + $this->tenantContext->resolveIdentifier($tenantId); $service = $this->provider->serviceFetch($tenantId, $userId, $serviceId); if ($service === null) { @@ -269,7 +269,7 @@ class TestCommand extends Command return; } - $this->sessionTenant->configureById($tenantId); + $this->tenantContext->resolveIdentifier($tenantId); $services = $this->provider->serviceList($tenantId, $userId); if ($services === []) { diff --git a/lib/Service/Remote/RemoteMailService.php b/lib/Service/Remote/RemoteMailService.php index 6190990..08c8b18 100644 --- a/lib/Service/Remote/RemoteMailService.php +++ b/lib/Service/Remote/RemoteMailService.php @@ -11,7 +11,6 @@ namespace KTXM\ProviderImap\Service\Remote; use DateTimeImmutable; use Generator; -use KTXC\Server; use KTXC\Logger\PlainFileLogger; use KTXM\ProviderImap\Client\Client as ImapClient; use KTXM\ProviderImap\Client\Command\AppendCommand; @@ -132,7 +131,7 @@ class RemoteMailService return null; } - $logDir = Server::getInstance()?->logDir() ?? __DIR__ . '/../../../../../var/log'; + $logDir = dirname(__DIR__, 5) . '/var/log'; return new PlainFileLogger($logDir . '/' . $channel, $this->service->identifier()); }