@@ -43,8 +43,8 @@ |
||
| 43 | 43 | public function toArray(): array |
| 44 | 44 | { |
| 45 | 45 | return [ |
| 46 | - 'tenant' => $this->tenantId, |
|
| 47 | - 'content' => $this->content, |
|
| 46 | + 'tenant' => $this->tenantId, |
|
| 47 | + 'content' => $this->content, |
|
| 48 | 48 | ]; |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -47,49 +47,3 @@ |
||
| 47 | 47 | ->setName(self::$defaultName) |
| 48 | 48 | ->setDescription('Downloads theme from configured storage.') |
| 49 | 49 | ->setHelp(<<<'EOT' |
| 50 | -Location for themes archive can be defined by `THEMES_DOWNLOAD_URL` env variable. |
|
| 51 | - |
|
| 52 | -Themes must be packed into one compressed file (*.zip). |
|
| 53 | -Archive can be created with 'zip -r ../themes.zip *' command (called from your themes directory). |
|
| 54 | - |
|
| 55 | -Remember that themes must be located in their tenants directories. Example: |
|
| 56 | - |
|
| 57 | -123abc |
|
| 58 | - theme_1 |
|
| 59 | - theme_2 |
|
| 60 | -456def |
|
| 61 | - theme_3 |
|
| 62 | - |
|
| 63 | -EOT); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - protected function execute(InputInterface $input, OutputInterface $output): void |
|
| 67 | - { |
|
| 68 | - if ('' === $this->themesUrl) { |
|
| 69 | - $output->writeln('<bg=red;options=bold>Themes archive url is empty.</>'); |
|
| 70 | - |
|
| 71 | - return; |
|
| 72 | - } |
|
| 73 | - $client = new Client(); |
|
| 74 | - $tempLocation = rtrim(sys_get_temp_dir(), '/').DIRECTORY_SEPARATOR.'themes.zip'; |
|
| 75 | - try { |
|
| 76 | - $client->request('GET', $this->themesUrl, ['sink' => $tempLocation]); |
|
| 77 | - } catch (ConnectException $e) { |
|
| 78 | - $output->writeln(sprintf("<bg=red;options=bold>Can't download themes package from '%s'.</>", $this->themesUrl)); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - $filesystem = new Filesystem(); |
|
| 82 | - |
|
| 83 | - $zip = new \ZipArchive(); |
|
| 84 | - if (true === $zip->open($tempLocation)) { |
|
| 85 | - if (!$filesystem->exists($this->themesDirectory)) { |
|
| 86 | - $filesystem->mkdir($this->themesDirectory); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $zip->extractTo($this->themesDirectory); |
|
| 90 | - $zip->close(); |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - $output->writeln('<bg=green;options=bold>Themes were downloaded and extracted.</>'); |
|
| 94 | - } |
|
| 95 | -} |
|