update debug dump structure

This commit is contained in:
ghost 2023-09-16 17:00:12 +03:00
parent b298ded53f
commit da55154a2a

View File

@ -315,12 +315,9 @@ if (API_EXPORT_PUSH_ENABLED)
// Manifest exists
if (empty($node->manifest))
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest URL not provided for this node: %s'),
$debug['dump']['warning'][] = sprintf(
_('Manifest URL not provided: %s'),
$node
)
);
continue;
@ -331,16 +328,12 @@ if (API_EXPORT_PUSH_ENABLED)
if (!Valid::url($node->manifest, $error))
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest URL "%s" invalid: %s'),
$node->manifest,
$debug['dump'][$node->manifest]['warning'][] = sprintf(
_('Manifest URL invalid: %s'),
print_r(
$error,
true
)
)
);
continue;
@ -367,13 +360,10 @@ if (API_EXPORT_PUSH_ENABLED)
if (200 != $code = $curl->getCode())
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest URL "%s" unreachable with code: "%s"'),
$debug['dump'][$node->manifest]['warning'][] = sprintf(
_('Manifest URL "%s" unreachable with code: "%s"'),
$node->manifest,
$code
)
);
continue;
@ -381,12 +371,9 @@ if (API_EXPORT_PUSH_ENABLED)
if (!$manifest = $curl->getResponse())
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest URL "%s" has broken response'),
$debug['dump'][$node->manifest]['warning'][] = sprintf(
_('Manifest URL "%s" has broken response'),
$node->manifest
)
);
continue;
@ -395,12 +382,9 @@ if (API_EXPORT_PUSH_ENABLED)
// API channel not exists
if (empty($manifest->import))
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest import URL not provided for this node: %s'),
$debug['dump'][$node->manifest]['warning'][] = sprintf(
_('Manifest import URL not provided: %s'),
$node
)
);
continue;
@ -409,12 +393,9 @@ if (API_EXPORT_PUSH_ENABLED)
// Push API channel not exists
if (empty($manifest->import->push))
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest import push URL not provided for this node: %s'),
$debug['dump'][$manifest->import->push]['warning'][] = sprintf(
_('Manifest import push URL not provided: %s'),
$node
)
);
continue;
@ -425,16 +406,12 @@ if (API_EXPORT_PUSH_ENABLED)
if (!Valid::url($manifest->import->push, $error))
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest import push URL "%s" invalid: %s'),
$manifest->import->push,
$debug['dump'][$manifest->import->push]['warning'][] = sprintf(
_('Manifest import push URL invalid: %s'),
print_r(
$error,
true
)
)
);
continue;
@ -464,44 +441,26 @@ if (API_EXPORT_PUSH_ENABLED)
if (200 != $code = $curl->getCode())
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Could not send manifest push to URL "%s" unreachable with code: "%s"'),
$manifest->import->push,
$debug['dump'][$manifest->import->push]['warning'][] = sprintf(
_('Server returned code "%s"'),
$code
)
);
continue;
}
if (!$manifest = $curl->getResponse())
if (!$response = $curl->getResponse())
{
array_push(
$debug['dump'],
sprintf(
_('[warning] Manifest push URL "%s" has broken response on sending data: %s'),
$manifest->import->push,
$request
)
);
$debug['dump'][$manifest->import->push]['warning'][] = _('Could not receive server response');
continue;
}
array_push(
$debug['dump'],
sprintf(
_('[notice] Data successfully sent to manifest push URL "%s": %s'),
$manifest->import->push,
$request
)
);
$debug['dump'][$manifest->import->push]['response'] = json_decode($response, true);
}
// Drop processed item from queue
unset($memoryApiExportPush[$id]);
//unset($memoryApiExportPush[$id]);
}
// Update memory pool