fix: lowercase and clean Joomla element names (#635) #643

Closed
jmiller wants to merge 1 commits from fix/635-joomla-element-name into main
Owner

Summary

AutoElementName() was using m.Name directly without lowercasing or character cleaning, producing elements like pkg_MokoSuiteBackup instead of pkg_mokosuitebackup.

Joomla's InstallerAdapter::getElement() always calls strtolower(InputFilter::clean($element, 'cmd')) — which lowercases and strips all characters except [a-z0-9._-].

Changes

  • Added cleanJoomlaElement() function that replicates Joomla's InputFilter::clean('cmd') behavior
  • AutoElementName() now runs the name through cleanJoomlaElement() before prefixing
  • Removed incorrect \"plugin\": \"plg_\" from prefix map — Joomla plugins use bare element names

Before/After

Repo Before After
MokoSuiteBackup (package) pkg_MokoSuiteBackup pkg_mokosuitebackup
MokoJoomHero (module) mod_MokoJoomHero mod_mokojoomhero
MokoOnyx (template) tpl_MokoOnyx tpl_mokoonyx

Fixes #635

Test plan

  • updates.xml for MokoSuiteBackup shows <element>pkg_mokosuitebackup</element>
  • Joomla admin sees available update after deploying this fix
  • Manifest API still returns the original cased name in element_name field
## Summary `AutoElementName()` was using `m.Name` directly without lowercasing or character cleaning, producing elements like `pkg_MokoSuiteBackup` instead of `pkg_mokosuitebackup`. Joomla's `InstallerAdapter::getElement()` always calls `strtolower(InputFilter::clean($element, 'cmd'))` — which lowercases and strips all characters except `[a-z0-9._-]`. ### Changes - Added `cleanJoomlaElement()` function that replicates Joomla's `InputFilter::clean('cmd')` behavior - `AutoElementName()` now runs the name through `cleanJoomlaElement()` before prefixing - Removed incorrect `\"plugin\": \"plg_\"` from prefix map — Joomla plugins use bare element names ### Before/After | Repo | Before | After | |------|--------|-------| | MokoSuiteBackup (package) | `pkg_MokoSuiteBackup` | `pkg_mokosuitebackup` | | MokoJoomHero (module) | `mod_MokoJoomHero` | `mod_mokojoomhero` | | MokoOnyx (template) | `tpl_MokoOnyx` | `tpl_mokoonyx` | Fixes #635 ## Test plan - [ ] `updates.xml` for MokoSuiteBackup shows `<element>pkg_mokosuitebackup</element>` - [ ] Joomla admin sees available update after deploying this fix - [ ] Manifest API still returns the original cased name in `element_name` field
jmiller added 1 commit 2026-06-18 19:55:23 +00:00
fix: lowercase and clean Joomla element names in AutoElementName (#635)
Branch Policy Check / Verify merge target (pull_request) Failing after 2s
Generic: Repo Health / Site Health (pull_request) Has been skipped
Generic: Repo Health / Access control (pull_request) Successful in 2s
Generic: Repo Health / Access control (push) Successful in 2s
Generic: Repo Health / Site Health (push) Has been skipped
Branch Cleanup / Delete merged branch (pull_request) Has been skipped
RC Revert / Rename rc/ back to dev/ (pull_request) Has been skipped
Universal: Auto Version Bump / Version Bump (push) Successful in 8s
Universal: Build & Release / Promote to RC (pull_request) Has been skipped
Generic: Project CI / Lint & Validate (pull_request) Successful in 41s
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been skipped
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Successful in 46s
PR RC Release / Build RC Release (pull_request) Failing after 46s
Generic: Project CI / Tests (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
dbd6103acb
AutoElementName() was using m.Name directly without lowercasing or
cleaning, producing elements like pkg_MokoSuiteBackup instead of
pkg_mokosuitebackup. Joomla's InstallerAdapter always lowercases
and runs InputFilter::clean('cmd') which strips non-alphanumeric
chars (except . _ -).

Added cleanJoomlaElement() to replicate Joomla's cmd filter.
Removed incorrect "plugin": "plg_" prefix — Joomla plugins use
bare element names without a prefix.

Fixes #635
jmiller closed this pull request 2026-06-18 19:55:39 +00:00
jmiller deleted branch fix/635-joomla-element-name 2026-06-18 19:55:40 +00:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.