{'Name'} ?? '');
$path = array_key_exists('Path', $_REQUEST['newStorage']) ? $_REQUEST['newStorage']['Path'] : ($storage->{'Path'} ?? '');
if (!is_string($name) or (trim($name) === '')) {
ZM\Warning('Refusing to save storage area with an empty Name');
$error_message .= 'Storage area Name is required
';
$changes = array();
} else if (!is_string($path) or (trim($path) === '')) {
ZM\Warning('Refusing to save storage area with an empty Path');
$error_message .= 'Storage area Path is required
';
$changes = array();
} else {
$changes = $storage->changes($_REQUEST['newStorage']);
}
}
if (count($changes)) {
if ($storage->save($changes)) {
ZM\AuditAction(($_REQUEST['id'] ? 'update' : 'create'), 'storage', $storage->Id(), 'Changed: '.implode(', ', array_keys($changes)));
} else {
$error_message .= $storage->get_last_error();
} // end if successful save
}
// there is no view=storage, so need to redirect somewhere useful
$redirect = '?view=options&tab=storage';
$refreshParent = true;
} else {
ZM\Error("Unknown action $action in saving Storage");
}
?>