Conditions | 3 |
Paths | 3 |
Total Lines | 27 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
25 | public function execute(ConsumerEvent $event, $directory) |
||
26 | { |
||
27 | $sha1LockFile = sha1_file($this->workingTempPath.'/'.$directory.'/composer.lock'); |
||
28 | $resultPath = $this->rootDir.'/../web/assets/'.$sha1LockFile; |
||
29 | |||
30 | if (is_file($resultPath.'/vendor.zip')) { |
||
31 | $this->triggerNewStep($event, ['message' => 'Serving cached vendor.zip']); |
||
32 | |||
33 | return 0; |
||
34 | } |
||
35 | |||
36 | $this->triggerNewStep($event, ['message' => 'Compressing vendor.zip']); |
||
37 | |||
38 | $this->filesystem->mkdir($resultPath); |
||
39 | |||
40 | $process = new Process('zip -rq '.$resultPath.'/vendor.zip .'); |
||
41 | $process->setWorkingDirectory($this->workingTempPath.'/'.$directory); |
||
42 | $process->run(); |
||
43 | |||
44 | if (!$process->isSuccessful()) { |
||
45 | $this->triggerError($event, ['message' => $process->getErrorOutput()]); |
||
46 | |||
47 | return 1; |
||
48 | } |
||
49 | |||
50 | return 0; |
||
51 | } |
||
52 | } |
||
53 |