Upgrading to Joomla4

joomla

After updating the PHP to 8.1 or PHP 8.2 it is time to upgrade as well the Joomla version from the latest stable version Joomla 3.10.11 Stable to Joomla 4. This process is usually pain but you need to watch out for incompatible plugins and modules. During the PHP update, we had the Back End still accessible, however, during upgrading to Joomla 4 an incompatible plugin or module or component can cause the Back End to be as dead as the Front End. This can cause a lot of issues since uninstalling the plugin after can be a pain. We will address this issue and try to fix the extension until the moment we can at least uninstall it. However, I recommend uninstalling anything that Joomla 4 upgrade script will point as a risk, you will save yourself a head ache.

We are however living on the edge and thus we will keep everything there to see with what we will end up. To make things a bit safer for us I will recommend using Akeeba Backup Core and backing up the site. This will allow us to revert the changes by using the backup file. To make it even better for us, I would suggest installing XAMPP locally and testing the set locally using the backup before upgrading the live site. After this initial set-up, we can proceed with updating the local site, or if you are brave enough, go for the live site straight.

First, you need to update to the latest stable version which is Joomla 3.10.11 Stable. After updating the site to the latest stable release of Joomla 3.x proceed to Joomla Update located in Components-Joomla! Update, and in options change the update channel to Joomla Next, save, and close. Straight after saving these settings, a pre-check will be automatically run to ensure your site is ready to be upgraded. You will end up with a list of plugins, modules, and components which are necessary to be updated or removed. Let's have a look at them.

A lot of these plugins, modules, and components can be installed again like the ARK editor and hence it is not necessary to keep it there since we can install it again. At this point I will uninstall some of the extensions that can be safely installed again and will not make any changes to the live site. After unistalling what I do not need I was left with: Kick GDPR Cookie-Plugin, Show attachments in editor, and Yjsg Framework. Now the last one is the most crucial for now since it is the framework that runs the live site right now. The attachments are necessery since they are the files to the content, right? However, the cookie plugin is something we could keep away but keeping it for now. We will get on these extensions "Potential Upgrade Issue" but since we are brave, we will ignore it. Go to the next tab called "Live Update" and check the "Do you wish to ignore the warnings about potentially incompatible plugins and to proceed with the upgrade?" checkbox, since we are brave.

Sit in your chair and keep the update process working on upgrading your site. At this moment, waiting and praying is the only thing you can do. We are upgrading to the latest version of Joomla 4.2.9. Well, as you can see below my site went from nice to broken in a few seconds. Both the Back End and the Front End are broken and this means either revert the backup file and start over, uninstalling the incompatible stuff, or try to fix them and then uninstall them since they will be doing issues later on - or fix them but I am not sure if it is worth the time especially when those extensions are not developed further.

As before, let's turn DEBUG for Joomla to see where the problems lie. Since the Back End is broken we will log via FTP to the root of the site or just navigate locally to the location of the site and open the configuration.php and edit the debug line, as below. We need to see where the problem and errors are and this is the only option to see it.

configuration.php
#Find line
$debug = '0'; #and change '0' to '1'

Let's start with the Back End since working Back End could save us by uninstalling the incompatible extensions. With DEBUG on we can see again an issue in the YJSG framework, no surprise, right? The problem is now different. Before we had PHP issues but now we have Joomla error which indicates that the right documentation to look in to is for Joomla 4 and not PHP.

0 Call to undefined method Joomla\CMS\Application\AdministratorApplication::isAdmin()

Let's start with the Back End since working Back End could save us by uninstalling the incompatible extensions. With DEBUG on we can see again an issue in the YJSG framework, no surprise, right? The problem is now different. Before we had PHP issues but now we have a Joomla error which indicates that the right documentation to look into is for Joomla 4 and not PHP. The error we see at first is referring to the declaration of the user level. After some reading you will find that ::isAdmin() was changed to isClient("administrator") early in Joomla 3.x but was completely removed from Joomla 4. A similar error is referring to isSite() since it was changed to isClient('site'). You can do a mass replacement in the whole file for those errors.

if ($this->app->isAdmin()) {
#change to
if ($this->app->isClient("administrator")) 
#
if ($this->app->isSite() && $this->run_plg == 1) {
#change to
if ($this->app->isClient('site') && $this->run_plg == 1) {{

Popular