mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-01 21:49:21 +03:00
ckeditor fixes
demo-plugin TemproryApcStorage
This commit is contained in:
parent
000711086a
commit
844afadd6f
40 changed files with 2371 additions and 197 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Storage;
|
||||
|
||||
class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
||||
class FileStorage implements \RainLoop\Providers\Storage\IStorage
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
|
|
@ -14,6 +14,11 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
*/
|
||||
private $bLocal;
|
||||
|
||||
/**
|
||||
* @var \MailSo\Log\Logger
|
||||
*/
|
||||
protected $oLogger;
|
||||
|
||||
/**
|
||||
* @param string $sStoragePath
|
||||
* @param bool $bLocal = false
|
||||
|
|
@ -24,6 +29,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
{
|
||||
$this->sDataPath = \rtrim(\trim($sStoragePath), '\\/');
|
||||
$this->bLocal = !!$bLocal;
|
||||
$this->oLogger = null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -122,7 +128,7 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
private function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
|
||||
public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
|
||||
{
|
||||
if (null === $mAccount)
|
||||
{
|
||||
|
|
@ -186,4 +192,12 @@ class DefaultStorage implements \RainLoop\Providers\Storage\StorageInterface
|
|||
|
||||
return $sFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \MailSo\Log\Logger $oLogger
|
||||
*/
|
||||
public function SetLogger($oLogger)
|
||||
{
|
||||
$this->oLogger = $oLogger instanceof \MailSo\Log\Logger ? $oLogger : null;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
namespace RainLoop\Providers\Storage;
|
||||
|
||||
interface StorageInterface
|
||||
interface IStorage
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|null $oAccount
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
<?php
|
||||
|
||||
namespace RainLoop\Providers\Storage;
|
||||
|
||||
class TemproryApcStorage extends \RainLoop\Providers\Storage\FileStorage
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string|null $oAccount
|
||||
* @param int $iStorageType
|
||||
* @param string $sKey
|
||||
* @param string $sValue
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function Put($oAccount, $iStorageType, $sKey, $sValue)
|
||||
{
|
||||
return !!@\apc_store($this->generateFileName($oAccount, $iStorageType, $sKey, true), $sValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string|null $oAccount
|
||||
* @param int $iStorageType
|
||||
* @param string $sKey
|
||||
* @param mixed $mDefault = false
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function Get($oAccount, $iStorageType, $sKey, $mDefault = false)
|
||||
{
|
||||
$bValue = false;
|
||||
$mValue = @\apc_fetch($this->generateFileName($oAccount, $iStorageType, $sKey), $bValue);
|
||||
if (!$bValue)
|
||||
{
|
||||
$mValue = $mDefault;
|
||||
}
|
||||
|
||||
return $mValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string|null $oAccount
|
||||
* @param int $iStorageType
|
||||
* @param string $sKey
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function Clear($oAccount, $iStorageType, $sKey)
|
||||
{
|
||||
@\apc_delete($this->generateFileName($oAccount, $iStorageType, $sKey));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string $oAccount
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function DeleteStorage($oAccount)
|
||||
{
|
||||
return !!$oAccount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string|null $mAccount
|
||||
* @param int $iStorageType
|
||||
* @param string $sKey
|
||||
* @param bool $bMkDir = false
|
||||
* @param bool $bForDeleteAction = false
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateFileName($mAccount, $iStorageType, $sKey, $bMkDir = false, $bForDeleteAction = false)
|
||||
{
|
||||
$sFileName = parent::generateFileName($mAccount, $iStorageType, $sKey, false, false);
|
||||
return $sFileName.'/'.\RainLoop\Utils::GetConnectionToken().'/';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue