mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-06-30 15:55:48 +00:00
Properly set CACHEDIR.TAG from http://www.brynosaurus.com/cachedir/
This commit is contained in:
@@ -33,7 +33,7 @@ class BackupPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||
$sZipHash = \MailSo\Base\Utils::Sha1Rand();
|
||||
$sZipFileName = APP_PRIVATE_DATA . $sZipHash . '.zip';
|
||||
|
||||
\touch(APP_PRIVATE_DATA.'cache/CACHEDIR.TAG');
|
||||
\file_put_contents(APP_PRIVATE_DATA.'cache/CACHEDIR.TAG', 'Signature: 8a477f597d28d172789f06886806bc55');
|
||||
|
||||
if (\class_exists('ZipArchive')) {
|
||||
// $oZip = new \ZipArchive();
|
||||
|
||||
@@ -25,6 +25,11 @@ class File implements \MailSo\Cache\DriverInterface
|
||||
function __construct(string $sCacheFolder, string $sKeyPrefix = '')
|
||||
{
|
||||
$this->sCacheFolder = \rtrim(\trim($sCacheFolder), '\\/').'/';
|
||||
|
||||
// http://www.brynosaurus.com/cachedir/
|
||||
$tag = $this->sCacheFolder . 'CACHEDIR.TAG';
|
||||
\is_file($tag) || \file_put_contents($tag, 'Signature: 8a477f597d28d172789f06886806bc55');
|
||||
|
||||
if (!empty($sKeyPrefix)) {
|
||||
$sKeyPrefix = \str_pad(\preg_replace('/[^a-zA-Z0-9_]/', '_',
|
||||
\rtrim(\trim($sKeyPrefix), '\\/')), 5, '_');
|
||||
|
||||
@@ -172,7 +172,10 @@ abstract class Upgrade
|
||||
// $tar_destination = APP_DATA_FOLDER_PATH . APP_VERSION . '.tar';
|
||||
$tar_destination = APP_DATA_FOLDER_PATH . 'backup-' . \date('YmdHis') . '.tar';
|
||||
$tar = new \PharData($tar_destination);
|
||||
$files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(APP_DATA_FOLDER_PATH . '_data_'), \RecursiveIteratorIterator::SELF_FIRST);
|
||||
$files = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(APP_DATA_FOLDER_PATH . '_data_'),
|
||||
\RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
$l = \strlen(APP_DATA_FOLDER_PATH);
|
||||
foreach ($files as $file) {
|
||||
$file = \str_replace('\\', '/', $file);
|
||||
|
||||
Reference in New Issue
Block a user