Skip to content

Conversation

@dgrammatiko
Copy link
Contributor

@dgrammatiko dgrammatiko commented Apr 18, 2021

Pull Request for Issue # .

Summary of Changes

Since #32633 J4 (non legacy) Modules don't have a module.php file in their root folder

<filename module="mod_quickicon">mod_quickicon.php</filename>

and thus it's impossible to install a module that uses namespace, check the existing code:

public function getElement($element = null)
{
if (!$element)
{
if (\count($this->getManifest()->files->children()))
{
foreach ($this->getManifest()->files->children() as $file)
{
if ((string) $file->attributes()->module)
{
$element = strtolower((string) $file->attributes()->module);
break;
}
}
}
}
return $element;
}
.

To mitigate this in the easiest possible way I propose to require (for the J4 native modules, not the legacy) one field in the XML: eg <element>mod_wow</element>;

Testing Instructions

You could test this in 2 different ways:

  • go to your db and delete in the extension table the mod_quickicon
  • Then move the administrator/mopdules/mod_quickicon to a folder outside of the Joomla folder
  • Zip the content of the folder and try to install it (it will fail with a message file mod_quickicon.php doesn't exist)
  • Edit the XML file removing the line <filename module="mod_quickicon">mod_quickicon.php</filename> and adding after line 3 <element>mod_quickicon</element> then zip the contents of the folder and try again

Alternative you can download https://jinvalidate.netlify.app/dist/j4/mod_invalidatecache_0.0.6.zip and observe that the module installs correctly

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

Documentation Changes Required

@laoneo some feedback here?
@wilsonge ?

@dgrammatiko
Copy link
Contributor Author

BTW this should be a release blocker

@PhilETaylor

This comment was marked as abuse.

@dgrammatiko
Copy link
Contributor Author

dgrammatiko commented Apr 23, 2021

Thanks @PhilETaylor code updated

@richard67
Copy link
Member

I have tested this item ✅ successfully on fbe603a

I've tested with use of https://jinvalidate.netlify.app/dist/j4/mod_invalidatecache_0.0.6.zip . Without this PR, there is an error when trying to install the module. With the PR, there is no error, and the module is installed. Other modules can still be installed, too.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33182.

@alikon
Copy link
Contributor

alikon commented Apr 23, 2021

I have tested this item ✅ successfully on fbe603a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33182.

@alikon
Copy link
Contributor

alikon commented Apr 23, 2021

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/33182.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 23, 2021
@richard67 richard67 added this to the Joomla 4.0 milestone Apr 23, 2021
@chmst chmst merged commit 73edcfc into joomla:4.0-dev Apr 23, 2021
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Apr 23, 2021
@chmst
Copy link
Contributor

chmst commented Apr 23, 2021

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants