some fixes for new safe-upgrade

Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
Andy Miller
2025-11-14 14:42:39 +00:00
parent a65eeed4dc
commit dfc1875129
4 changed files with 20 additions and 16 deletions

View File

@@ -1204,12 +1204,8 @@ class SafeUpgradeManager
$report['psr_log_conflicts'] = $this->detectPsrLogConflictsLocal(); $report['psr_log_conflicts'] = $this->detectPsrLogConflictsLocal();
$report['monolog_conflicts'] = $this->detectMonologConflictsLocal(); $report['monolog_conflicts'] = $this->detectMonologConflictsLocal();
if ($report['plugins_pending']) { if ($report['plugins_pending'] && $report['is_major_minor_upgrade']) {
if ($report['is_major_minor_upgrade']) { $report['blocking'][] = 'Pending plugin/theme updates detected. Because this is a major Grav upgrade, update them before continuing.';
$report['blocking'][] = 'Plugin and theme updates must be applied before upgrading Grav.';
} else {
$report['warnings'][] = 'Pending plugin/theme updates detected; updating before upgrading Grav is recommended.';
}
} }
if ($report['psr_log_conflicts']) { if ($report['psr_log_conflicts']) {

View File

@@ -513,8 +513,9 @@ PLUGIN_ADMIN:
SAFE_UPGRADE_WARNINGS_MONOLOG_ITEM: "Potential Monolog conflict:" SAFE_UPGRADE_WARNINGS_MONOLOG_ITEM: "Potential Monolog conflict:"
SAFE_UPGRADE_WARNINGS_MONOLOG_UNKNOWN: "Review the plugin for potential API changes." SAFE_UPGRADE_WARNINGS_MONOLOG_UNKNOWN: "Review the plugin for potential API changes."
SAFE_UPGRADE_PENDING_UPDATES: "Pending plugin or theme updates" SAFE_UPGRADE_PENDING_UPDATES: "Pending plugin or theme updates"
SAFE_UPGRADE_PENDING_INTRO: "Review the extensions that should be updated first." SAFE_UPGRADE_PENDING_INTRO: "Because this is a major Grav upgrade, update these extensions first to ensure maximum compatibility."
SAFE_UPGRADE_PENDING_HINT: "Update all plugins and themes before proceeding." SAFE_UPGRADE_PENDING_MINOR_DESC: "These updates are optional for this release; apply them at your convenience."
SAFE_UPGRADE_PENDING_HINT: "Because this is a major upgrade, update all plugins and themes before continuing to ensure maximum compatibility."
SAFE_UPGRADE_UNKNOWN_VERSION: "unknown" SAFE_UPGRADE_UNKNOWN_VERSION: "unknown"
SAFE_UPGRADE_REQUIREMENTS_FAIL: "PHP %s or newer is required before continuing." SAFE_UPGRADE_REQUIREMENTS_FAIL: "PHP %s or newer is required before continuing."
SAFE_UPGRADE_DISABLED: "Safe upgrade is disabled. Enable it in Configuration ▶ System ▶ Updates." SAFE_UPGRADE_DISABLED: "Safe upgrade is disabled. Enable it in Configuration ▶ System ▶ Updates."

View File

@@ -225,6 +225,8 @@ export default class SafeUpgrade {
const pending = (data.preflight && data.preflight.plugins_pending) || {}; const pending = (data.preflight && data.preflight.plugins_pending) || {};
const psrConflicts = (data.preflight && data.preflight.psr_log_conflicts) || {}; const psrConflicts = (data.preflight && data.preflight.psr_log_conflicts) || {};
const monologConflicts = (data.preflight && data.preflight.monolog_conflicts) || {}; const monologConflicts = (data.preflight && data.preflight.monolog_conflicts) || {};
const isMajorUpgrade = !!(data.preflight && data.preflight.is_major_minor_upgrade);
const hasPendingUpdates = Object.keys(pending).length > 0;
if (data.status === 'error') { if (data.status === 'error') {
blockers.push(data.message || t('SAFE_UPGRADE_GENERIC_ERROR', 'Safe upgrade could not complete. See Grav logs for details.')); blockers.push(data.message || t('SAFE_UPGRADE_GENERIC_ERROR', 'Safe upgrade could not complete. See Grav logs for details.'));
@@ -251,8 +253,8 @@ export default class SafeUpgrade {
blockers.push(t('SAFE_UPGRADE_NOT_AVAILABLE', 'No Grav update is available.')); blockers.push(t('SAFE_UPGRADE_NOT_AVAILABLE', 'No Grav update is available.'));
} }
if (Object.keys(pending).length) { if (hasPendingUpdates && isMajorUpgrade) {
blockers.push(t('SAFE_UPGRADE_PENDING_HINT', 'Update all plugins and themes before proceeding.')); blockers.push(t('SAFE_UPGRADE_PENDING_HINT', 'Because this is a major upgrade, update all plugins and themes before continuing to ensure maximum compatibility.'));
} }
const psrWarningItems = Object.keys(psrConflicts).map((slug) => { const psrWarningItems = Object.keys(psrConflicts).map((slug) => {
@@ -303,14 +305,17 @@ export default class SafeUpgrade {
</section> </section>
` : ''; ` : '';
const pendingList = Object.keys(pending).length ? ` const pendingList = hasPendingUpdates ? `
<section class="safe-upgrade-panel safe-upgrade-panel--info safe-upgrade-pending"> <section class="safe-upgrade-panel safe-upgrade-panel--info safe-upgrade-pending">
<header class="safe-upgrade-panel__header"> <header class="safe-upgrade-panel__header">
<div class="safe-upgrade-panel__title-wrap"> <div class="safe-upgrade-panel__title-wrap">
<span class="safe-upgrade-panel__icon fa fa-sync" aria-hidden="true"></span> <span class="safe-upgrade-panel__icon fa fa-sync" aria-hidden="true"></span>
<div> <div>
<strong class="safe-upgrade-panel__title">${t('SAFE_UPGRADE_PENDING_UPDATES', 'Pending plugin or theme updates')}</strong> <strong class="safe-upgrade-panel__title">${t('SAFE_UPGRADE_PENDING_UPDATES', 'Pending plugin or theme updates')}</strong>
<span class="safe-upgrade-panel__subtitle">${t('SAFE_UPGRADE_PENDING_INTRO', 'Review the extensions that should be updated first.')}</span> <span class="safe-upgrade-panel__subtitle">${isMajorUpgrade
? t('SAFE_UPGRADE_PENDING_INTRO', 'Because this is a major Grav upgrade, update these extensions first to ensure maximum compatibility.')
: t('SAFE_UPGRADE_PENDING_MINOR_DESC', 'These updates are optional for this release; apply them at your convenience.')
}</span>
</div> </div>
</div> </div>
</header> </header>

View File

@@ -2433,6 +2433,8 @@ var SafeUpgrade = /*#__PURE__*/function () {
var packageSize = version.package_size ? formatBytes(version.package_size) : t('SAFE_UPGRADE_UNKNOWN_SIZE', 'unknown'); var packageSize = version.package_size ? formatBytes(version.package_size) : t('SAFE_UPGRADE_UNKNOWN_SIZE', 'unknown');
var warnings = data.preflight && data.preflight.warnings || []; var warnings = data.preflight && data.preflight.warnings || [];
var pending = data.preflight && data.preflight.plugins_pending || {}; var pending = data.preflight && data.preflight.plugins_pending || {};
var isMajorUpgrade = !!(data.preflight && data.preflight.is_major_minor_upgrade);
var hasPendingUpdates = Object.keys(pending).length > 0;
var psrConflicts = data.preflight && data.preflight.psr_log_conflicts || {}; var psrConflicts = data.preflight && data.preflight.psr_log_conflicts || {};
var monologConflicts = data.preflight && data.preflight.monolog_conflicts || {}; var monologConflicts = data.preflight && data.preflight.monolog_conflicts || {};
if (data.status === 'error') { if (data.status === 'error') {
@@ -2454,8 +2456,8 @@ var SafeUpgrade = /*#__PURE__*/function () {
if (!data.upgrade_available) { if (!data.upgrade_available) {
blockers.push(t('SAFE_UPGRADE_NOT_AVAILABLE', 'No Grav update is available.')); blockers.push(t('SAFE_UPGRADE_NOT_AVAILABLE', 'No Grav update is available.'));
} }
if (Object.keys(pending).length) { if (hasPendingUpdates && isMajorUpgrade) {
blockers.push(t('SAFE_UPGRADE_PENDING_HINT', 'Update all plugins and themes before proceeding.')); blockers.push(t('SAFE_UPGRADE_PENDING_HINT', 'Because this is a major upgrade, update all plugins and themes before continuing to ensure maximum compatibility.'));
} }
var psrWarningItems = Object.keys(psrConflicts).map(function (slug) { var psrWarningItems = Object.keys(psrConflicts).map(function (slug) {
var info = psrConflicts[slug] || {}; var info = psrConflicts[slug] || {};
@@ -2481,7 +2483,7 @@ var SafeUpgrade = /*#__PURE__*/function () {
var warningsList = filteredWarnings.length || psrWarningItems.length || monologWarningItems.length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--alert safe-upgrade-alert\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-exclamation-triangle\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">".concat(t('SAFE_UPGRADE_WARNINGS', 'Warnings'), "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">").concat(t('SAFE_UPGRADE_WARNINGS_HINT', 'These items may require attention before continuing.'), "</span>\n </div>\n </div>\n </header>\n <div class=\"safe-upgrade-panel__body\">\n <ul>\n ").concat(filteredWarnings.map(function (warning) { var warningsList = filteredWarnings.length || psrWarningItems.length || monologWarningItems.length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--alert safe-upgrade-alert\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-exclamation-triangle\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">".concat(t('SAFE_UPGRADE_WARNINGS', 'Warnings'), "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">").concat(t('SAFE_UPGRADE_WARNINGS_HINT', 'These items may require attention before continuing.'), "</span>\n </div>\n </div>\n </header>\n <div class=\"safe-upgrade-panel__body\">\n <ul>\n ").concat(filteredWarnings.map(function (warning) {
return "<li>".concat(warning, "</li>"); return "<li>".concat(warning, "</li>");
}).join(''), "\n ").concat(psrWarningItems.join(''), "\n ").concat(monologWarningItems.join(''), "\n </ul>\n </div>\n </section>\n ") : ''; }).join(''), "\n ").concat(psrWarningItems.join(''), "\n ").concat(monologWarningItems.join(''), "\n </ul>\n </div>\n </section>\n ") : '';
var pendingList = Object.keys(pending).length ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--info safe-upgrade-pending\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-sync\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">".concat(t('SAFE_UPGRADE_PENDING_UPDATES', 'Pending plugin or theme updates'), "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">").concat(t('SAFE_UPGRADE_PENDING_INTRO', 'Review the extensions that should be updated first.'), "</span>\n </div>\n </div>\n </header>\n <div class=\"safe-upgrade-panel__body\">\n <ul>\n ").concat(Object.keys(pending).map(function (slug) { var pendingList = hasPendingUpdates ? "\n <section class=\"safe-upgrade-panel safe-upgrade-panel--info safe-upgrade-pending\">\n <header class=\"safe-upgrade-panel__header\">\n <div class=\"safe-upgrade-panel__title-wrap\">\n <span class=\"safe-upgrade-panel__icon fa fa-sync\" aria-hidden=\"true\"></span>\n <div>\n <strong class=\"safe-upgrade-panel__title\">".concat(t('SAFE_UPGRADE_PENDING_UPDATES', 'Pending plugin or theme updates'), "</strong>\n <span class=\"safe-upgrade-panel__subtitle\">").concat(isMajorUpgrade ? t('SAFE_UPGRADE_PENDING_INTRO', 'Because this is a major Grav upgrade, update these extensions first to ensure maximum compatibility.') : t('SAFE_UPGRADE_PENDING_MINOR_DESC', 'These updates are optional for this release; apply them at your convenience.'), "</span>\n </div>\n </div>\n </header>\n <div class=\"safe-upgrade-panel__body\">\n <ul>\n ").concat(Object.keys(pending).map(function (slug) {
var item = pending[slug] || {}; var item = pending[slug] || {};
var type = item.type || 'plugin'; var type = item.type || 'plugin';
var current = item.current || t('SAFE_UPGRADE_UNKNOWN_VERSION', 'unknown'); var current = item.current || t('SAFE_UPGRADE_UNKNOWN_VERSION', 'unknown');