mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-27 01:28:56 +08:00
Example for #1449
This commit is contained in:
parent
cfc497556e
commit
58d3fc8fd5
2 changed files with 28 additions and 0 deletions
|
@ -328,6 +328,12 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
|
|||
$this->Config()->Get('plugin', 'ignoreSystemAddressbook', true)
|
||||
);
|
||||
}
|
||||
/*
|
||||
if ('storage' === $sName || 'storage-local' === $sName) {
|
||||
require_once __DIR__ . '/storage.php';
|
||||
$oDriver = new \NextcloudStorage(APP_PRIVATE_DATA.'storage', $sName === 'storage-local');
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
22
plugins/nextcloud/storage.php
Normal file
22
plugins/nextcloud/storage.php
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
use RainLoop\Providers\Storage\Enumerations\StorageType;
|
||||
|
||||
class NextcloudStorage extends \RainLoop\Providers\Storage\FileStorage
|
||||
{
|
||||
/**
|
||||
* @param \RainLoop\Model\Account|string|null $mAccount
|
||||
*/
|
||||
public function GenerateFilePath($mAccount, int $iStorageType, bool $bMkDir = false) : string
|
||||
{
|
||||
$sDataPath = parent::GenerateFilePath($mAccount, $iStorageType, $bMkDir);
|
||||
if (StorageType::CONFIG === $iStorageType) {
|
||||
$sUID = \OC::$server->getUserSession()->getUser()->getUID();
|
||||
$sDataPath .= "/.config/{$sUID}/";
|
||||
if ($bMkDir && !\is_dir($sDataPath) && !\mkdir($sDataPath, 0700, true)) {
|
||||
throw new \RainLoop\Exceptions\Exception('Can\'t make storage directory "'.$sDataPath.'"');
|
||||
}
|
||||
}
|
||||
return $sDataPath;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue