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