- Модуль: mail
- Путь к файлу: ~/bitrix/modules/mail/lib/helper/attachment/storage.php
- Класс: BitrixMailHelperAttachmentStorage
- Вызов: Storage::getStorage
static function getStorage()
{
static $storage;
if (!is_null($storage))
{
return $storage;
}
$storage = false;
if (!MainLoader::includeModule('disk'))
{
return $storage;
}
$storageId = MainConfigOption::get('mail', 'disk_attachment_storage_id', 0);
if ($storageId > 0)
{
$storage = BitrixDiskStorage::loadById($storageId);
if (!$storage || $storage->getModuleId() != 'mail')
{
$storage = false;
}
}
if (!$storage)
{
$driver = BitrixDiskDriver::getInstance();
$storage = $driver->addStorageIfNotExist(array(
'NAME' => Loc::getMessage('MAIL_ATTACHMENT_STORAGE_NAME'),
'USE_INTERNAL_RIGHTS' => false,
'MODULE_ID' => 'mail',
'ENTITY_TYPE' => MailDiskProxyTypeMail::className(),
'ENTITY_ID' => 'mail',
));
if ($storage)
{
MainConfigOption::set('mail', 'disk_attachment_storage_id', $storage->getId());
}
else
{
$storage = false;
}
}
return $storage;
}