Example #1
0
 /**
  * Print the configuration as plain text formatted to use in a tar file.
  *
  * @param  ConfigIteratorSettings $settings
  * @see iterate()
  */
 protected function printRaw(ConfigIteratorSettings &$settings)
 {
     $this->build();
     $this->buildHash();
     $settings->addInfo('hash', $this->getHash());
     $file_name = $this->storage->getFileName();
     $settings->addInfo('exported', $this->getUniqueId());
     foreach ($this->getRequiredModules() as $module => $status) {
         $settings->addInfo('modules', $module);
     }
     $settings->addInfo('exported_files', $file_name);
     if ($settings->getSetting('format') == 'tar') {
         $file_content = $this->raw();
         print ConfigurationManagement::createTarContent($settings->getSetting('tar_folder') . "/{$file_name}", $file_content);
     } else {
         $print = $settings->getSetting('print');
         if (is_array($print)) {
             if (!empty($print['dependencies'])) {
                 foreach (array_keys($this->getDependencies()) as $line) {
                     print '  "' . $line . '": "' . $line . "\",\n";
                 }
             }
             if (!empty($print['optionals'])) {
                 foreach (array_keys($this->getOptionalConfigurations()) as $line) {
                     print '  "' . $line . '": "' . $line . "\",\n";
                 }
             }
         }
     }
 }