Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
ManagementClearDeployProgressLogic
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 3
30
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 validateImpl
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 executeImpl
0.00% covered (danger)
0.00%
0 / 10
0.00% covered (danger)
0.00%
0 / 1
12
1<?php
2
3declare(strict_types=1);
4
5namespace PeServer\App\Models\Domain\Page\Management;
6
7use PeServer\App\Models\AppConfiguration;
8use PeServer\App\Models\AppDatabaseCache;
9use PeServer\App\Models\Domain\Api\AdministratorApi\AdministratorApiDeployLogic;
10use PeServer\App\Models\Domain\Page\PageLogicBase;
11use PeServer\Core\IO\File;
12use PeServer\Core\IO\Path;
13use PeServer\Core\Mvc\LogicCallMode;
14use PeServer\Core\Mvc\LogicParameter;
15use PeServer\Core\Stopwatch;
16
17class ManagementClearDeployProgressLogic extends PageLogicBase
18{
19    public function __construct(
20        LogicParameter $parameter,
21        private AppConfiguration $appConfig,
22    ) {
23        parent::__construct($parameter);
24    }
25
26    protected function validateImpl(LogicCallMode $callMode): void
27    {
28        //NOP
29    }
30
31    protected function executeImpl(LogicCallMode $callMode): void
32    {
33        $stopwatch =  Stopwatch::startNew();
34
35        $progressFilePath = Path::combine($this->appConfig->setting->cache->deploy, AdministratorApiDeployLogic::PROGRESS_FILE_NAME);
36        $this->logger->debug('$progressFilePath: {0}', $progressFilePath);
37        $existsProgressFilePath = File::exists($progressFilePath);
38        if ($existsProgressFilePath) {
39            File::removeFile($progressFilePath);
40        }
41
42        $stopwatch->stop();
43
44        if ($existsProgressFilePath) {
45            $this->addTemporaryMessage('デプロイ進捗ファイル破棄完了: ' . $stopwatch->toString());
46        } else {
47            $this->addTemporaryMessage('デプロイ進捗ファイルなし: ' . $stopwatch->toString());
48        }
49    }
50}