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