No Code Attached Yet
avatar avjoomla
avjoomla
23 Feb 2022

screen shot 2022-02-23 at 14 07 50### Steps to reproduce the issue

  • install a plugin which has it's own table in the database and uses update -> schemas
  • I've created a simple plugin 'Visforms - Limit number of submissions' for this purpose, but I cannot upload the installation here, due to 'file type of zip is not allowed'. I can mail it, if you like to
  • go to System >> Maintenance: Database
  • Database check for the entry 'Visforms - Limit number of submissions' shows "No Problems"
  • Select entry for 'Visforms - Limit number of submissions'
  • Click 'Update Structure'
    I've attached some screenshots which show the problem

Expected result

Still 'No Problems' with the data table structure

Actual result

Result for 'Visforms - Limit number of submissions' shows 'One Problem'

System information (as much as possible)

Tested with php7.4 and 8.0 on different environments
Clean Joomla 4.0 and 4.1 with no additional extensions except the plugin

Additional comments

The problem is cause by by the function fixUpdateVersion in administrator/components/com_installer/src/Model/DatabaseModel.php on line 635ff which does not take into account, that the path to a plugin and it's installation manifest xml is more complex and different form components. (Same statement would be correct for modules, by the way)
As a result, the installation manifest file is not found and the value of the 'version' property in the 'manifest_cache' of the plugin in the table #__extensions is actively and wrongly set to an mpty string.

I've tested the following fix, which seems to work fine.

File: administrator/components/com_installer/src/Model/DatabaseModel.php
After Line 646: Add custom code for plugin, which store there installationXML files in subfolders and under JPATH_SITE
else if ($table->get('type') === 'plugin') {
$installationXML = InstallerHelper::getInstallationXML($table->get('element'), $table->get('type'), 0, $table->get('folder'));
$extensionVersion = (string) $installationXML->version;
}
A quick fix would be highly appreciated. A correct version value in the the 'manifest_cache' is really important and an invalid or empty value can really crash the installation/update process of extensions.screen shot 2022-02-23 at 14 07 52screen shot 2022-02-23 at 14 07 55

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
1.00

avatar avjoomla avjoomla - open - 23 Feb 2022
avatar avjoomla avjoomla - change - 23 Feb 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 23 Feb 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 23 Feb 2022
avatar brianteeman
brianteeman - comment - 23 Feb 2022

Please edit the title so that it has some relative meaning

avatar avjoomla avjoomla - change - 23 Feb 2022
Title
J4.1.0 stable Release
J4 Action 'Update Structure' in Maintenane:Database for plugins sets value of extension version in manifest_cache to empty string
avatar avjoomla avjoomla - edited - 23 Feb 2022
avatar richard67
richard67 - comment - 1 Mar 2022

@avjoomla I think it can be done a little bit easier. Just change line 649 to:

$installationXML = InstallerHelper::getInstallationXML($table->get('element'), $table->get('type'), $table->get('client_id'), $table->get('element') === 'plugin' ? $table->get('folder') : null);

That should fit for all kinds of extensions.

That's how it's done at a few other places in the same file.

I will prepare a PR in a while.

avatar richard67 richard67 - change - 1 Mar 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-03-01 09:10:27
Closed_By richard67
avatar richard67 richard67 - close - 1 Mar 2022
avatar richard67
richard67 - comment - 1 Mar 2022

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

avatar richard67 richard67 - change - 1 Mar 2022
Status Closed New
Closed_Date 2022-03-01 09:10:27
Closed_By richard67
avatar richard67 richard67 - reopen - 1 Mar 2022
avatar richard67
richard67 - comment - 1 Mar 2022

Re-opening since the patch is not ready yet, still work in progress.

avatar richard67 richard67 - close - 1 Mar 2022
avatar richard67
richard67 - comment - 1 Mar 2022

Now the patch is ready. Please test #37160 . Thanks in advance.

avatar richard67 richard67 - change - 1 Mar 2022
Status New Closed
Closed_Date 0000-00-00 00:00:00 2022-03-01 10:37:44
Closed_By richard67
avatar avjoomla
avjoomla - comment - 1 Mar 2022

I tested with your patch and the fix works. Thanks for taking care of this issue.

avatar richard67
richard67 - comment - 1 Mar 2022

@avjoomla Could you mark your test result in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/37160 by using the "Test this" button at the top left corner, then selecting the right test result and submitting? Thanks in advance.

avatar aarati-parajuli
aarati-parajuli - comment - 26 Jul 2022

Hi @richard67

I'm experiencing the same kind of issue for components. I have a package including a plugin and a component. In my case, 'Update Structure' in Maintenance:Database for the component sets the value of the extension version in manifest_cache to an empty string. The plugin version doesn't have any issue though.

And it shows this warning:

Notice: Trying to get property 'version' of non-object in C:\laragon\www\joomla406\administrator\components\com_installer\src\Model\DatabaseModel.php on line 570

This issue occurs only in Joomla 4x (tested in 4.0.6 & 4.1.5), in Joomla 3x, everything is fine.

Any way to solve this?


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

Add a Comment

Login with GitHub to post a comment