diff --git a/lam/VERSION b/lam/VERSION index a50da158..610207b4 100644 --- a/lam/VERSION +++ b/lam/VERSION @@ -1 +1 @@ -7.2.RC1 +7.2.DEV diff --git a/lam/lib/config.inc b/lam/lib/config.inc index 6419f1d0..d0e87366 100644 --- a/lam/lib/config.inc +++ b/lam/lib/config.inc @@ -667,6 +667,17 @@ class LAMConfig { $data['moduleSettings'] = $this->moduleSettings; $data['toolSettings'] = $this->toolSettings; $data['jobSettings'] = $this->jobSettings; + if ($this->jobsDatabase === 'SQLite') { + $dbFileName = __DIR__ . '/../config/' . $this->getName() . '.sqlite'; + if (is_file($dbFileName) && is_readable($dbFileName)) { + $file = @fopen($dbFileName, "r"); + if ($file) { + $dbData = fread($file, 100000000); + fclose($file); + $data['jobSQLite'] = base64_encode($dbData); + } + } + } return $data; } @@ -699,6 +710,14 @@ class LAMConfig { $this->toolSettings = $toolSettingsData; $jobSettingsData = !empty($data['jobSettings']) && is_array($data['jobSettings']) ? $data['jobSettings'] : array(); $this->jobSettings = $jobSettingsData; + if (!empty($data['jobSQLite'])) { + $dbFileName = __DIR__ . '/../config/' . $this->getName() . '.sqlite'; + $file = @fopen($dbFileName, "wb"); + if ($file) { + fputs($file, base64_decode($data['jobSQLite'])); + fclose($file); + } + } } /** @@ -811,6 +830,10 @@ class LAMConfig { /** Saves preferences to config file */ public function save() { $conffile = $this->getPath(); + if (!file_exists($conffile)) { + $newFile = fopen($conffile, 'wb'); + fclose($newFile); + } if (is_file($conffile) && is_readable($conffile)) { $file = fopen($conffile, "r"); $file_array = array(); diff --git a/lam/lib/persistence.inc b/lam/lib/persistence.inc index 498b0d2c..a5321862 100644 --- a/lam/lib/persistence.inc +++ b/lam/lib/persistence.inc @@ -169,6 +169,9 @@ class ConfigDataImporter { case 'certificates': $this->importCertificates($step->getValue()); break; + case 'serverProfiles': + $this->importServerProfiles($step); + break; default: logNewMessage(LOG_WARNING, 'Unknown import type: ' . $key); } @@ -198,6 +201,25 @@ class ConfigDataImporter { $cfgMain->importCertificates($data); } + /** + * Imports the server profiles. + * + * @param ImporterStep $step step + * @throws LAMException error during import + */ + private function importServerProfiles($step) { + foreach ($step->getSubSteps() as $profileStep) { + if (!$profileStep->isActive()) { + continue; + } + $data = $profileStep->getValue(); + $profileName = str_replace('serverProfile_', '', $profileStep->getKey()); + $serverProfile = new LAMConfig($profileName); + $serverProfile->importData($data); + $serverProfile->save(); + } + } + } /** @@ -218,10 +240,10 @@ class ImporterStep { * @param string $key key * @param array $value value */ - public function __construct($label, $key, &$value) { + public function __construct($label, $key, $value) { $this->label = $label; $this->key = $key; - $this->value = &$value; + $this->value = $value; } /** diff --git a/lam/templates/config/confImportExport.php b/lam/templates/config/confImportExport.php index e6548749..90ff6484 100644 --- a/lam/templates/config/confImportExport.php +++ b/lam/templates/config/confImportExport.php @@ -251,6 +251,9 @@ printHeaderContents(_("Import and export configuration"), '../..'); $importSteps = $importer->getPossibleImportSteps($data); foreach ($importSteps as $importStep) { $importStep->setActive(isset($_POST['step_' . $importStep->getKey()])); + foreach ($importStep->getSubSteps() as $subStep) { + $subStep->setActive(isset($_POST['step_' . $subStep->getKey()])); + } } $importer->runImport($importSteps); unlink($_SESSION['configImportFile']);