error handling
This commit is contained in:
parent
8d50dd59b0
commit
7fcc2cf38d
|
@ -208,6 +208,7 @@ class ConfigDataImporter {
|
||||||
* @throws LAMException error during import
|
* @throws LAMException error during import
|
||||||
*/
|
*/
|
||||||
private function importServerProfiles($step) {
|
private function importServerProfiles($step) {
|
||||||
|
$failedProfiles = array();
|
||||||
foreach ($step->getSubSteps() as $profileStep) {
|
foreach ($step->getSubSteps() as $profileStep) {
|
||||||
if (!$profileStep->isActive()) {
|
if (!$profileStep->isActive()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -216,7 +217,13 @@ class ConfigDataImporter {
|
||||||
$profileName = str_replace('serverProfile_', '', $profileStep->getKey());
|
$profileName = str_replace('serverProfile_', '', $profileStep->getKey());
|
||||||
$serverProfile = new LAMConfig($profileName);
|
$serverProfile = new LAMConfig($profileName);
|
||||||
$serverProfile->importData($data);
|
$serverProfile->importData($data);
|
||||||
$serverProfile->save();
|
$result = $serverProfile->save();
|
||||||
|
if ($result === LAMConfig::SAVE_FAIL) {
|
||||||
|
$failedProfiles[] = $profileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!empty($failedProfiles)) {
|
||||||
|
throw new LAMException(_('Unable to save server profile.'), implode(', ', $failedProfiles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ printHeaderContents(_("Import and export configuration"), '../..');
|
||||||
}
|
}
|
||||||
catch (LAMException $e) {
|
catch (LAMException $e) {
|
||||||
$content->add(new htmlStatusMessage('ERROR', $e->getTitle(), $e->getMessage()), 12);
|
$content->add(new htmlStatusMessage('ERROR', $e->getTitle(), $e->getMessage()), 12);
|
||||||
$content->add(new htmlButton('importCancel', _('Cancel')), 12);
|
$content->add(new htmlButton('importCancel', _('Back')), 12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue