feat: pre-update modal phase 2 — auto-run backup on Update click (#196) #233
Reference in New Issue
Block a user
Delete Branch "feat/preupdate-auto-intercept"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Phase 2 of the pre-update backup modal (the "interception later" half of the plan), built on the #232 baseline.
What it adds
New opt-in component param
preupdate_auto_intercept(radio, default 0/off, shown only whenbackup_before_updateis on). When enabled, the update-page script (already injected by the phase-1 baseline) wrapswindow.Joomla.submitbutton: clicking the toolbar Update button first pops the backup progress modal, runs the pre-update backup, and — on success — re-issues the original update task so Joomla proceeds automatically.Why
Joomla.submitbuttonIt's the one seam nearly every admin toolbar action routes through (Extensions → Update's "Update" =
Joomla.submitbutton('update.update')), so a single wrap covers the update pages without hunting page-specific button IDs.submitbuttonis synchronous, so the wrapper swallows the update task, runs the async backup, and calls the originalsubmitbutton(task)itself once the backup resolves.Safety
update.update/update.install— notupdate.find/update.purge(Find Updates / Clear Cache), which also start with "update".ajax.preupdateAck, so the subsequent server-sideonExtensionBeforeUpdatebackup is throttled/skipped (no duplicate backup).submitbutton(e.g. somecom_joomlaupdateinstall paths).Verify
php -lclean (plugin);node --checkclean (JS);config.xmlwell-formed.This supersedes the stale interception attempt in the old PR #196 (which was based on
02.52.19and used a 199-line inline JS blob). Recommend closing #196 once this lands.Refs #196
https://claude.ai/code/session_01WbGBN9VyRK61zczYWcCQ2i