Skip to content

Comments

Fix error in script when upgrade from JG3 to JG4#161

Merged
Elfangor93 merged 10 commits intoJoomGalleryfriends:mainfrom
Elfangor93:script-uninstallModules
Dec 23, 2023
Merged

Fix error in script when upgrade from JG3 to JG4#161
Elfangor93 merged 10 commits intoJoomGalleryfriends:mainfrom
Elfangor93:script-uninstallModules

Conversation

@Elfangor93
Copy link
Member

Upgrade from JG3 to JG4 created an error, when script tries to uninstall modules during the upgrading process. Line 180 of script.php $this->uninstallModules(array('mod_joomgithub')); throws an error because it tries to call method children() on variable type array.

Thanks @csoscd for reporting this issue.

@Elfangor93 Elfangor93 added the needs testing This issue or pull request needs further testing label Oct 5, 2023
@MrMusic
Copy link
Member

MrMusic commented Oct 6, 2023

I have tried the upgrate with this PR.
The JG3 tables were renamed correctly.
Unfortunately the default entries are missing in the new database tables.

OS: Windows
PHP 8.0.28
MariaDB 10.4.28

@Elfangor93
Copy link
Member Author

Unfortunately the default entries are missing in the new database tables.

Yes, I have excluded this, because i didn't know how I want to solve this with the upgrade script. But now I know and we can include it.

@MrMusic
Copy link
Member

MrMusic commented Oct 9, 2023

2 errors during installation:
0 Resource 'DatabaseInterface' has not been registered with the container.
and
0 Resource 'LanguageFactoryInterface' has not been registered with the container.

Reason:
use \Joomla\Database\DatabaseInterface;
and
use \Joomla\CMS\Language\LanguageFactoryInterface;
is missing.

Addition:
I have fixed the two errors mentioned above and tried an update from the JG 3.6.
The following message appears:
jg4-update-error
Then the joomgallery_categories is completely empty, no 'root' or 'uncategorised' entry.
But the default configuration is present.

@Elfangor93
Copy link
Member Author

Reason:
use \Joomla\Database\DatabaseInterface;
and
use \Joomla\CMS\Language\LanguageFactoryInterface;
is missing.

The two missing use stamenets are now in and the errror should be solved.

@MrMusic
Copy link
Member

MrMusic commented Oct 16, 2023

The two missing use stamenets are now in and the errror should be solved.

Thanks.
Sorry, another error still appears:
0 Call to undefined method Joomla\CMS\Language\CachingLanguageFactory::getTag()
in line 233 of script.php
Changing line 232 to
$language = Factory::getLanguage();
solves the error for me.

@Elfangor93
Copy link
Member Author

Factory::getLanguage() is deprecated and will be removed in Joomla 6.
If the approach with the DI Container does not work we could try with $app->getLanguage()

grafik

@MrMusic
Copy link
Member

MrMusic commented Oct 18, 2023

If the approach with the DI Container does not work we could try with $app->getLanguage()

Yes, $app->getLanguage() works.

Now I make a test upgrade from Joomla 3.10.12 to Joomla 4.4.0
Procedure:

  1. Successfully performed Joomla upgrade to 4.4.0.

  2. Current branch 'script-uninstallModules' installed via the extension manager of Joomla.

  3. Messages see screenshot
    jg4-update-error-2023-10-18

  4. After the installation attempt:
    The folder 'com_joomgallery' in administrator/components is no longer exist
    In the Database the old joomgallery tables are present with the extension '_old'
    In the Database are no new tables from the JoomGallery 4 exist

  5. Then second try to install the current 'script-uninstallModules' Branch

  6. Messages see screenshot
    jg4-update-error-2023-10-18_2

Installation now overall successful, but
In the Database the old tables now have 2x the extension "_old", e.g. "#__joomgallery_old_old"
and the new table #__categories does not contain root category.

@AlexanderSupp
Copy link

Question:
When this PR fixed this error can I then directly upgrade to JG4 from Joomla 3.10 to Joomla 5.0, or must I proceed Joomla 3.10 to Joomla 4.4 and then from Joomla 4 to Joomla 5?

@MrMusic
Copy link
Member

MrMusic commented Nov 1, 2023

...can I then directly upgrade to JG4 from Joomla 3.10 to Joomla 5.0...

No, first you have to migrate to Joomla 4.4, See https://docs.joomla.org/Joomla_4.4.x_to_5.x_Planning_and_Upgrade_Step_by_Step

@Elfangor93
Copy link
Member Author

With Joomla 5 (or better PHP 8.2) there are still some issues everywhere in the code. Therefore up until now please use the JG4 only up until Joomla 4.4 and up until PHP 8.1.

@Elfangor93
Copy link
Member Author

Found the problem to this error:
276254968-9946a7e3-b64b-419a-9295-b3f83eae4de1

Since Joomla 4.4 and Joomla 5.x there is a change in the behavior of File::delete() depending if you use it as Joomla\CMS\Filesystem\File::delete() or Joomla\Filesystem\File::delete(). This is why in Joomla 5 and Joomla 4.4.x the installer script does not work anymore...
joomla/joomla-cms#40257 (comment)

@Elfangor93
Copy link
Member Author

It has to be discussed how to solve this issue...

@Elfangor93
Copy link
Member Author

Now also this error is fixed
276255031-33878831-0710-4320-a10b-669b13d00000

@MrMusic Can you give this a last check?

@MrMusic
Copy link
Member

MrMusic commented Dec 22, 2023

Error is fixed! After upgrade from Joomla 3.10.12/JoomGallery 3.6.2 this PR is installable and the default category was created correctly.
I have tested this item ✅ successfully. Thank you very much.

@Elfangor93 Elfangor93 force-pushed the script-uninstallModules branch from 51538c1 to a84971e Compare December 23, 2023 08:56
@Elfangor93 Elfangor93 merged commit 17877d6 into JoomGalleryfriends:main Dec 23, 2023
@Elfangor93 Elfangor93 removed the needs testing This issue or pull request needs further testing label Dec 23, 2023
@Elfangor93 Elfangor93 deleted the script-uninstallModules branch January 5, 2024 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants