/** * Populate all static view files for specified root path and list of languages * * @param ObjectManagerFactory $omFactory * @param array $locales * @return void */ public function deploy(ObjectManagerFactory $omFactory, array $locales) { $this->omFactory = $omFactory; if ($this->isDryRun) { $this->logger->logMessage('Dry run. Nothing will be recorded to the target directory.'); } $langList = implode(', ', $locales); $this->logger->logMessage("Requested languages: {$langList}"); $libFiles = $this->filesUtil->getStaticLibraryFiles(); list($areas, $appFiles) = $this->collectAppFiles($locales); foreach ($areas as $area => $themes) { $this->emulateApplicationArea($area); foreach ($locales as $locale) { foreach ($themes as $themePath) { $this->logger->logMessage("=== {$area} -> {$themePath} -> {$locale} ==="); $this->count = 0; $this->errorCount = 0; foreach ($appFiles as $info) { list(, , , $module, $filePath) = $info; $this->deployFile($filePath, $area, $themePath, $locale, $module); } foreach ($libFiles as $filePath) { $this->deployFile($filePath, $area, $themePath, $locale, null); } $this->logger->logMessage("\nSuccessful: {$this->count} files; errors: {$this->errorCount}\n---\n"); } } } $version = $this->dateTime->toTimestamp(true); $this->logger->logMessage("New version of deployed files: {$version}"); if (!$this->isDryRun) { $this->versionStorage->save($version); } }