Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
domainua.php
1
<?php
2
namespace
Bitrix\Landing\Update\Block
;
3
4
use
Bitrix\Landing\Internals\BlockTable
;
5
use
Bitrix\Main\Config\Option
;
6
use
Bitrix\Main\Localization\Loc
;
7
use
Bitrix\Main\Update\Stepper
;
8
9
Loc::loadMessages
(__FILE__);
10
11
class
DomainUa
extends
Stepper
12
{
13
protected
static
$moduleId
=
'landing'
;
14
20
public
function
execute
(array &$result)
21
{
22
$lastId = Option::get(
'landing'
,
'update_block_domainua'
, 0);
23
24
if
(!isset($result[
'steps'
]))
25
{
26
$result[
'steps'
] = 0;
27
}
28
29
$finished =
true
;
30
31
// gets common quantity
32
$res = BlockTable::getList(array(
33
'select'
=> array(
34
new
\
Bitrix
\Main\
Entity
\
ExpressionField
(
35
'CNT'
,
'COUNT(*)'
36
)
37
),
38
'filter'
=> [
39
'CONTENT'
=>
'%cdn.bitrix24.ua%'
,
40
]
41
));
42
if
($row = $res->fetch())
43
{
44
$result[
'count'
] = $row[
'CNT'
];
45
}
46
47
// gets group for update
48
$res = BlockTable::getList(array(
49
'select'
=> array(
50
'ID'
,
'CONTENT'
51
),
52
'filter'
=> array(
53
'>ID'
=> $lastId,
54
'CONTENT'
=>
'%cdn.bitrix24.ua%'
,
55
),
56
'order'
=> array(
57
'ID'
=>
'ASC'
58
),
59
'limit'
=> 10
60
));
61
while
($row = $res->fetch())
62
{
63
$lastId = $row[
'ID'
];
64
$result[
'steps'
]++;
65
66
BlockTable::update($row[
'ID'
], [
67
'CONTENT'
=> str_replace(
68
'cdn.bitrix24.ua'
,
69
'cdn.bitrix24.eu'
,
70
$row[
'CONTENT'
]
71
)
72
]);
73
74
$finished =
false
;
75
}
76
77
// add files from blocks
78
if
(!$finished)
79
{
80
Option::set(
'landing'
,
'update_block_domainua'
, $lastId);
81
return
true
;
82
}
83
else
84
{
85
Option::delete(
'landing'
, array(
'name'
=>
'update_block_domainua'
));
86
return
false
;
87
}
88
}
89
}
Bitrix\Landing\Internals\BlockTable
Definition
block.php:26
Bitrix\Landing\Update\Block\DomainUa
Definition
domainua.php:12
Bitrix\Landing\Update\Block\DomainUa\execute
execute(array &$result)
Definition
domainua.php:20
Bitrix\Landing\Update\Block\DomainUa\$moduleId
static $moduleId
Definition
domainua.php:13
Bitrix\Main\Config\Option
Definition
option.php:15
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Fields\ExpressionField
Definition
expressionfield.php:25
Bitrix\Main\Update\Stepper
Definition
stepper.php:27
Bitrix\Landing\Update\Block
Definition
buttons.php:3
Bitrix
modules
landing
lib
update
block
domainua.php
Создано системой
1.10.0