Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
fixfontweight.php
1
<?php
2
3
namespace
Bitrix\Landing\Update\Assets
;
4
5
use
Bitrix\Landing\Internals\HookDataTable
;
6
use
Bitrix\Main\Update\Stepper
;
7
8
final
class
FixFontWeight
extends
Stepper
9
{
10
protected
const
FONT_PARAMS
=
':wght@300;400;500;600;700;900'
;
11
protected
const
FONT_NEW_PARAMS
=
':wght@100;200;300;400;500;600;700;800;900'
;
12
protected
const
STEP_PORTION
= 10;
13
protected
const
CONTINUE_EXECUTING
=
true
;
14
protected
const
STOP_EXECUTING
=
false
;
15
21
public
function
execute
(array &$result): bool
22
{
23
$res = HookDataTable::getList(
24
[
25
'select'
=> [
26
'ID'
,
'VALUE'
27
],
28
'filter'
=> [
29
'HOOK'
=>
'FONTS'
,
30
],
31
]
32
);
33
34
if
(!$result[
'checkedRows'
])
35
{
36
$result[
'checkedRows'
] = 0;
37
}
38
39
$countFixedRows = 0;
40
$countRows = 0;
41
while
($row = $res->fetch())
42
{
43
if
($countRows > $result[
'checkedRows'
])
44
{
45
$result[
'checkedRows'
]++;
46
$search =
self::FONT_PARAMS
;
47
$replace =
self::FONT_NEW_PARAMS
;
48
$value = str_replace($search, $replace, $row[
'VALUE'
]);
49
HookDataTable::update(
50
$row[
'ID'
],
51
[
'VALUE'
=> $value]
52
);
53
$countFixedRows++;
54
if
($countFixedRows === self::STEP_PORTION)
55
{
56
$result[
'checkedRows'
] = $countRows;
57
return
self::CONTINUE_EXECUTING
;
58
}
59
}
60
$countRows++;
61
}
62
63
return
self::STOP_EXECUTING
;
64
}
65
}
Bitrix\Landing\Internals\HookDataTable
Definition
hookdata.php:26
Bitrix\Landing\Update\Assets\FixFontWeight
Definition
fixfontweight.php:9
Bitrix\Landing\Update\Assets\FixFontWeight\STEP_PORTION
const STEP_PORTION
Definition
fixfontweight.php:12
Bitrix\Landing\Update\Assets\FixFontWeight\CONTINUE_EXECUTING
const CONTINUE_EXECUTING
Definition
fixfontweight.php:13
Bitrix\Landing\Update\Assets\FixFontWeight\execute
execute(array &$result)
Definition
fixfontweight.php:21
Bitrix\Landing\Update\Assets\FixFontWeight\FONT_PARAMS
const FONT_PARAMS
Definition
fixfontweight.php:10
Bitrix\Landing\Update\Assets\FixFontWeight\STOP_EXECUTING
const STOP_EXECUTING
Definition
fixfontweight.php:14
Bitrix\Landing\Update\Assets\FixFontWeight\FONT_NEW_PARAMS
const FONT_NEW_PARAMS
Definition
fixfontweight.php:11
Bitrix\Main\Update\Stepper
Definition
stepper.php:27
Bitrix\Landing\Update\Assets
Definition
fixfontweight.php:3
modules
landing
lib
update
assets
fixfontweight.php
Создано системой
1.10.0