User tests: Successful: Unsuccessful:
Our different extension types all have different ways how to find out their own name. A component, language and template could be named after a tag <element> in its manifest or by its name. A module will either use the <element> tag or read the first module attribute of a child of the <files> tag it can find. A file extension will always be named after its manifests filename, a plugin will require you to do the same as for modules, but does not support the <element> tag. Packages expect an element named <packagename>, which is not allowed to contain a pkg_ prefix. Libraries need an element named <libraryname>. Only half of that is documented here: https://docs.joomla.org/Manifest_files
This PR unifies that so that all extensions (except file) support the <element> tag and, if not present, will fall back to the name. The existing ways of naming an extension are kept and take precedence over this "new" behaviour:
| Type | Order in which the element is determined |
|---|---|
| Component, language, template | <element>, <name> (unchanged) |
| Module | <element>, module attribute in <files>, <name> |
| Plugin | plugin attribute in <files>, <element>, <name> |
| Library | <libraryname>, <element>, <name> |
| Package | <packagename>, <element>, <name>. The pkg_ prefix is only added if it is not already there |
| File | name of the manifest file (unchanged) |
All results are now run through InputFilter::clean().
Behaviour changes
cmd and lowercase). Before, the plugin attribute, <libraryname> and the manifest name of a file extension were used as written, and <packagename> was filtered but not lowercased. An extension whose name contains uppercase letters therefore gets a lowercase element after this PR.<packagename>pkg_example</packagename> results in pkg_example instead of pkg_pkg_example.plugin attribute used to be installed with an empty element directly into its group folder, a module without <element> and module attribute failed to install. Both are now named after <element> or <name>.Create the test extensions below. Each one is a folder with the given .xml manifest and an index.html (the content does not matter, e.g. <!DOCTYPE html><title></title>), zipped so that the manifest is at the top level of the zip. Install each zip in System > Install > Extensions > Upload Package File.
After each install check the element in the database:
SELECT extension_id, name, type, element, folder FROM #__extensions WHERE name LIKE 'Element test%';and check that the files are where the element says (see the expected results). Then uninstall the extension in System > Manage > Extensions and check that the files, the folder and, for libraries, packages and file extensions, the manifest in administrator/manifests/ are gone.
plugin attributeelementtest1.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>Element test 1</name>
<version>1.0.0</version>
<files>
<filename plugin="elementtest1">index.html</filename>
</files>
</extension><element> tag[!WARNING]
Only install this plugin with the PR applied. Without the PR it is installed with an empty element directly intoplugins/system, and uninstalling it deletes the wholeplugins/systemfolder.
elementtest2.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>Element test 2</name>
<element>elementtest2</element>
<version>1.0.0</version>
<files>
<filename>index.html</filename>
</files>
</extension>plugin attributeelementtest3.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="plugin" group="system" method="upgrade">
<name>Element test 3</name>
<version>1.0.0</version>
<files>
<filename plugin="ElementTest3">index.html</filename>
</files>
</extension><element> tag and a different module attributemod_elementtest4.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" client="site" method="upgrade">
<name>Element test 4</name>
<element>mod_elementtest4</element>
<version>1.0.0</version>
<files>
<filename module="mod_elementtest4_legacy">index.html</filename>
</files>
</extension>module attributemod_elementtest5.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" client="site" method="upgrade">
<name>Element test 5</name>
<version>1.0.0</version>
<files>
<filename module="mod_elementtest5">index.html</filename>
</files>
</extension>elementtest6.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="library" method="upgrade">
<name>Element test 6</name>
<libraryname>elementtest6</libraryname>
<version>1.0.0</version>
<files>
<filename>index.html</filename>
</files>
</extension>pkg_ prefixPut the zip of test 1 as plg_system_elementtest1.zip next to the manifest. There is no index.html in this package.
pkg_elementtest7.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="package" method="upgrade">
<name>Element test 7</name>
<packagename>elementtest7</packagename>
<version>1.0.0</version>
<files>
<file type="plugin" id="elementtest1" group="system">plg_system_elementtest1.zip</file>
</files>
</extension>Install and uninstall it, then change the line to <packagename>pkg_elementtest7</packagename>, zip it again and install it again.
Put the index.html into a subfolder files.
files_elementtest8.xml
<?xml version="1.0" encoding="utf-8"?>
<extension type="file" method="upgrade">
<name>Element test 8</name>
<version>1.0.0</version>
<fileset>
<files folder="files" target="media/elementtest8">
<filename>index.html</filename>
</files>
</fileset>
</extension>Regression test
Before applying the PR, install a few existing extensions of different types, for example from the JED. Apply the PR, install the same versions again as an update and uninstall them. Also use System > Discover with an extension whose files were copied into the site manually.
element = elementtest1, files in plugins/system/elementtest1.plugins/system.element = ElementTest3, files in plugins/system/ElementTest3.element = mod_elementtest4, files in modules/mod_elementtest4.element = mod_elementtest5, files in modules/mod_elementtest5.element = elementtest6, files in libraries/elementtest6, manifest administrator/manifests/libraries/elementtest6.xml.element = pkg_elementtest7, manifest administrator/manifests/packages/pkg_elementtest7.xml. With the prefix in the manifest, the element is pkg_pkg_elementtest7.element = files_elementtest8, files in media/elementtest8, manifest administrator/manifests/files/files_elementtest8.xml.All extensions except test 2 can be uninstalled completely.
element = elementtest1, files in plugins/system/elementtest1.element = elementtest2, files in plugins/system/elementtest2.element = elementtest3, files in plugins/system/elementtest3 (lowercase, see the behaviour changes above).element = mod_elementtest4, the <element> tag still takes precedence over the module attribute.element = mod_elementtest5.element = elementtest6.element = pkg_elementtest7, both with and without the prefix in the manifest.element = files_elementtest8.All extensions can be uninstalled completely, and the extensions from the regression test can be updated and uninstalled as before.
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Category | ⇒ | Libraries |
| Status | New | ⇒ | Pending |
| Labels |
Added:
?
|
||
| Labels |
Added:
Feature
|
||
This pull request has been automatically rebased to 5.1-dev.
| Status | Pending | ⇒ | Closed |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-03-22 10:49:55 |
| Closed_By | ⇒ | Hackwar |
| Status | Closed | ⇒ | New |
| Closed_Date | 2024-03-22 10:49:55 | ⇒ | |
| Closed_By | Hackwar | ⇒ | |
| Labels |
Added:
?
|
||
| Status | New | ⇒ | Pending |
| Labels |
Removed:
?
|
||
This pull request has been automatically rebased to 5.2-dev.
| Title |
|
||||||
This pull request has been automatically rebased to 5.3-dev.
| Title |
|
||||||
| Labels |
Added:
?
Removed: ? |
||
This pull request has been automatically rebased to 6.0-dev.
| Title |
|
||||||
Please provide test instructions
| Labels |
Added:
PR-6.0-dev
Removed: ? |
||
This pull request has been automatically rebased to 6.1-dev.
| Title |
|
||||||
This pull request has been automatically rebased to 6.2-dev.
| Title |
|
||||||
| Labels |
Added:
PR-6.2-dev
Architecture
Removed: PR-6.0-dev |
||
This pull request has been automatically rebased to 6.3-dev. Joomla! 6.2 is now in feature freeze.
| Title |
|
||||||
| Category | Libraries | ⇒ | Libraries Administration Installation Language & Strings Repository NPM Change |
| Labels |
Added:
Language Change
NPM Resource Changed
PR-6.3-dev
Removed: PR-6.2-dev |
||
| Category | Libraries Administration Installation Language & Strings Repository NPM Change | ⇒ | Libraries |
| Labels |
Removed:
Language Change
NPM Resource Changed
|
||
I worked on this further and the PR should be ready to be tested.
@Hackwar Unit tests are failing, see https://ci.joomla.org/joomla/joomla-cms/65798/1/10 :