mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-25 10:09:20 +03:00
New logic for storage provider (breaking changes)
This commit is contained in:
parent
44566aad4b
commit
51666d7c7e
19 changed files with 453 additions and 297 deletions
|
|
@ -5,6 +5,7 @@ namespace RainLoop\Providers\Settings;
|
|||
class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface
|
||||
{
|
||||
const FILE_NAME = 'settings';
|
||||
const FILE_NAME_LOCAL = 'settings_local';
|
||||
|
||||
/**
|
||||
* @var \RainLoop\Providers\Storage
|
||||
|
|
@ -28,7 +29,10 @@ class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface
|
|||
{
|
||||
$sValue = $this->oStorageProvider->Get($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME);
|
||||
$this->oStorageProvider->IsLocal() ?
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME_LOCAL :
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME
|
||||
);
|
||||
|
||||
$aSettings = array();
|
||||
if (\is_string($sValue))
|
||||
|
|
@ -53,19 +57,23 @@ class DefaultSettings implements \RainLoop\Providers\Settings\SettingsInterface
|
|||
{
|
||||
return $this->oStorageProvider->Put($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME,
|
||||
$this->oStorageProvider->IsLocal() ?
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME_LOCAL :
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME,
|
||||
\json_encode($aSettings));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEmail
|
||||
* @param \RainLoop\Model\Account $oAccount
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ClearByEmail($sEmail)
|
||||
public function Delete($oAccount)
|
||||
{
|
||||
return $this->oStorageProvider->Clear($sEmail,
|
||||
return $this->oStorageProvider->Clear($oAccount,
|
||||
\RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG,
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME);
|
||||
$this->oStorageProvider->IsLocal() ?
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME_LOCAL :
|
||||
\RainLoop\Providers\Settings\DefaultSettings::FILE_NAME);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,9 +20,9 @@ interface SettingsInterface
|
|||
public function Save($oAccount, array $aSettings);
|
||||
|
||||
/**
|
||||
* @param string $sEmail
|
||||
* @param \RainLoop\Model\Account $oAccount
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function ClearByEmail($sEmail);
|
||||
public function Delete($oAccount);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue