コード例 #1
0
ファイル: ModuleInstaller.php プロジェクト: acp3/setup
 /**
  * @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
ファイル: 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.");
             }
         }
     }
 }
コード例 #3
0
ファイル: SchemaUpdateModel.php プロジェクト: acp3/setup
 /**
  * @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;
 }
コード例 #4
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);
     }
 }