mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-09 08:17:53 +08:00
FileStorage add ROOT option
This commit is contained in:
parent
bf276510ba
commit
aa69772127
4 changed files with 15 additions and 3 deletions
|
@ -255,6 +255,14 @@ class Actions
|
|||
if ('sqlite' === $sDsnType) {
|
||||
$sUser = $sPassword = '';
|
||||
$sDsn = 'sqlite:' . APP_PRIVATE_DATA . 'AddressBook.sqlite';
|
||||
/*
|
||||
// TODO: use local db?
|
||||
$homedir = $this->StorageProvider()->GenerateFilePath(
|
||||
$oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::ROOT
|
||||
);
|
||||
$sDsn = 'sqlite:' . $homedir . '/AddressBook.sqlite';
|
||||
*/
|
||||
} else {
|
||||
$sDsn = $sDsnType . ':' . \preg_replace('/^[a-z]+:/', '', $sDsn);
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ trait Pgp
|
|||
return null;
|
||||
}
|
||||
|
||||
$homedir = \dirname($this->StorageProvider()->GenerateFilePath(
|
||||
$homedir = $this->StorageProvider()->GenerateFilePath(
|
||||
$oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::PGP
|
||||
)) . '/.gnupg';
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::ROOT
|
||||
) . '/.gnupg';
|
||||
|
||||
if (!\is_dir($homedir)) {
|
||||
\mkdir($homedir, 0700, true);
|
||||
|
|
|
@ -10,4 +10,5 @@ class StorageType
|
|||
const SIGN_ME = 4;
|
||||
const SESSION = 5;
|
||||
const PGP = 6;
|
||||
const ROOT = 7;
|
||||
}
|
||||
|
|
|
@ -112,6 +112,8 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
|||
$sSubFolder = '.sessions';
|
||||
} else if (StorageType::PGP === $iStorageType) {
|
||||
$sSubFolder = '.pgp';
|
||||
} else if (StorageType::ROOT === $iStorageType) {
|
||||
$sSubFolder = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,6 +127,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
|||
case StorageType::SESSION:
|
||||
case StorageType::CONFIG:
|
||||
case StorageType::PGP:
|
||||
case StorageType::ROOT:
|
||||
if (empty($sEmail)) {
|
||||
return '';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue