mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Backup plugin don't use tar stream yet (was a test)
This commit is contained in:
parent
f1c6ff3f2a
commit
1d652e0ce3
1 changed files with 7 additions and 4 deletions
|
|
@ -6,8 +6,8 @@ class BackupPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
NAME = 'Backup',
|
NAME = 'Backup',
|
||||||
AUTHOR = 'SnappyMail',
|
AUTHOR = 'SnappyMail',
|
||||||
URL = 'https://snappymail.eu/',
|
URL = 'https://snappymail.eu/',
|
||||||
VERSION = '1.0',
|
VERSION = '1.1',
|
||||||
RELEASE = '2023-12-10',
|
RELEASE = '2023-12-12',
|
||||||
REQUIRED = '2.30.0',
|
REQUIRED = '2.30.0',
|
||||||
CATEGORY = 'General',
|
CATEGORY = 'General',
|
||||||
LICENSE = 'MIT',
|
LICENSE = 'MIT',
|
||||||
|
|
@ -34,7 +34,8 @@ class BackupPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
|
|
||||||
$sFileName = APP_PRIVATE_DATA . \MailSo\Base\Utils::Sha1Rand();
|
$sFileName = APP_PRIVATE_DATA . \MailSo\Base\Utils::Sha1Rand();
|
||||||
|
|
||||||
if (false) {
|
if (true) {
|
||||||
|
$sType = 'application/zip';
|
||||||
$sFileName .= '.zip';
|
$sFileName .= '.zip';
|
||||||
if (\class_exists('ZipArchive')) {
|
if (\class_exists('ZipArchive')) {
|
||||||
// $oArchive = new \ZipArchive();
|
// $oArchive = new \ZipArchive();
|
||||||
|
|
@ -43,6 +44,7 @@ class BackupPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
}
|
}
|
||||||
$oArchive = new \SnappyMail\Stream\ZIP($sFileName);
|
$oArchive = new \SnappyMail\Stream\ZIP($sFileName);
|
||||||
} else {
|
} else {
|
||||||
|
$sType = 'application/x-gzip';
|
||||||
$sFileName .= '.tgz';
|
$sFileName .= '.tgz';
|
||||||
$oArchive = new \SnappyMail\Stream\TAR($sFileName);
|
$oArchive = new \SnappyMail\Stream\TAR($sFileName);
|
||||||
}
|
}
|
||||||
|
|
@ -62,7 +64,8 @@ class BackupPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
\unlink($sFileName);
|
\unlink($sFileName);
|
||||||
|
|
||||||
return $this->jsonResponse(__FUNCTION__, array(
|
return $this->jsonResponse(__FUNCTION__, array(
|
||||||
'zip' => $data
|
'name' => \basename($sFileName),
|
||||||
|
'data' => "data:{$sType};base64,{$data}"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue