Example #1
0
 /**
  * Loads configuration data only
  *
  * @return void
  */
 private function loadConfigData()
 {
     $this->config->resetData();
     if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) {
         $this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
     }
 }
Example #2
0
 /**
  * Saves config
  *
  * @param array $data
  * @param bool $override
  * @return void
  */
 public function saveConfig(array $data, $override = false)
 {
     $paths = $this->configFilePool->getPaths();
     foreach ($data as $fileKey => $config) {
         if (isset($paths[$fileKey])) {
             if ($this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->isExist($paths[$fileKey])) {
                 $currentData = $this->reader->load($fileKey);
                 if ($override) {
                     $config = array_merge($currentData, $config);
                 } else {
                     $config = array_replace_recursive($currentData, $config);
                 }
             }
             $contents = $this->formatter->format($config);
             try {
                 $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->writeFile($paths[$fileKey], $contents);
             } catch (FileSystemException $e) {
                 throw new FileSystemException(new Phrase('Deployment config file %1 is not writable.', [$paths[$fileKey]]));
             }
             if (function_exists('opcache_invalidate')) {
                 opcache_invalidate($this->filesystem->getDirectoryRead(DirectoryList::CONFIG)->getAbsolutePath($paths[$fileKey]));
             }
         }
     }
     $this->deploymentConfig->resetData();
 }
Example #3
0
 /**
  * Saves config
  *
  * @param array $data
  * @param bool $override
  * @return void
  */
 public function saveConfig(array $data, $override = false)
 {
     $paths = $this->configFilePool->getPaths();
     foreach ($data as $fileKey => $config) {
         if (isset($paths[$fileKey])) {
             if ($this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->isExist($paths[$fileKey])) {
                 $currentData = $this->reader->load($paths[$fileKey]);
                 if ($override) {
                     $config = array_merge($currentData, $config);
                 } else {
                     $config = array_replace_recursive($currentData, $config);
                 }
             }
             $contents = $this->formatter->format($config);
             $this->filesystem->getDirectoryWrite(DirectoryList::CONFIG)->writeFile($paths[$fileKey], $contents);
         }
     }
     $this->deploymentConfig->resetData();
 }