No Code Attached Yet
avatar ChristineWk
ChristineWk
17 Dec 2023

Steps to reproduce the issue

In the German forum we were informed of the following:

When an extension is uninstalled (doesn't happen for normal plugins/modules) following message appears:

"An attempt is being made to uninstall an unknown extension from the package. However, it may have already been removed beforehand."

Expected result

Either you should be informed WHICH extension could not be uninstalled, or the message should not appear at all.

Actual result

see above

System information (as much as possible)

Joomla 4.4.1
PHP 8.2

Additional comments

The following has already been done:

  • Components folder checked
  • DB root checked
  • DB table Extensions checked
  • Debug mode "unfortunately" does not throw a call stack either
avatar ChristineWk ChristineWk - open - 17 Dec 2023
avatar ChristineWk ChristineWk - change - 17 Dec 2023
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 17 Dec 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 17 Dec 2023
avatar chmst
chmst - comment - 18 Dec 2023

Thanks for reporting I see this warning frequently and agree that it is not really useful. It appears when some parts of a package are deinstalled before the whole package. In general, this should not be possible, but sometimes extensions also are removed by the user directly, or there are older extensions. It would be helpful if the name of the missing element could be shown

avatar richard67
richard67 - comment - 26 Dec 2023

@ChristineWk The English message in the description of the issue, has that been translated from German? The only language string which I can find which could be the one is this one in the "lib_joomla.ini" in the administrator language:

JLIB_INSTALLER_ERROR_PACK_UNINSTALL_UNKNOWN_EXTENSION="Trying to uninstall unknown extension from package. This extension may have already been removed earlier."

There is another one in the same language file where the extension would be known and be part of the message (%s):

JLIB_INSTALLER_ERROR_PACK_UNINSTALL_NOT_PROPER="Package Uninstall: This extension may have already been uninstalled or might not have been uninstalled properly: %s"

It needs to check PHP code where these strings are used to see why in case of the first string the extension is not known and if that can be fixed somehow.

avatar richard67
richard67 - comment - 26 Dec 2023

Ok, the string in question is only used in the "libraries/src/Installer/Adapter/PackageAdapter.php" file in method "removeExtensionFiles". That method goes through all files in the <files> element of the package's manifest file and checks in database if the correspnding extension exists. If that is not the case (no extension ID found), it reports that string. This could be extended or fixed by reporting also the parameters for which it tried to find the extension.

E.g. for the first example <file type="component" id="com_helloworld" >com_helloworld.zip</file> in the package manifest documentation here https://docs.joomla.org/Package it would be:

  • type = "component"
  • id (or better "name") = "com_helloworld"
  • file = "com_helloworld.zip"
  • in case of modules also client = administrator or site.

We could create a new language string which contains these details for that case and deprecate the old string.

Or maybe it would be sufficient just to add the name (attribute "id"), e.g. "com_helloworld". I have to check if that attribute is mandatory so it can be used in all cases.

I will see if I can make a PR soon.

avatar richard67
richard67 - comment - 26 Dec 2023

Some information in addition to @chmst 's correct explanation why this can happen:

In old times before we had packages it was the responsibility of a component to uninstall any corresponding extensions like plugins or modules, and the components handled that with their installer script.

Now as we have packages it would be sufficient just to uninstall the package when the package is made right.

But some popular 3rd party components which I know still do it the old way, so when you uninstall the component (or uninstall the package and that comes to the component), then the component uninstallation also uninstalls other extensions, and then when later the package is uninstalled, these extensions are already gone.

avatar richard67 richard67 - change - 26 Dec 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-12-26 14:52:26
Closed_By richard67
avatar richard67 richard67 - close - 26 Dec 2023
avatar richard67
richard67 - comment - 26 Dec 2023

Closing as having a pull request. Please test #42570 . Thanks in advance.

Add a Comment

Login with GitHub to post a comment