1 | <?php |
||
25 | class FileQueueProgressLogger implements QueueProgressLoggerInterface |
||
26 | { |
||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private const LOG_DIR = '/var/log/varnish/'; |
||
31 | private const LOG_FILE = '.queue_progress.log'; |
||
32 | |||
33 | /** |
||
34 | * @var File |
||
35 | */ |
||
36 | private $fileHandler; |
||
37 | |||
38 | /** |
||
39 | * @var string |
||
40 | */ |
||
41 | private $logDir; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $logFile; |
||
47 | |||
48 | /** |
||
49 | * @var ProgressDataFactory |
||
50 | */ |
||
51 | private $progressDataFactory; |
||
52 | |||
53 | /** |
||
54 | * FileLock constructor. |
||
55 | * @param DirectoryList $directoryList |
||
56 | * @param File $fileHandler |
||
57 | * @param ProgressDataFactory $progressDataFactory |
||
58 | */ |
||
59 | public function __construct( |
||
69 | |||
70 | /** |
||
71 | * @param string $type |
||
72 | * @param int $current |
||
73 | * @param int $total |
||
74 | * @return void |
||
75 | * @throws Exception |
||
76 | */ |
||
77 | public function logProgress(string $type, int $current, int $total): void |
||
85 | |||
86 | /** |
||
87 | * @return ProgressDataInterface |
||
88 | */ |
||
89 | public function getProgressData(): ProgressDataInterface |
||
94 | |||
95 | /** |
||
96 | * @param string $type |
||
97 | * @param int $current |
||
98 | * @param int $total |
||
99 | * @return string |
||
100 | */ |
||
101 | private function prepareDataToLog(string $type, int $current, int $total): string |
||
111 | |||
112 | /** |
||
113 | * @param string $loggedData |
||
114 | * @return ProgressDataInterface |
||
115 | */ |
||
116 | private function retrieveLogData(string $loggedData): ProgressDataInterface |
||
128 | } |
||
129 |