1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
updatecommand.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Main\Cli\Command\Update;
4
5
use Symfony\Component\Console\Command\Command;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use Symfony\Component\Console\Style\SymfonyStyle;
9
use Bitrix\Main\Cli\Command\Update\Service\UpdaterService;
10
11
abstract
class
UpdateCommand
extends
Command
12
{
13
protected
UpdaterService
$updater
;
14
protected
SymfonyStyle
$io
;
15
16
protected
function
execute
(InputInterface $input, OutputInterface
$output
): int
17
{
18
$this->updater =
new
UpdaterService
();
19
$this->io =
new
SymfonyStyle($input,
$output
);
20
21
$result
= $this->updater->listUpdates();
22
23
if
(!
$result
->isSuccess())
24
{
25
$this->io->error((
string
)
$result
->getError());
26
return
self::FAILURE;
27
}
28
29
$updateList =
$result
->getData();
30
31
if
(isset($updateList[
'REPAIR'
]))
32
{
33
if
(!$this->
repair
($updateList[
'REPAIR'
]))
34
{
35
return
self::FAILURE;
36
}
37
}
38
39
if
(isset($updateList[
'CLIENT'
]))
40
{
41
$this->
showClientInfo
($updateList[
'CLIENT'
]);
42
}
43
44
if
(isset($updateList[
'UPDATE_SYSTEM'
]))
45
{
46
return
$this->
upgradeUpdateSystem
() ? self::SUCCESS : self::FAILURE;
47
}
48
49
if
(!$this->
executeCommand
($updateList, $input))
50
{
51
return
self::FAILURE;
52
}
53
54
return
self::SUCCESS;
55
}
56
57
protected
function
repair
(
array
$repair): bool
58
{
59
$result
= $this->updater->repair($repair[0][
'@'
][
'TYPE'
]);
60
if
(!
$result
->isSuccess())
61
{
62
$this->io->error((
string
)
$result
->getError());
63
return
false
;
64
}
65
return
true
;
66
}
67
68
protected
function
showClientInfo
(
array
$client): void
69
{
70
$this->io->title(
'Client information'
);
71
$this->io->writeln(
'Name: '
. ($client[0][
'@'
][
'NAME'
] ??
'n/a'
));
72
$this->io->writeln(
'Product: '
. ($client[0][
"@"
][
'LICENSE'
] ??
'n/a'
));
73
}
74
75
protected
function
upgradeUpdateSystem
(): bool
76
{
77
$this->io->info(
'Upgrade of the Update System is required.'
);
78
79
if
($this->io->confirm(
'Upgrade the Update System?'
))
80
{
81
$result
= $this->updater->updateUpdateSystem();
82
if
(
$result
->isSuccess())
83
{
84
$this->io->success(
'Update System upgraded successfully. Restart the command.'
);
85
return
true
;
86
}
87
$this->io->error((
string
)
$result
->getError());
88
}
89
return
false
;
90
}
91
92
abstract
protected
function
executeCommand
(
array
$updateList, InputInterface $input): bool;
93
}
Bitrix\Main\Cli\Command\Update\Service\UpdaterService
Определения
updaterservice.php:11
Bitrix\Main\Cli\Command\Update\UpdateCommand
Определения
updatecommand.php:12
Bitrix\Main\Cli\Command\Update\UpdateCommand\showClientInfo
showClientInfo(array $client)
Определения
updatecommand.php:68
Bitrix\Main\Cli\Command\Update\UpdateCommand\$io
SymfonyStyle $io
Определения
updatecommand.php:14
Bitrix\Main\Cli\Command\Update\UpdateCommand\repair
repair(array $repair)
Определения
updatecommand.php:57
Bitrix\Main\Cli\Command\Update\UpdateCommand\$updater
UpdaterService $updater
Определения
updatecommand.php:13
Bitrix\Main\Cli\Command\Update\UpdateCommand\execute
execute(InputInterface $input, OutputInterface $output)
Определения
updatecommand.php:16
Bitrix\Main\Cli\Command\Update\UpdateCommand\executeCommand
executeCommand(array $updateList, InputInterface $input)
Bitrix\Main\Cli\Command\Update\UpdateCommand\upgradeUpdateSystem
upgradeUpdateSystem()
Определения
updatecommand.php:75
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$result
$result
Определения
get_property_values.php:14
$output
$output
Определения
options.php:436
bitrix
modules
main
lib
cli
command
update
updatecommand.php
Создано системой
1.14.0