Put a garbage collector in demo plugin

This commit is contained in:
djmaze 2021-11-08 17:52:40 +01:00
parent 5ba3d2edcd
commit e4e86d0347
2 changed files with 10 additions and 5 deletions

View file

@ -11,9 +11,14 @@ class DemoStorage extends \RainLoop\Providers\Storage\FileStorage
return parent::generateFileName($mAccount, $iStorageType, $sKey, $bMkDir, $bForDeleteAction);
}
return $this->sDataPath
.'/demo'
.'/'.static::fixName(\RainLoop\Utils::GetConnectionToken())
.'/'.($sKey ? static::fixName($sKey) : '');
$sDataPath = "{$this->sDataPath}/demo";
if (\is_dir($sDataPath) && 0 === \random_int(0, 100)) {
\MailSo\Base\Utils::RecRmDir("{$this->sDataPath}/demo");
}
$sDataPath .= '/' . static::fixName(\RainLoop\Utils::GetConnectionToken());
\is_dir($sDataPath) || \mkdir($sDataPath, 0700, true);
return $sDataPath . '/' . ($sKey ? static::fixName($sKey) : '');
}
}

View file

@ -9,7 +9,7 @@ class FileStorage implements \RainLoop\Providers\Storage\IStorage
/**
* @var string
*/
private $sDataPath;
protected $sDataPath;
/**
* @var bool