bug: enablePlugin() never called if menu creation fails #89

Closed
opened 2026-05-22 03:29:22 +00:00 by jmiller · 1 comment
Owner

Description

enablePlugin() is only called at the end of createTermsMenuItem() in script.php:345. If menu item creation fails for any reason (missing com_content ID, table bind/check/store failure, exception), the plugin is never enabled after installation.

Impact

Fresh installs may leave the plugin disabled with no user-facing error. The user would not know the plugin is inactive.

Fix

Move enablePlugin() call to postflight() unconditionally, or at minimum in the success path of createTermsOfServiceSetup(), not buried inside the deepest nested helper.

Files

  • src/script.php:345 - enablePlugin() only called from createTermsMenuItem()
  • src/script.php:121-132 - postflight() does not call enablePlugin() directly
## Description `enablePlugin()` is only called at the end of `createTermsMenuItem()` in `script.php:345`. If menu item creation fails for any reason (missing com_content ID, table bind/check/store failure, exception), the plugin is never enabled after installation. ## Impact Fresh installs may leave the plugin disabled with no user-facing error. The user would not know the plugin is inactive. ## Fix Move `enablePlugin()` call to `postflight()` unconditionally, or at minimum in the success path of `createTermsOfServiceSetup()`, not buried inside the deepest nested helper. ## Files - `src/script.php:345` - enablePlugin() only called from createTermsMenuItem() - `src/script.php:121-132` - postflight() does not call enablePlugin() directly
jmiller added the joomlapriority: criticalbug labels 2026-05-22 03:29:22 +00:00
Author
Owner

Testing Steps -- enablePlugin() called unconditionally

Setup

  1. Install a fresh Joomla 5.x instance
  2. Build the plugin ZIP from the dev branch src/ directory

Test A: Fresh install with menu creation failure

  1. Temporarily disable com_content in #__extensions to simulate menu creation failure
  2. Install the plugin ZIP via System > Install > Extensions
  3. Go to System > Manage > Extensions, search for "mokojoomtos"
  4. Expected: Plugin shows as Enabled despite the menu creation failing
  5. Restore com_content

Test B: Upgrade path re-enables plugin

  1. Install the plugin normally (fresh install)
  2. Go to System > Plugins, find MokoJoomTOS, disable it manually
  3. Re-install the same ZIP (simulates upgrade)
  4. Go to System > Plugins, find MokoJoomTOS
  5. Expected: Plugin is Enabled again after the upgrade

Pass criteria

  • Plugin is enabled after fresh install even if article/menu creation partially fails
  • Plugin is re-enabled after upgrade if it was manually disabled
## Testing Steps -- enablePlugin() called unconditionally ### Setup 1. Install a fresh Joomla 5.x instance 2. Build the plugin ZIP from the `dev` branch `src/` directory ### Test A: Fresh install with menu creation failure 1. Temporarily disable `com_content` in `#__extensions` to simulate menu creation failure 2. Install the plugin ZIP via **System > Install > Extensions** 3. Go to **System > Manage > Extensions**, search for "mokojoomtos" 4. **Expected:** Plugin shows as **Enabled** despite the menu creation failing 5. Restore `com_content` ### Test B: Upgrade path re-enables plugin 1. Install the plugin normally (fresh install) 2. Go to **System > Plugins**, find MokoJoomTOS, **disable** it manually 3. Re-install the same ZIP (simulates upgrade) 4. Go to **System > Plugins**, find MokoJoomTOS 5. **Expected:** Plugin is **Enabled** again after the upgrade ### Pass criteria - [ ] Plugin is enabled after fresh install even if article/menu creation partially fails - [ ] Plugin is re-enabled after upgrade if it was manually disabled
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoJoomTOS#89