Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public function getConfigurationFields()
"type" => "text",
"label" => gettext("Directory Name without leading slash, starting from user's root"),
"value" => 'OPNsense-Backup'
),
array(
"name" => "addhostname",
"type" => "checkbox",
"label" => gettext("Backup to directory named after hostname"),
"help" => gettext("Create subdirectory under backupdir for this host"),
"value" => null
)
);
$nextcloud = new NextcloudSettings();
Expand Down Expand Up @@ -138,6 +145,11 @@ public function backup()
$password = (string)$nextcloud->password;
$backupdir = (string)$nextcloud->backupdir;
$crypto_password = (string)$nextcloud->password_encryption;
$add_hostname = (string)$nextcloud->addhostname;

if ($add_hostname) {
$backupdir .= "/".gethostname()."/"
}

// Check if destination directory exists, create (full path) if not
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@
<Default>OPNsense-Backup</Default>
<ValidationMessage>The Backup Directory can only consist of alphanumeric characters, dash, underscores and slash. No leading or trailing slash.</ValidationMessage>
</backupdir>
<addhostname type="BooleanField">
<Default>0</Default>
<Required>Y</Required>
</addhostname>
</items>
</model>