mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Properly set CACHEDIR.TAG from http://www.brynosaurus.com/cachedir/
This commit is contained in:
parent
9fbe7e8d13
commit
927c4e6ed1
3 changed files with 10 additions and 2 deletions
|
|
@ -33,7 +33,7 @@ class BackupPlugin extends \RainLoop\Plugins\AbstractPlugin
|
||||||
$sZipHash = \MailSo\Base\Utils::Sha1Rand();
|
$sZipHash = \MailSo\Base\Utils::Sha1Rand();
|
||||||
$sZipFileName = APP_PRIVATE_DATA . $sZipHash . '.zip';
|
$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')) {
|
if (\class_exists('ZipArchive')) {
|
||||||
// $oZip = new \ZipArchive();
|
// $oZip = new \ZipArchive();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,11 @@ class File implements \MailSo\Cache\DriverInterface
|
||||||
function __construct(string $sCacheFolder, string $sKeyPrefix = '')
|
function __construct(string $sCacheFolder, string $sKeyPrefix = '')
|
||||||
{
|
{
|
||||||
$this->sCacheFolder = \rtrim(\trim($sCacheFolder), '\\/').'/';
|
$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)) {
|
if (!empty($sKeyPrefix)) {
|
||||||
$sKeyPrefix = \str_pad(\preg_replace('/[^a-zA-Z0-9_]/', '_',
|
$sKeyPrefix = \str_pad(\preg_replace('/[^a-zA-Z0-9_]/', '_',
|
||||||
\rtrim(\trim($sKeyPrefix), '\\/')), 5, '_');
|
\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 . APP_VERSION . '.tar';
|
||||||
$tar_destination = APP_DATA_FOLDER_PATH . 'backup-' . \date('YmdHis') . '.tar';
|
$tar_destination = APP_DATA_FOLDER_PATH . 'backup-' . \date('YmdHis') . '.tar';
|
||||||
$tar = new \PharData($tar_destination);
|
$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);
|
$l = \strlen(APP_DATA_FOLDER_PATH);
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$file = \str_replace('\\', '/', $file);
|
$file = \str_replace('\\', '/', $file);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue