1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
actionmodifyer.php
См. документацию.
1
<?
2
namespace
Bitrix\Scale;
3
4
use \Bitrix\Main\Localization\Loc;
5
Loc::loadMessages(__FILE__);
6
11
class
ActionModifyer
12
{
22
public
static
function
mysqlAddSlave
($actionId,
$actionParams
, $hostname, $userParamsValues)
23
{
24
$action
=
new
Action
(
"MYSQL_ADD_SLAVE_MODIFYER"
,
array
(
25
"START_COMMAND_TEMPLATE"
=>
"sudo -u root /opt/webdir/bin/bx-mysql -a options -o json"
,
26
"LOG_LEVEL"
=>
Logger::LOG_LEVEL_DISABLE
27
),
28
""
,
29
array
()
30
);
31
32
$action
->start();
33
$actRes =
$action
->getResult();
34
35
$needModeInfo =
false
;
36
37
if
(isset($actRes[
"MYSQL_ADD_SLAVE_MODIFYER"
][
"OUTPUT"
][
"DATA"
][
"params"
][
"options"
])
38
&& is_array($actRes[
"MYSQL_ADD_SLAVE_MODIFYER"
][
"OUTPUT"
][
"DATA"
][
"params"
][
"options"
])
39
)
40
{
41
foreach
($actRes[
"MYSQL_ADD_SLAVE_MODIFYER"
][
"OUTPUT"
][
"DATA"
][
"params"
][
"options"
] as
$option
)
42
{
43
if
(
$option
==
"cluster_password"
||
$option
==
"replica_password"
)
44
{
45
$actionParams
[
"START_COMMAND_TEMPLATE"
] .=
" --"
.$option.
"="
.
\Bitrix\Scale\Helper::generatePass
();
46
}
47
elseif
(
$option
==
"mysql_password"
)
48
{
49
$actionParams
[
"START_COMMAND_TEMPLATE"
] .=
" --"
.$option.
"=##USER_PARAMS:MYSQL_PASS##"
;
50
51
if
(!isset(
$actionParams
[
"USER_PARAMS"
]))
52
$actionParams
[
"USER_PARAMS"
] =
array
();
53
54
$actionParams
[
"USER_PARAMS"
][
"MYSQL_PASS"
] =
array
(
55
"NAME"
=> Loc::getMessage(
"SCALE_AM_MYAR_MYSQL_PASS"
),
56
"TYPE"
=>
"PASSWORD"
,
57
"REQUIRED"
=>
"Y"
,
58
"VERIFY_TWICE"
=>
"Y"
59
);
60
61
$needModeInfo =
true
;
62
}
63
}
64
65
if
($needModeInfo)
66
throw
new
NeedMoreUserInfoException
(
"Need more user's info"
,
$actionParams
);
67
}
68
69
return
$actionParams
;
70
}
71
81
public
static
function
checkExtraDbExist
($actionId,
$actionParams
, $hostname, $userParamsValues)
82
{
83
if
($actionId ==
"MYSQL_ADD_SLAVE"
|| $actionId ==
"MYSQL_CHANGE_MASTER"
)
84
$hostname =
ServersData::getDbMasterHostname
();
85
86
if
(Helper::isExtraDbExist($hostname))
87
{
88
$actionParams
[
"CHECK_EXTRA_DB_USER_ASK"
] =
"Y"
;
89
throw
new
NeedMoreUserInfoException
(
"Need more user's info"
,
$actionParams
);
90
}
91
92
return
$actionParams
;
93
}
94
103
public
static
function
emailSettingsModifier
($actionId,
$actionParams
, $hostname, $userParamsValues)
104
{
105
if
($actionId !=
'SET_EMAIL_SETTINGS'
)
106
return
$actionParams
;
107
108
if
($userParamsValues[
'USE_AUTH'
] ==
'Y'
)
109
$pattern
=
'/(--8<--AUTH_BEGIN----|----AUTH_END--8<--)/'
;
110
else
111
$pattern
=
'/--8<--AUTH_BEGIN----.*----AUTH_END--8<--/'
;
112
113
$actionParams
[
'START_COMMAND_TEMPLATE'
] = preg_replace(
$pattern
,
''
,
$actionParams
[
'START_COMMAND_TEMPLATE'
]);
114
return
$actionParams
;
115
}
116
125
public
static
function
siteCreateLinkModifier
($actionId,
$actionParams
, $hostname, $userParamsValues)
126
{
127
if
($actionId !=
'SITE_CREATE_LINK'
)
128
return
$actionParams
;
129
130
if
(empty($userParamsValues[
'KERNEL_SITE'
]))
131
return
$actionParams
;
132
133
$siteId
= $userParamsValues[
'KERNEL_SITE'
];
134
$sites
=
SitesData::getList
();
135
136
if
(empty(
$sites
[
$siteId
]))
137
return
$actionParams
;
138
139
$actionParams
[
'START_COMMAND_TEMPLATE'
] = str_replace(
140
'##MODIFYER:KERNEL_ROOT##'
,
141
$sites
[
$siteId
][
'DocumentRoot'
],
142
$actionParams
[
'START_COMMAND_TEMPLATE'
]
143
);
144
145
return
$actionParams
;
146
}
147
}
Bitrix\Scale\Action
Определения
action.php:13
Bitrix\Scale\ActionModifyer
Определения
actionmodifyer.php:12
Bitrix\Scale\ActionModifyer\checkExtraDbExist
static checkExtraDbExist($actionId, $actionParams, $hostname, $userParamsValues)
Определения
actionmodifyer.php:81
Bitrix\Scale\ActionModifyer\mysqlAddSlave
static mysqlAddSlave($actionId, $actionParams, $hostname, $userParamsValues)
Определения
actionmodifyer.php:22
Bitrix\Scale\ActionModifyer\siteCreateLinkModifier
static siteCreateLinkModifier($actionId, $actionParams, $hostname, $userParamsValues)
Определения
actionmodifyer.php:125
Bitrix\Scale\ActionModifyer\emailSettingsModifier
static emailSettingsModifier($actionId, $actionParams, $hostname, $userParamsValues)
Определения
actionmodifyer.php:103
Bitrix\Scale\Helper\generatePass
static generatePass($length=20)
Определения
helper.php:148
Bitrix\Scale\Logger\LOG_LEVEL_DISABLE
const LOG_LEVEL_DISABLE
Определения
logger.php:14
Bitrix\Scale\NeedMoreUserInfoException
Определения
exceptions.php:31
Bitrix\Scale\ServersData\getDbMasterHostname
static getDbMasterHostname()
Определения
serversdata.php:214
Bitrix\Scale\SitesData\getList
static getList($dbName=false)
Определения
sitesdata.php:72
$sites
$sites
Определения
clear_component_cache.php:15
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$actionParams
$actionParams
Определения
csv_new_setup.php:230
$siteId
$siteId
Определения
ajax.php:8
elseif
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)
Определения
prolog_main_admin.php:393
$option
$option
Определения
options.php:1711
$pattern
if(!Loader::includeModule('sale')) $pattern
Определения
index.php:20
$action
$action
Определения
file_dialog.php:21
bitrix
modules
scale
lib
actionmodifyer.php
Создано системой
1.14.0