Track the package/extension relationships#12977
Track the package/extension relationships#12977rdeutz merged 8 commits intojoomla:stagingfrom mbabker:package-relations
Conversation
|
👍 from me on all changes that bind packages together. Right now I'm basically locking my own extensions from the package so they cannot be individually removed (without removing the whole package). Its a hack and I don't like it, so I'd want to get rid of it if possible. Another related feature for this would be to be able to set dependencies between packages. That would allow to have a better system for #12961 as well, where extensions could only be locked if they are being used by another extension. |
|
Added all the required schema. For what this PR is it is now feature complete.
Done.
As I hinted at in #12976 a later phase would introduce API to be able to manage this. I haven't thought this through completely yet, but shooting from the hip, it would basically be if you choose to uninstall an extension that has an associated package, it would load that package's data to determine if the package allows individual uninstalls (probably a tag in the manifest schema or an attribute on the base tag similar to
Inter-extension dependency declarations/tracking isn't in any way related to this. Nor should it be. |
|
Nice work @mbabker :) I cannot wait removing my ugly hack on this. Another question that comes into my mind is: what if package provided optional extension that can be removed and the user chooses to remove it. After a while there's a new version of the package -- so user installs it. Right now the removed extension would not stay uninstalled. Though its a bit more complicated than this as new extensions could also be added to the package later on. And what would happen if user changes his mind and wants to get it back... |
|
A package should always install all parts of the package imho. If the user uninstalls a part, then it should be reinstalled. That's what I would expect. |
| ); | ||
| } | ||
|
|
||
| $this->installedIds[] = $tmpInstaller->extension->extension_id; |
There was a problem hiding this comment.
$tmpInstaller->extension->extension_id; is always null
|
i've made some test with different pkg's like pkg_weblinks ect... some bug on installer/adapter ? |
|
I'd call that a bug in JTable then if the PK field isn't getting populated on insert. |
| @@ -0,0 +1 @@ | |||
| ALTER TABLE "#__extensions" ADD COLUMN "package_id" bigint DEFAULT 0 NOT NULL; | |||
There was a problem hiding this comment.
minor issue but for consistency across db systems you should add a comment here too.
COMMENT ON COLUMN "#__extensions"."package_id" IS 'Parent package ID for extensions installed as a package.';|
same results as @alikon installed several pkgs and i never get the package_id populated. Also some other things i noticed:
|
Then there is a bug with the use of JTable populating the PK fields after an insert operation. Unrelated to this pull request. I will not change to use
That's exactly what the
We cannot guarantee the 802 ID is the correct relation.
This is contradictory. The column's "native" width at 1% is 54px, adding the
Fixed. |
yes i understand is not related to this PR, but the fact is that needs to somehow be fixed, because it doesn't seem to work as it is
right, sleeping sorry
you can, on install sql, but not on update, but you can still do a query on update to check for the pkg-en-GB id and use it.
1% makes the column smallest as possible according to the viewport width. |
…sionAfterInstall' event
Turns out it's not a bug in JTable. The As for the column width, honestly I'd have to say we're doing it majorly wrong if we're declaring in the HTML that it should be the smallest width then in the CSS declarations using a class set that is widening that column beyond what the HTML has declared. The HTML width declaration should be consistent with what we are doing with design otherwise why bother with the width attributes in the first place? So if I add this stuff, I will do it only using values that are consistent with the end result. |
that is not big issue. not worth pending this PR because of that IMHO |
|
reggarding the update sql query for pkg_en-GB UPDATE `#__extensions` AS `e1`
INNER JOIN (SELECT `extension_id` FROM `#__extensions` WHERE `type` = 'package' AND `element` = 'pkg_en-GB') AS `e2`
SET `e1`.`package_id` = `e2`.`extension_id`
WHERE ((`e1`.`type`= 'language' AND `e1`.`element` = 'en-GB') OR (`e1`.`type`= 'package' AND `e1`.`element` = 'pkg_en-GB')); |
|
Update queries done (I'll be so glad when we stop including data changes in the schema changeset files). If someone wants to make sure they're actually right for all engines that'd be helpful. |
|
misses the pkg_en-GB relation in joomla.sql install files |
|
I have tested this item ✅ successfully on 0248944 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12977. |
|
I have tested this item ✅ successfully on 0248944 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12977. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/12977. |
|
@mbabker could you have a look at the conflicts, thanks |
|
Done |

Summary of Changes
Presently there is no tracking in the database of a relationship between a package extension and the extensions it installs, really the only way to know this information is to process the package extension's XML manifest. This is a step at improving this so we can do other things throughout the API.
Testing Instructions
With the patch applied, installing a package extension (language packages are great for testing here) should record the package extension's ID to the
#__extensionstable's newpackage_idcolumn. A query failure setting this info is gracefully handled and essentially results in the current status.This query will be run during the
finaliseInstallstep of the install process. This step is run by theinstallandupdatepaths (discover_installas well but packages don't support this so it's a mute point), so as extension packages are updated after this change is deployed, packages will start to correctly associate themselves with child extensions.Documentation Changes Required
Note the newly added database column.
TODO