mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 15:33:23 +01:00
* EPL S3: fix not working upload of backups
This commit is contained in:
parent
94670fcf83
commit
9844a78b34
@ -1239,18 +1239,30 @@ class Backup
|
||||
* Move uploaded file to backup-directory
|
||||
*
|
||||
* @param array $file values for keys "tmp_name", "name", "size"
|
||||
* @return ?string success message or null on error
|
||||
* @return string success or error message
|
||||
*/
|
||||
public function upload(array $file) : ?string
|
||||
public function upload(array $file) : string
|
||||
{
|
||||
if (move_uploaded_file($file['tmp_name'], $filename = $this->backup_dir . '/' . basename($file['name'])))
|
||||
if (is_uploaded_file($file['tmp_name']) && ($src=fopen($file['tmp_name'], 'r')) &&
|
||||
($dst=fopen($filename = $this->backup_dir . '/' . basename($file['name']), 'w')) &&
|
||||
stream_copy_to_stream($src, $dst) !== false && fclose($dst))
|
||||
{
|
||||
$msg = lang("succesfully uploaded file %1", $filename . ', ' .
|
||||
sprintf('%3.1f MB (%d)', $file['size'] / (1024 * 1024), $file['size'])) .
|
||||
', md5=' . md5_file($file['tmp_name']) . ', sha1=' . sha1_file($file['tmp_name']);
|
||||
$this->log($filename, $msg);
|
||||
}
|
||||
return $msg ?? null;
|
||||
else
|
||||
{
|
||||
$msg = lang('Error uploading your backup!');
|
||||
}
|
||||
|
||||
if (isset($src))
|
||||
{
|
||||
fclose($src);
|
||||
}
|
||||
$this->log($filename, $msg);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -324,6 +324,7 @@ error in group-creation !!! setup de Fehler beim Anlegen der Gruppen !!!
|
||||
error listing "dn=%1"! setup de Fehler beim Auflisten von "DN=%1"!
|
||||
error modifying dn=%1: %2='%3'! setup de Fehler beim Ändern von DN=%1: %2='%3'!
|
||||
error searching "dn=%1" for "%2"! setup de Fehler beim Suchen von "DN=%1" nach "%2"!
|
||||
error uploading your backup! setup de Fehler beim Hochladen Ihres Backups!
|
||||
every setup de Alle
|
||||
export has been completed! setup de Export ist abgeschlossen!
|
||||
failed to mount backup directory! setup de Konnte Datensicherungsverzeichnis nicht mounten!
|
||||
|
@ -324,6 +324,7 @@ error in group-creation !!! setup en Error in group creation!
|
||||
error listing "dn=%1"! setup en Error listing "DN=%1"!
|
||||
error modifying dn=%1: %2='%3'! setup en Error modifying DN=%1: %2='%3'!
|
||||
error searching "dn=%1" for "%2"! setup en Error searching "DN=%1" for "%2"!
|
||||
error uploading your backup! setup en Error uploading your backup!
|
||||
every setup en Every
|
||||
export has been completed! setup en Export has been completed!
|
||||
failed to mount backup directory! setup en Failed to mount Backup directory!
|
||||
|
Loading…
Reference in New Issue
Block a user