fix: pre-update backup fires on Joomla Update (match layout=update)
Universal: Pre-Release / Build Pre-Release (${{ inputs.stability || github.ref_name }}) (push) Successful in 15s

The 'Install the update' button posts to
option=com_joomlaupdate&layout=update (Joomla's confirm/updating page),
carrying only layout=update -- no view, no task. The redirect matched
view=update / update.install, so it never fired on the Joomla Update page.

Match layout=update (plus view=update and legacy update.install), and
return the browser to the same layout flagged is_backed_up=1.

Claude-Session: https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i
This commit is contained in:
2026-07-12 15:24:11 -05:00
parent 3587a05630
commit 5e362fe925
2 changed files with 16 additions and 8 deletions
@@ -253,15 +253,18 @@ final class MokoSuiteBackup extends CMSPlugin implements SubscriberInterface
return;
}
$app = $this->getApplication();
$input = $app->getInput();
$view = $input->getCmd('view', '');
$task = $input->getCmd('task', '');
$app = $this->getApplication();
$input = $app->getInput();
$view = $input->getCmd('view', '');
$task = $input->getCmd('task', '');
$layout = $input->getCmd('layout', '');
// Joomla 4/5/6 updating page (before its JS extracts), or the legacy
// Joomla 3 install task.
// The "Install the update" click posts to option=com_joomlaupdate&
// layout=update — the confirm/updating page, which is where the JS then
// downloads + extracts. (Some flows use view=update; Joomla 3 used
// task=update.install.) Intercept whichever fires — before files change.
if ($input->getCmd('option', '') !== 'com_joomlaupdate'
|| ($view !== 'update' && $task !== 'update.install')) {
|| ($layout !== 'update' && $view !== 'update' && $task !== 'update.install')) {
return;
}
@@ -298,7 +301,9 @@ final class MokoSuiteBackup extends CMSPlugin implements SubscriberInterface
$returnUri = new Uri(Uri::base() . 'index.php');
$returnUri->setVar('option', 'com_joomlaupdate');
if ($view === 'update') {
if ($layout === 'update') {
$returnUri->setVar('layout', 'update');
} elseif ($view === 'update') {
$returnUri->setVar('view', 'update');
} else {
$returnUri->setVar('task', $task);