No Code Attached Yet bug
avatar sergeytolkachyov
sergeytolkachyov
6 Dec 2022

My library uses library helper to save parameters to the database (Joomla\CMS\Helper\LibraryHelper::saveParams()). the parameters are stored in the #__extensions table, the params column. If you install the next version of your library via Joomla installer, the parameters are removed from this column. The same applies to the custom_data column.
See the video
https://user-images.githubusercontent.com/6236403/205869005-ee3faeb9-65b6-456d-aacd-13d077ca55db.mp4

Steps to reproduce the issue

Expected result

Actual result

System information (as much as possible)

Additional comments

avatar sergeytolkachyov sergeytolkachyov - open - 6 Dec 2022
avatar joomla-cms-bot joomla-cms-bot - change - 6 Dec 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 6 Dec 2022
avatar richard67
richard67 - comment - 6 Dec 2022

@sergeytolkachyov Does it have the reason described in issue #35083 , i.e. you have an uninstall SQL and that runs on update? If so, does the workaround provided in this comment #35083 (comment) work for you?

avatar sergeytolkachyov
sergeytolkachyov - comment - 6 Dec 2022

@sergeytolkachyov Does it have the reason described in issue #35083 , i.e. you have an uninstall SQL and that runs on update? If so, does the workaround provided in this comment #35083 (comment) work for you?

No, that issue does not match to mine. I haven't any sql files in library package. This issue connected with core joomla table #__extensions. there is a library XML manifest

<?xml version="1.0" encoding="UTF-8" ?>
<extension type="library" method="upgrade">
	<name>WebTolk AmoCRM library</name>
	<libraryname>Webtolk/Amocrm</libraryname>
	<version>1.0.2-alpha</version>
	<description>AmoCRM connection library</description>
	<creationDate>06/12/2022</creationDate>
	<copyright>2022 Sergey Tolkachyov</copyright>
	<license>GNU/GPL 3.0</license>
	<author>Sergey Tolkachyov</author>
	<authorEmail>info@web-tolk.ru</authorEmail>
	<authorUrl>https://web-tolk.ru</authorUrl>
	<namespace path="src">Webtolk\Amocrm</namespace>
	<files folder="libraries">
		<folder>src</folder>
		<filename>amocrm.xml</filename>
	</files>
</extension>
avatar sergeytolkachyov
sergeytolkachyov - comment - 6 Dec 2022

@richard67 Hmm, there is an installer bug only for type="library"... I'll test it. That is very strange

avatar SharkyKZ
SharkyKZ - comment - 13 Dec 2022

It's not a bug, it's a featureā„¢

// We can upgrade, so uninstall the old one
// We don't want to compromise this instance!
$installer = new Installer();
$installer->setDatabase($this->getDatabase());
$installer->setPackageUninstall(true);
$installer->uninstall('library', $this->currentExtensionId);
// Clear the cached data
$this->currentExtensionId = null;
$this->extension = Table::getInstance('Extension', 'JTable', array('dbo' => $this->getDatabase()));

It can be removed in 5.0.

avatar sergeytolkachyov
sergeytolkachyov - comment - 13 Dec 2022

It's not a bug, it's a featureā„¢

// We can upgrade, so uninstall the old one
// We don't want to compromise this instance!
$installer = new Installer();
$installer->setDatabase($this->getDatabase());
$installer->setPackageUninstall(true);
$installer->uninstall('library', $this->currentExtensionId);
// Clear the cached data
$this->currentExtensionId = null;
$this->extension = Table::getInstance('Extension', 'JTable', array('dbo' => $this->getDatabase()));

It can be removed in 5.0.

This method is no deprecated now. Why not fix it now?

avatar SharkyKZ
SharkyKZ - comment - 13 Dec 2022

Because existing extensions may rely on this behavior. In which case they do not handle the removal or renaming of library files on updates. Changing this behavior could potentially break some libraries which is why this to be done in the next major version.

avatar sergeytolkachyov
sergeytolkachyov - comment - 14 Dec 2022

@SharkyKZ What could be tougher than deleting and installing a new one instead of a real update? As far as I understand, everyone who faces this problem finds workarounds in order to restore the correct, necessary behavior. Did you read #35083 (comment) - this is just a vivid example of how developers are trying to work around the problem and achieve the desired result

avatar SharkyKZ
SharkyKZ - comment - 14 Dec 2022

Yes, I've seen that. In fact, I remember when it was supposedly fixed in #23303. I agree this behavior needs to be removed and I already explained why this should be done in 5.0. But it's not for me to decide. You can submit a PR against 4.2 if you want and hope someone merges it.

avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar Hackwar Hackwar - change - 25 Aug 2023
Labels Added: PBF
avatar Hackwar Hackwar - labeled - 25 Aug 2023
avatar brianteeman brianteeman - change - 1 Sep 2023
Labels Removed: PBF
avatar brianteeman brianteeman - unlabeled - 1 Sep 2023
avatar sergeytolkachyov
sergeytolkachyov - comment - 2 Sep 2023

Ping

Add a Comment

Login with GitHub to post a comment