예제 #1
0
 /**
  * @param ContainerInterface $container
  * @param array $modules
  * @return array
  * @throws \Exception
  */
 public function installModules(ContainerInterface $container, array $modules = [])
 {
     foreach ($this->vendor->getVendors() as $vendor) {
         $vendorPath = $this->applicationPath->getModulesDir() . $vendor . '/';
         $vendorModules = count($modules) > 0 ? $modules : Filesystem::scandir($vendorPath);
         foreach ($vendorModules as $module) {
             $module = strtolower($module);
             if (isset($this->results[$module])) {
                 continue;
             }
             $modulePath = $vendorPath . ucfirst($module) . '/';
             $moduleConfigPath = $modulePath . 'Resources/config/module.xml';
             if (is_dir($modulePath) && is_file($moduleConfigPath)) {
                 $dependencies = $this->getModuleDependencies($moduleConfigPath);
                 if (count($dependencies) > 0) {
                     $this->installModules($container, $dependencies);
                 }
                 if ($this->installHelper->installModule($module, $container) === false) {
                     throw new \Exception("Error while installing module {$module}.");
                 }
                 $this->results[$module] = true;
             }
         }
     }
     return $this->results;
 }
예제 #2
0
파일: Asset.php 프로젝트: acp3/setup
 /**
  * @param string $template
  *
  * @return string
  */
 protected function resolveTemplatePath($template)
 {
     // If an template with directory is given, uppercase the first letter
     if (strpos($template, '/') !== false) {
         $template = ucfirst($template);
         // Pfad zerlegen
         $fragments = explode('/', $template);
         if (count($fragments) === 3) {
             $path = $fragments[0] . '/Resources/View/' . $fragments[1] . '/' . $fragments[2];
         } else {
             $path = $fragments[0] . '/Resources/View/' . $fragments[1];
         }
         return $this->appPath->getInstallerModulesDir() . $path;
     }
     return $this->appPath->getDesignPathInternal() . $template;
 }
예제 #3
0
 /**
  * Cacht die Sprachfiles, um diese schneller verarbeiten zu können
  *
  * @param string $language
  *
  * @return array
  */
 public function setLanguageCache($language)
 {
     $data = [];
     foreach (Filesystem::scandir($this->appPath->getInstallerModulesDir()) as $module) {
         $path = $this->appPath->getInstallerModulesDir() . $module . '/Resources/i18n/' . $language . '.xml';
         if (is_file($path) === true) {
             $xml = simplexml_load_file($path);
             if (isset($data['info']['direction']) === false) {
                 $data['info']['direction'] = (string) $xml->info->direction;
             }
             // Über die einzelnen Sprachstrings iterieren
             foreach ($xml->keys->item as $item) {
                 $data['keys'][strtolower($module . (string) $item['key'])] = trim((string) $item);
             }
         }
     }
     return $data;
 }
예제 #4
0
파일: InstallModel.php 프로젝트: acp3/setup
 /**
  * @throws \Exception
  */
 public function installSampleData()
 {
     foreach ($this->vendor->getVendors() as $vendor) {
         foreach (Filesystem::scandir($this->appPath->getModulesDir() . $vendor . '/') as $module) {
             $module = strtolower($module);
             $sampleDataInstallResult = $this->installHelper->installSampleData($module, $this->container, $this->container->get('core.modules.schemaHelper'));
             if ($sampleDataInstallResult === false) {
                 throw new \Exception("Error while installing module sample data.");
             }
         }
     }
 }
예제 #5
0
 /**
  * @param ContainerInterface $container
  * @param array $modules
  * @return array
  * @throws \Exception
  */
 public function updateModules(ContainerInterface $container, array $modules = [])
 {
     foreach ($this->vendor->getVendors() as $vendor) {
         $vendorPath = $this->applicationPath->getModulesDir() . $vendor . '/';
         $vendorModules = count($modules) > 0 ? $modules : Filesystem::scandir($vendorPath);
         foreach ($vendorModules as $module) {
             $module = strtolower($module);
             if (isset($this->results[$module])) {
                 continue;
             }
             $modulePath = $vendorPath . ucfirst($module) . '/';
             $moduleConfigPath = $modulePath . 'Resources/config/module.xml';
             if (is_dir($modulePath) && is_file($moduleConfigPath)) {
                 $dependencies = $this->getModuleDependencies($moduleConfigPath);
                 if (count($dependencies) > 0) {
                     $this->updateModules($container, $dependencies);
                 }
                 $this->results[$module] = $this->updateModule($container, $module);
             }
         }
     }
     return $this->results;
 }
예제 #6
0
 /**
  * @param YamlFileLoader $loader
  */
 private function includeModules(YamlFileLoader $loader)
 {
     if ($this->canIncludeModules() === true) {
         $request = $this->get('core.http.request');
         $router = $this->get('core.router');
         $vendors = $this->get('core.modules.vendors')->getVendors();
         foreach ($vendors as $vendor) {
             $namespaceModules = glob($this->applicationPath->getModulesDir() . $vendor . '/*/Resources/config/services.yml');
             foreach ($namespaceModules as $module) {
                 $loader->load($module);
             }
         }
         $this->set('core.http.request', $request);
         $this->set('core.router', $router);
     }
 }
예제 #7
0
 private function setLanguage()
 {
     $cookieLocale = $this->request->getCookies()->get('ACP3_INSTALLER_LANG', '');
     if (!preg_match('=/=', $cookieLocale) && is_file($this->appPath->getInstallerModulesDir() . 'Install/Resources/i18n/' . $cookieLocale . '.xml') === true) {
         $language = $cookieLocale;
     } else {
         $language = 'en_US';
         // Fallback language
         foreach ($this->request->getUserAgent()->parseAcceptLanguage() as $locale => $val) {
             $locale = str_replace('-', '_', $locale);
             if ($this->translator->languagePackExists($locale) === true) {
                 $language = $locale;
                 break;
             }
         }
     }
     $this->translator->setLocale($language);
 }