mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 17:14:46 +00:00
Nextcloud password: allow to set a separeate pw and allow no encryption (#2545)
This commit is contained in:
parent
fdc52df6d5
commit
15534011f0
@ -74,6 +74,13 @@ class Nextcloud extends Base implements IBackupProvider
|
||||
"help" => gettext("The app password which has been generated for you"),
|
||||
"value" => null
|
||||
),
|
||||
array(
|
||||
"name" => "password_encryption",
|
||||
"type" => "password",
|
||||
"label" => gettext("Encryption Password (Optional)"),
|
||||
"help" => gettext("A password to encrypt your configuration"),
|
||||
"value" => null
|
||||
),
|
||||
array(
|
||||
"name" => "backupdir",
|
||||
"type" => "text",
|
||||
@ -128,13 +135,16 @@ class Nextcloud extends Base implements IBackupProvider
|
||||
$username = (string)$nextcloud->user;
|
||||
$password = (string)$nextcloud->password;
|
||||
$backupdir = (string)$nextcloud->backupdir;
|
||||
$crypto_password = (string)$nextcloud->password_encryption;
|
||||
$hostname = $config->system->hostname . '.' .$config->system->domain;
|
||||
$configname = 'config-' . $hostname . '-' . date("Y-m-d_H:i:s") . '.xml';
|
||||
// backup source data to local strings (plain/encrypted)
|
||||
$confdata = file_get_contents('/conf/config.xml');
|
||||
$confdata_enc = chunk_split(
|
||||
$this->encrypt($confdata, (string)$nextcloud->password)
|
||||
);
|
||||
if (!empty($crypto_password)) {
|
||||
$confdata = chunk_split(
|
||||
$this->encrypt($confdata, $crypto_password)
|
||||
);
|
||||
}
|
||||
try {
|
||||
$directories = $this->listFiles($url, $username, $password, '/');
|
||||
if (!in_array("/$backupdir/", $directories)) {
|
||||
@ -146,7 +156,7 @@ class Nextcloud extends Base implements IBackupProvider
|
||||
$password,
|
||||
$backupdir,
|
||||
$configname,
|
||||
$confdata_enc
|
||||
$confdata
|
||||
);
|
||||
// do not list directories
|
||||
return array_filter(
|
||||
|
||||
@ -41,6 +41,9 @@
|
||||
</check001>
|
||||
</Constraints>
|
||||
</password>
|
||||
<password_encryption type="TextField">
|
||||
<Required>N</Required>
|
||||
</password_encryption>
|
||||
<backupdir type="TextField">
|
||||
<Required>Y</Required>
|
||||
<mask>/[a-z0-9\-]+/i</mask>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user