Conditions | 4 |
Paths | 6 |
Total Lines | 23 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
26 | public static function getBinaries(Event $event) |
||
27 | { |
||
28 | $dir = self::getRootPath() . '/bin'; |
||
29 | |||
30 | if (!file_exists($dir)) { |
||
31 | mkdir($dir); |
||
32 | } |
||
33 | |||
34 | $event->getIO()->write("<info>Setup binaries to $dir :</info>"); |
||
35 | |||
36 | foreach (self::$extByPlatforms as $ext) { |
||
37 | foreach (self::$tools as $tool) { |
||
38 | file_put_contents( |
||
39 | $dir . '/' . $tool . $ext, |
||
40 | fopen('https://github.com/nosilver4u/ewww-image-optimizer/raw/master/binaries/' . $tool . $ext, 'r') |
||
41 | ); |
||
42 | chmod($dir . '/' . $tool . $ext, 0754); |
||
43 | $event->getIO()->write($tool . $ext); |
||
44 | } |
||
45 | } |
||
46 | |||
47 | $event->getIO()->write('<info>Setup binaries complete.</info>'); |
||
48 | } |
||
49 | |||
55 |