예제 #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
 /**
  * @return array
  */
 protected function getAvailableDesigns()
 {
     $designs = [];
     $path = $this->appPath->getDesignRootPathInternal();
     $directories = Core\Filesystem::scandir($path);
     foreach ($directories as $directory) {
         $designInfo = $this->xml->parseXmlFile($path . $directory . '/info.xml', '/design');
         if (!empty($designInfo)) {
             $designs[] = array_merge($designInfo, ['selected' => $this->config->getSettings(Schema::MODULE_NAME)['design'] === $directory ? 1 : 0, 'dir' => $directory]);
         }
     }
     return $designs;
 }
예제 #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
파일: Purge.php 프로젝트: acp3/core
 /**
  * @param string $directory
  * @param string $cacheId
  */
 protected static function purgeCurrentDirectory($directory, $cacheId)
 {
     if (is_link($directory)) {
         static::purgeCurrentDirectory(readlink($directory), $cacheId);
     } elseif (is_dir($directory)) {
         foreach (Filesystem::scandir($directory) as $dirContent) {
             $path = "{$directory}/{$dirContent}";
             if (is_dir($path)) {
                 static::purgeCurrentDirectory($path, $cacheId);
                 if (empty($cacheId)) {
                     @rmdir($path);
                 }
             } elseif (empty($cacheId) || strpos($dirContent, $cacheId) !== false) {
                 @unlink($path);
             }
         }
     } elseif (is_file($directory)) {
         @unlink($directory);
     }
 }
예제 #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
 /**
  * Generiert das Dropdown-Menü mit der zur Verfügung stehenden Installersprachen
  *
  * @param string $selectedLanguage
  *
  * @return array
  */
 private function languagesDropdown($selectedLanguage)
 {
     $languages = [];
     $path = $this->appPath->getInstallerModulesDir() . 'Install/Resources/i18n/';
     foreach (Filesystem::scandir($path) as $row) {
         $langInfo = simplexml_load_file($path . $row);
         if (!empty($langInfo)) {
             $languages[] = ['language' => substr($row, 0, -4), 'selected' => $selectedLanguage === substr($row, 0, -4) ? ' selected="selected"' : '', 'name' => $langInfo->info->name];
         }
     }
     return $languages;
 }
예제 #7
0
파일: Requirements.php 프로젝트: acp3/setup
 /**
  * @return array
  */
 private function fetchRequiredFilesAndDirectories()
 {
     $defaults = ['ACP3/config.yml', 'cache/', 'uploads/', 'uploads/assets/'];
     foreach (Filesystem::scandir($this->appPath->getModulesDir()) as $row) {
         $path = 'uploads/' . $row . '/';
         if (is_dir(ACP3_ROOT_DIR . $path) === true) {
             $defaults[] = $path;
         }
     }
     return $defaults;
 }
예제 #8
0
파일: Modules.php 프로젝트: acp3/core
 /**
  * Returns an alphabetically sorted array of all found ACP3 modules
  *
  * @return array
  */
 public function getAllModules()
 {
     if (empty($this->allModules)) {
         foreach ($this->vendors->getVendors() as $vendor) {
             foreach (Filesystem::scandir($this->appPath->getModulesDir() . $vendor . '/') as $module) {
                 $info = $this->getModuleInfo($module);
                 if (!empty($info)) {
                     $this->allModules[$info['name']] = $info;
                 }
             }
         }
         ksort($this->allModules);
     }
     return $this->allModules;
 }
예제 #9
0
 /**
  * @param string $vendor
  *
  * @return array
  */
 protected function fetchVendorModules($vendor)
 {
     $infos = [];
     $modules = Filesystem::scandir($this->appPath->getModulesDir() . $vendor . '/');
     if (!empty($modules)) {
         foreach ($modules as $module) {
             $moduleInfo = $this->fetchModuleInfo($module);
             if (!empty($moduleInfo)) {
                 $infos[strtolower($module)] = $moduleInfo;
             }
         }
     }
     return $infos;
 }
예제 #10
0
파일: Vendor.php 프로젝트: acp3/core
 /**
  * Caches the various module vendors
  */
 protected function cacheVendors()
 {
     $this->vendors = array_merge(['ACP3'], Filesystem::scandir($this->appPath->getModulesDir(), ['ACP3', 'Custom']), ['Custom']);
 }
예제 #11
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.");
             }
         }
     }
 }