mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Updated demo plugin for upcoming v2.12
This commit is contained in:
parent
221136ce1c
commit
f50d848b35
3 changed files with 14 additions and 10 deletions
|
|
@ -9,7 +9,7 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage
|
|||
/**
|
||||
* @param \RainLoop\Model\Account|string|null $mAccount
|
||||
*/
|
||||
protected function generateFileName($mAccount, int $iStorageType, string $sKey, bool $bMkDir = false, bool $bForDeleteAction = false) : string
|
||||
public function GenerateFilePath($mAccount, int $iStorageType, bool $bMkDir = false, bool $bForDeleteAction = false) : string
|
||||
{
|
||||
$sEmail = '';
|
||||
if ($mAccount instanceof \RainLoop\Model\MainAccount) {
|
||||
|
|
@ -18,7 +18,7 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage
|
|||
$sEmail = $mAccount;
|
||||
}
|
||||
if ($sEmail != $this->sDemoEmail) {
|
||||
return parent::generateFileName($mAccount, $iStorageType, $sKey, $bMkDir, $bForDeleteAction);
|
||||
return parent::GenerateFilePath($mAccount, $iStorageType, $bMkDir, $bForDeleteAction);
|
||||
}
|
||||
|
||||
$sDataPath = "{$this->sDataPath}/demo";
|
||||
|
|
@ -36,9 +36,16 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage
|
|||
$sDataPath .= '/.sign_me';
|
||||
} else if (StorageType::SESSION === $iStorageType) {
|
||||
$sDataPath .= '/.sessions';
|
||||
} else if (StorageType::PGP === $iStorageType) {
|
||||
$sDataPath = '/.pgp';
|
||||
}
|
||||
|
||||
return $sDataPath . '/' . ($sKey ? \RainLoop\Utils::fixName($sKey) : '');
|
||||
if ($bMkDir && !\is_dir($sDataPath) && !\mkdir($sDataPath, 0700, true))
|
||||
{
|
||||
throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sDataPath.'"');
|
||||
}
|
||||
|
||||
return $sDataPath . '/';
|
||||
}
|
||||
|
||||
private $sDemoEmail;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue