New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Joomla\CMS\Installer\InstallerScript::getItemArray()
does not return unique results
#23219
Comments
it looks like |
For the most B/C behavior you'd have to introduce a new method because there are too many what ifs and we all know how people groan if you change anything (in theory since not typehinted you can change |
I just came across this from elsewhere. I originally based this on Nic's FOF installer script with a few common other things I'd seen around mixed in - so the original intent of this was just to be for components. Then I think that |
Re-opening as this hasn't been solved. And the core preflight method is broken for the same reason. |
We need to make extension type, client ID and plugin folder available in the script. What would be the best way to do this?
|
This is the declaration of the method in question:
$identifier already can have multiple different values, so in order to be able to fix this in 4.x, why not extend the permissible values to an associative array? So when $identifier is an array and $column is null, we could then check for several columns. In |
@laoneo ? |
But then I would rather create a new function which does it right and deprecate the faulty one. |
I do agree with @laoneo |
It looks like this might have been exposed by #22090 as things were working OK in 3.8 and earlier, but that PR in and of itself isn't actually the problem here yet somehow applying it exposes the problem.
Extensions have to have a unique element name based on the extension type (and in the case of plugins, the folder; in the case of modules and templates I think this is also based on the client ID). So there are actually multiple records in that table where the
element
column is named "joomla" and this is perfectly acceptable.If you have an extension script that extends
Joomla\CMS\Installer\InstallerScript
, its preflight method will try to validate that you aren't installing an older version if instructed to do so. To do that check,Joomla\CMS\Installer\InstallerScript::getItemArray()
is called with a set of params that basically results in this query:So going back to that example with extensions where the element column has the value of "joomla", this creates a non-unique result set. How did I run into this problem you ask? The
joomla.org
template is named "joomla" and trying to test installing an update I got a "Downgrading from version 13.1 to version 3.0.1-dev is not allowed." error message; except the template version isn't 13.1, that is the version of the Joomla library extension.The text was updated successfully, but these errors were encountered: