false, 'error' => 'Your session expired. Reload the page and try again.')); exit; } if ($action === 'check_start') { $latest = znote_update_latest(true); $result = znote_update_check_start($latest); } elseif ($action === 'check_step') { $result = znote_update_check_step(); } elseif ($action === 'install_start') { $latest = znote_update_latest(true); $result = znote_update_install_start($latest); } else { $result = znote_update_install_step(); } if (in_array($action, array('check_start', 'check_step'), true) && ($result['phase'] ?? '') === 'done') { acp_log('update.check', (string)($result['manifest']['version'] ?? ''), array('passed' => $result['ok'])); } if (($result['phase'] ?? '') === 'done' && $action === 'install_step') { acp_log('update.install', (string)$result['version'], array('backup' => $result['backup'])); } elseif (empty($result['ok']) && $action === 'install_step') { acp_log('update.install_failed', '', array('error' => $result['error'] ?? '')); } echo json_encode($result); exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && $action === 'rollback') { $result = znote_update_rollback_latest(); if ($result['ok']) { acp_log('update.rollback', (string)$result['version']); acp_flash_success('ZnoteX core files were restored to version ' . h($result['version']) . '. Additive database migrations were kept.'); } else { acp_log('update.rollback_failed', '', array('error' => $result['error'])); acp_flash_error(h($result['error'])); } acp_redirect('update'); } if ($_SERVER['REQUEST_METHOD'] === 'POST' && in_array($action, array('check', 'install'), true)) { @set_time_limit(0); @ini_set('max_execution_time', '0'); $latest = znote_update_latest(true); $preflight = znote_update_preflight($latest); acp_log('update.check', (string)($latest['manifest']['version'] ?? ''), array('passed' => $preflight['ok'])); if ($action === 'install') { if (!$preflight['ok']) { acp_flash_error('The update was not started because at least one check failed.'); } else { $result = znote_update_install($latest); if ($result['ok']) { acp_log('update.install', (string)$result['version'], array('backup' => $result['backup'])); acp_flash_success('ZnoteX was updated successfully to version ' . h($result['version']) . '.'); acp_redirect('update'); } else { acp_log('update.install_failed', (string)($latest['manifest']['version'] ?? ''), array('error' => $result['error'])); acp_flash_error(h($result['error'])); } } } } if ($latest === null) { $latest = znote_update_latest(false); } $manifest = !empty($latest['ok']) ? $latest['manifest'] : array(); $backups = znote_update_backups(); $textValue = static function ($value): string { if (is_string($value)) { return $value; } if (!is_array($value)) { return ''; } $language = strtolower((string)($GLOBALS['config']['language'] ?? 'en')); return (string)($value[$language] ?? $value[substr($language, 0, 2)] ?? $value['en'] ?? reset($value)); }; ?>
= nl2br(h($textValue($manifest['description'] ?? ($manifest['summary'] ?? '')))) ?>
This installation already uses the latest stable release.
0% - Starting...
| Status | Check | Result |
|---|---|---|
| = h($check['label']) ?> | = h($check['detail']) ?> |
0% - Starting...
No update backup is available yet.
Latest backup: = h((string)$backups[0]['journal']['version']) ?> from = h((string)$backups[0]['journal']['created_at']) ?>.