16 private static $entityList = [
17 self::REST_APPLICATION => 100,
20 private static $accessManifest = [
27 return static::$entityList;
51 !static::$entityList[
$code]
58 if (static::checkRequiredParams(
$code))
60 $step =
$event->getParameter(
'STEP');
61 $setting =
$event->getParameter(
'SETTING');
64 case 'REST_APPLICATION':
65 $result = static::exportApp($step, $setting);
80 if (!static::checkAccessImport(
$event))
86 if (static::checkRequiredParams(
$code))
91 case 'REST_APPLICATION':
100 private static function checkAccessImport(
Event $event)
104 !isset(static::$entityList[
$code])
105 || !static::$entityList[
$code]
120 private static function checkRequiredParams(
$type)
126 private static function importApp($item)
129 if (!empty($item[
'CONTENT'][
'DATA'][
'code']))
131 $code = preg_replace(
'/[^a-zA-Z0-9._\-]/',
'', $item[
'CONTENT'][
'DATA'][
'code']);
132 if (
$code !== $item[
'CONTENT'][
'DATA'][
'code'])
135 'ERROR_EXCEPTION' => [
136 'message' => Loc::getMessage(
137 'REST_CONFIGURATION_ERROR_UNKNOWN_APP'
143 Application::setContextUserId((
int)$item[
'USER_ID']);
147 $res = AppTable::getList(
153 '!=URL_INSTALL' =>
false,
160 $res = EventTable::getList(
163 "APP_ID" =>
$app[
'ID'],
164 "EVENT_NAME" =>
"ONAPPINSTALL",
165 "EVENT_HANDLER" =>
$app[
"URL_INSTALL"],
172 $res = EventTable::add(
174 "APP_ID" =>
$app[
'ID'],
175 "EVENT_NAME" =>
"ONAPPINSTALL",
176 "EVENT_HANDLER" =>
$app[
"URL_INSTALL"],
179 if (
$res->isSuccess())
181 Sender::bind(
'rest',
'OnRestAppInstall');
201 $result[
'ERROR_EXCEPTION'][
'message'] = Loc::getMessage(
202 'REST_CONFIGURATION_ERROR_INSTALL_APP_CONTENT_DATA',
204 '#ERROR_CODE#' =>
$result[
'error'],
205 '#ERROR_MESSAGE#' =>
$result[
'errorDescription'],
211 $result[
'ERROR_EXCEPTION'][
'message'] = Loc::getMessage(
212 'REST_CONFIGURATION_ERROR_INSTALL_APP_CONTENT'
219 'ERROR_EXCEPTION' => [
220 'message' => Loc::getMessage(
221 'REST_CONFIGURATION_ERROR_UNKNOWN_APP'
230 private static function clearApp(
$option)
237 $dbRes = AppTable::getList(
251 while ($appInfo =
$dbRes->Fetch())
253 $result[
'NEXT'] = $appInfo[
'ID'];
255 $currentApp = Helper::getInstance()->getContextAction($appInfo[
'ID']);
256 if (!empty(
$option[
'CONTEXT']) &&
$option[
'CONTEXT'] === $currentApp)
261 $checkResult = AppTable::checkUninstallAvailability($appInfo[
'ID']);
262 if ($checkResult->isEmpty())
269 AppTable::update($appInfo[
'ID'], $appFields);
291 if (is_array($setting))
293 if (!empty($setting[
'APP_REQUIRED']) && is_array($setting[
'APP_REQUIRED']))
300 '=ID' => $setting[
'APP_REQUIRED'],
305 elseif (array_key_exists(
'APP_USES_REQUIRED', $setting))
308 if (!empty($setting[
'APP_USES_REQUIRED']))
311 '=ID' => $setting[
'APP_USES_REQUIRED'],
319 $res = AppTable::getList(
336 $return[
'FILE_NAME'] = $step;
337 $return[
'NEXT'] = $step;
338 $return[
'CONTENT'] = [
339 'code' =>
$app[
'CODE'],
if( $daysToExpire >=0 &&$daysToExpire< 60 elseif)( $daysToExpire< 0)