diff --git a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php
index 44f4e3b9bb6a2..041b57d21a472 100644
--- a/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php
+++ b/administrator/components/com_joomlaupdate/src/Model/UpdateModel.php
@@ -1347,15 +1347,36 @@ public function getPhpOptions()
$options[] = $option;
$updateInformation = $this->getUpdateInformation();
- // Check if configured database is compatible with the next major version of Joomla
- $nextMajorVersion = Version::MAJOR_VERSION + 1;
-
- if (version_compare($updateInformation['latest'], (string) $nextMajorVersion, '>=')) {
+ // Extra checks when updating to the next major version of Joomla
+ if (version_compare($updateInformation['latest'], (string) Version::MAJOR_VERSION + 1, '>=')) {
+ // Check if configured database is compatible with the next major version of Joomla
$option = new \stdClass();
$option->label = Text::sprintf('INSTL_DATABASE_SUPPORTED', $this->getConfiguredDatabaseType());
$option->state = $this->isDatabaseTypeSupported();
$option->notice = null;
$options[] = $option;
+
+ // Check if the Joomla 5 backwards compatibility plugin is disabled
+ $plugin = ExtensionHelper::getExtensionRecord('compat', 'plugin', 0, 'behaviour');
+
+ $this->translateExtensionName($plugin);
+
+ $option = new \stdClass();
+ $option->label = Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_DISABLED_TITLE', $plugin->name);
+ $option->state = !PluginHelper::isEnabled('behaviour', 'compat');
+ $option->notice = $option->state ? null : Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_DISABLED_NOTICE', $plugin->folder, $plugin->element);
+ $options[] = $option;
+
+ // Check if the Joomla 6 backwards compatibility plugin is enabled
+ $plugin = ExtensionHelper::getExtensionRecord('compat6', 'plugin', 0, 'behaviour');
+
+ $this->translateExtensionName($plugin);
+
+ $option = new \stdClass();
+ $option->label = Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_ENABLED_TITLE', $plugin->name);
+ $option->state = PluginHelper::isEnabled('behaviour', 'compat6');
+ $option->notice = $option->state ? null : Text::sprintf('COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_ENABLED_NOTICE', $plugin->folder, $plugin->element);
+ $options[] = $option;
}
// Check if database structure is up to date
diff --git a/administrator/language/en-GB/com_joomlaupdate.ini b/administrator/language/en-GB/com_joomlaupdate.ini
index 871c1f8243e12..c77d66f15d6a2 100644
--- a/administrator/language/en-GB/com_joomlaupdate.ini
+++ b/administrator/language/en-GB/com_joomlaupdate.ini
@@ -180,6 +180,10 @@ COM_JOOMLAUPDATE_VIEW_DEFAULT_PACKAGE_INFO="You can also download the minimum requirements for Joomla %1$s."
+COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_DISABLED_NOTICE="Go to 'System - Manage - Plugins' and disable the plugin."
+COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_DISABLED_TITLE="The '%s' plugin is disabled"
+COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_ENABLED_NOTICE="Go to 'System - Manage - Plugins' and enable the plugin."
+COM_JOOMLAUPDATE_VIEW_DEFAULT_PLUGIN_ENABLED_TITLE="The '%s' plugin is enabled"
COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN="Potential Upgrade Issue."
COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_CONFIRM_MESSAGE="Are you sure you want to acknowledge the warnings about potentially incompatible extensions and proceed with the update?"
COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_DESC="This extension includes a plugin that could cause the update to fail.
To perform the Joomla update safely you should either update this extension to a version compatible with your target version of Joomla or disable the relevant plugin(s) and check again."
diff --git a/libraries/src/Console/UpdateCoreCommand.php b/libraries/src/Console/UpdateCoreCommand.php
index 63a08ee4b28d6..b14c274c8b235 100644
--- a/libraries/src/Console/UpdateCoreCommand.php
+++ b/libraries/src/Console/UpdateCoreCommand.php
@@ -15,6 +15,8 @@
use Joomla\CMS\Installer\InstallerHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Log\Log;
+use Joomla\CMS\Plugin\PluginHelper;
+use Joomla\CMS\Version;
use Joomla\Console\Command\AbstractCommand;
use Joomla\Database\DatabaseInterface;
use Joomla\Filesystem\Exception\FilesystemException;
@@ -192,7 +194,6 @@ public function doExecute(InputInterface $input, OutputInterface $output): int
$this->progressBar->display();
$this->progressBar->advance();
-
$errors = $this->checkSchema();
if ($errors > 0) {
@@ -203,6 +204,22 @@ public function doExecute(InputInterface $input, OutputInterface $output): int
return self::ERR_CHECKS_FAILED;
}
+ // If upgrading to a new major version, check pre-conditions
+ if (version_compare($this->updateInfo['latest'], (string) Version::MAJOR_VERSION + 1, '>=')) {
+ $this->progressBar->clear();
+ $this->ioStyle->writeln('Check pre-conditions for a major upgrade to version ' . $this->updateInfo['latest'] . '...');
+ $this->progressBar->display();
+ $this->progressBar->advance();
+
+ if (!$this->checkMajorUpgrade()) {
+ $this->progressBar->finish();
+
+ $this->ioStyle->info('The pre-conditions for a major upgrade are not fulfilled.');
+
+ return self::ERR_CHECKS_FAILED;
+ }
+ }
+
$this->progressBar->clear();
$this->ioStyle->writeln('Starting Joomla! update ...');
$this->progressBar->display();
@@ -502,4 +519,32 @@ public function checkSchema(): int
return $changeInformation['errorsCount'];
}
+
+ /**
+ * Check pre-conditions for major version upgrade
+ *
+ * @return boolean True if success
+ *
+ * @since __DEPLOY_VERSION__
+ */
+ public function checkMajorUpgrade(): bool
+ {
+ $return = true;
+
+ $language = Factory::getLanguage();
+ $language->load('plg_behaviour_compat.sys', JPATH_ADMINISTRATOR);
+ $language->load('plg_behaviour_compat6.sys', JPATH_ADMINISTRATOR);
+
+ if (PluginHelper::isEnabled('behaviour', 'compat')) {
+ $this->ioStyle->error('The \'' . Text::_('PLG_BEHAVIOUR_COMPAT') . '\' plugin is enabled.');
+ $return = false;
+ }
+
+ if (!PluginHelper::isEnabled('behaviour', 'compat6')) {
+ $this->ioStyle->error('The \'' . Text::_('PLG_BEHAVIOUR_COMPAT6') . '\' plugin is disabled.');
+ $return = false;
+ }
+
+ return $return;
+ }
}