mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-12-05 15:29:58 +01:00
some fixes for new safe-upgrade
Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
@@ -1204,12 +1204,8 @@ class SafeUpgradeManager
|
||||
$report['psr_log_conflicts'] = $this->detectPsrLogConflictsLocal();
|
||||
$report['monolog_conflicts'] = $this->detectMonologConflictsLocal();
|
||||
|
||||
if ($report['plugins_pending']) {
|
||||
if ($report['is_major_minor_upgrade']) {
|
||||
$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['plugins_pending'] && $report['is_major_minor_upgrade']) {
|
||||
$report['blocking'][] = 'Pending plugin/theme updates detected. Because this is a major Grav upgrade, update them before continuing.';
|
||||
}
|
||||
|
||||
if ($report['psr_log_conflicts']) {
|
||||
|
||||
@@ -513,8 +513,9 @@ PLUGIN_ADMIN:
|
||||
SAFE_UPGRADE_WARNINGS_MONOLOG_ITEM: "Potential Monolog conflict:"
|
||||
SAFE_UPGRADE_WARNINGS_MONOLOG_UNKNOWN: "Review the plugin for potential API changes."
|
||||
SAFE_UPGRADE_PENDING_UPDATES: "Pending plugin or theme updates"
|
||||
SAFE_UPGRADE_PENDING_INTRO: "Review the extensions that should be updated first."
|
||||
SAFE_UPGRADE_PENDING_HINT: "Update all plugins and themes before proceeding."
|
||||
SAFE_UPGRADE_PENDING_INTRO: "Because this is a major Grav upgrade, update these extensions first to ensure maximum compatibility."
|
||||
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_REQUIREMENTS_FAIL: "PHP %s or newer is required before continuing."
|
||||
SAFE_UPGRADE_DISABLED: "Safe upgrade is disabled. Enable it in Configuration ▶ System ▶ Updates."
|
||||
|
||||
@@ -225,6 +225,8 @@ export default class SafeUpgrade {
|
||||
const pending = (data.preflight && data.preflight.plugins_pending) || {};
|
||||
const psrConflicts = (data.preflight && data.preflight.psr_log_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') {
|
||||
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.'));
|
||||
}
|
||||
|
||||
if (Object.keys(pending).length) {
|
||||
blockers.push(t('SAFE_UPGRADE_PENDING_HINT', 'Update all plugins and themes before proceeding.'));
|
||||
if (hasPendingUpdates && isMajorUpgrade) {
|
||||
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) => {
|
||||
@@ -303,14 +305,17 @@ export default class SafeUpgrade {
|
||||
</section>
|
||||
` : '';
|
||||
|
||||
const pendingList = Object.keys(pending).length ? `
|
||||
const pendingList = hasPendingUpdates ? `
|
||||
<section class="safe-upgrade-panel safe-upgrade-panel--info safe-upgrade-pending">
|
||||
<header class="safe-upgrade-panel__header">
|
||||
<div class="safe-upgrade-panel__title-wrap">
|
||||
<span class="safe-upgrade-panel__icon fa fa-sync" aria-hidden="true"></span>
|
||||
<div>
|
||||
<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>
|
||||
</header>
|
||||
|
||||
10
themes/grav/js/admin.min.js
vendored
10
themes/grav/js/admin.min.js
vendored
@@ -2431,8 +2431,10 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
var version = data.version || {};
|
||||
var releaseDate = version.release_date || '';
|
||||
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 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 monologConflicts = data.preflight && data.preflight.monolog_conflicts || {};
|
||||
if (data.status === 'error') {
|
||||
@@ -2454,8 +2456,8 @@ var SafeUpgrade = /*#__PURE__*/function () {
|
||||
if (!data.upgrade_available) {
|
||||
blockers.push(t('SAFE_UPGRADE_NOT_AVAILABLE', 'No Grav update is available.'));
|
||||
}
|
||||
if (Object.keys(pending).length) {
|
||||
blockers.push(t('SAFE_UPGRADE_PENDING_HINT', 'Update all plugins and themes before proceeding.'));
|
||||
if (hasPendingUpdates && isMajorUpgrade) {
|
||||
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 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) {
|
||||
return "<li>".concat(warning, "</li>");
|
||||
}).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 type = item.type || 'plugin';
|
||||
var current = item.current || t('SAFE_UPGRADE_UNKNOWN_VERSION', 'unknown');
|
||||
|
||||
Reference in New Issue
Block a user