Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
filetableinstaller.php
1
<?php
2
namespace
Bitrix\Sender\Install
;
3
4
use
Bitrix\Sender\Access\Role\RoleTable
;
5
use
Bitrix\Sender\Access\Role\RoleUtil
;
6
use
Bitrix\Sender\Access\Service\RolePermissionService
;
7
use
Bitrix\Sender\Entity\Letter
;
8
use
Bitrix\Sender\FileTable
;
9
use
Bitrix\Sender\Integration\Sender\Mail\MessageMail
;
10
use
Bitrix\Sender\TemplateTable
;
11
12
class
FileTableInstaller
13
{
18
public
static
function
installAgent
(
int
$offset = 0)
19
{
20
return
self::fillFileTableFromTemplates
($offset);
21
}
22
26
public
static
function
fillFileTableFromTemplates
(
int
$offset = 0):string
27
{
28
if
($offset === 0)
29
{
30
$templates =
TemplateTable::getList
([
31
'select'
=> [
32
'ID'
,
33
'CONTENT'
34
]
35
]);
36
37
while
($template = $templates->fetch())
38
{
39
FileTable::syncFiles
(
40
$template[
'ID'
],
41
FileTable::TYPES
[
'TEMPLATE'
],
42
$template[
'CONTENT'
],
43
false
44
);
45
}
46
}
47
48
$letters =
Letter::getList
([
49
'select'
=> [
50
'ID'
,
51
],
52
'filter'
=> [
53
'=MESSAGE_CODE'
=>
MessageMail::CODE
54
],
55
'offset'
=> $offset,
56
'limit'
=> 100,
57
'order'
=> [
58
'ID'
=>
'ASC'
59
]
60
]);
61
$counter = 0;
62
63
while
($letter = $letters->fetch())
64
{
65
$letter =
Letter::createInstanceById
($letter[
'ID'
]);
66
FileTable::syncFiles
(
67
$letter->getId(),
68
FileTable::TYPES
[
'LETTER'
],
69
$letter->getMessage()->getConfiguration()->get(
'MESSAGE'
),
70
false
71
);
72
$counter++;
73
}
74
$offset += $counter;
75
76
if
($counter < 100)
77
{
78
\COption::SetOptionInt(
'sender'
,
'sender_file_load_completed'
, 1);
79
return
''
;
80
}
81
82
return
'\\Bitrix\\Sender\\Install\\FileTableInstaller::installAgent('
.$offset.
');'
;
83
}
84
}
Bitrix\Main\FileTable
Definition
file.php:45
Bitrix\Main\ORM\Data\DataManager\getList
static getList(array $parameters=array())
Definition
datamanager.php:441
Bitrix\Sender\Access\Role\RoleTable
Definition
role.php:31
Bitrix\Sender\Access\Role\RoleUtil
Definition
roleutil.php:20
Bitrix\Sender\Access\Service\RolePermissionService
Definition
rolepermissionservice.php:20
Bitrix\Sender\Entity\Letter
Definition
letter.php:34
Bitrix\Sender\Entity\Letter\getList
static getList(array $parameters=array())
Definition
letter.php:89
Bitrix\Sender\Entity\Letter\createInstanceById
static createInstanceById($id=null, array $messageCodes=[])
Definition
letter.php:196
Bitrix\Sender\FileTable\syncFiles
static syncFiles(int $entityId, int $entityType, string $template, bool $deleteFiles=true, bool $onDeleteEntity=false)
Definition
filetable.php:72
Bitrix\Sender\FileTable\TYPES
const TYPES
Definition
filetable.php:25
Bitrix\Sender\Install\FileTableInstaller
Definition
filetableinstaller.php:13
Bitrix\Sender\Install\FileTableInstaller\fillFileTableFromTemplates
static fillFileTableFromTemplates(int $offset=0)
Definition
filetableinstaller.php:26
Bitrix\Sender\Install\FileTableInstaller\installAgent
static installAgent(int $offset=0)
Definition
filetableinstaller.php:18
Bitrix\Sender\Integration\Sender\Mail\MessageMail
Definition
messagemail.php:39
Bitrix\Sender\Integration\Sender\Mail\MessageMail\CODE
const CODE
Definition
messagemail.php:40
Bitrix\Sender\TemplateTable
Definition
template.php:37
Bitrix\Sender\Install
Definition
filetableinstaller.php:2
modules
sender
lib
install
filetableinstaller.php
Создано системой
1.10.0