diff --git a/administrator/components/com_joomlaupdate/config.xml b/administrator/components/com_joomlaupdate/config.xml
index 18fea2ce567ee..938aed8bde579 100644
--- a/administrator/components/com_joomlaupdate/config.xml
+++ b/administrator/components/com_joomlaupdate/config.xml
@@ -49,5 +49,29 @@
showon="updatesource:custom"
/>
+
+
+
+
+
+
+
+
+
+
diff --git a/administrator/components/com_joomlaupdate/src/Controller/UpdateController.php b/administrator/components/com_joomlaupdate/src/Controller/UpdateController.php
index 94bba2ca11317..87a9f5912aa99 100644
--- a/administrator/components/com_joomlaupdate/src/Controller/UpdateController.php
+++ b/administrator/components/com_joomlaupdate/src/Controller/UpdateController.php
@@ -18,6 +18,7 @@
use Joomla\CMS\MVC\Controller\BaseController;
use Joomla\CMS\Response\JsonResponse;
use Joomla\CMS\Session\Session;
+use Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel;
/**
* The Joomla! update controller for the Update view
@@ -472,7 +473,8 @@ public function finaliseconfirm()
* Prints a JSON string.
* Called from JS.
*
- * @since 3.10.0
+ * @since 3.10.0
+ * @deprecated 5.0 Use batchextensioncompatibility instead.
*
* @return void
*/
@@ -580,6 +582,143 @@ public function fetchExtensionCompatibility()
$this->app->close();
}
+ /**
+ * Determines the compatibility information for a number of extensions.
+ *
+ * Called by the Joomla Update JavaScript (PreUpdateChecker.checkNextChunk).
+ *
+ * @return void
+ * @since __DEPLOY_VERSION__
+ *
+ */
+ public function batchextensioncompatibility()
+ {
+ $joomlaTargetVersion = $this->input->post->get('joomla-target-version', '', 'DEFAULT');
+ $joomlaCurrentVersion = $this->input->post->get('joomla-current-version', JVERSION);
+ $extensionInformation = $this->input->post->get('extensions', []);
+
+ /** @var \Joomla\Component\Joomlaupdate\Administrator\Model\UpdateModel $model */
+ $model = $this->getModel('Update');
+
+ $extensionResults = [];
+ $leftover = [];
+ $startTime = microtime(true);
+
+ foreach ($extensionInformation as $information)
+ {
+ // Only process an extension if we have spent less than 5 seconds already
+ $currentTime = microtime(true);
+
+ if ($currentTime - $startTime > 5.0)
+ {
+ $leftover[] = $information;
+
+ continue;
+ }
+
+ // Get the extension information and fetch its compatibility information
+ $extensionID = $information['eid'] ?: '';
+ $extensionVersion = $information['version'] ?: '';
+ $upgradeCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaTargetVersion);
+ $currentCompatibilityStatus = $model->fetchCompatibility($extensionID, $joomlaCurrentVersion);
+ $upgradeUpdateVersion = false;
+ $currentUpdateVersion = false;
+ $upgradeWarning = 0;
+
+ if ($upgradeCompatibilityStatus->state == 1 && !empty($upgradeCompatibilityStatus->compatibleVersions))
+ {
+ $upgradeUpdateVersion = end($upgradeCompatibilityStatus->compatibleVersions);
+ }
+
+ if ($currentCompatibilityStatus->state == 1 && !empty($currentCompatibilityStatus->compatibleVersions))
+ {
+ $currentUpdateVersion = end($currentCompatibilityStatus->compatibleVersions);
+ }
+
+ if ($upgradeUpdateVersion !== false)
+ {
+ $upgradeOldestVersion = $upgradeCompatibilityStatus->compatibleVersions[0];
+
+ if ($currentUpdateVersion !== false)
+ {
+ // If there are updates compatible with both CMS versions use these
+ $bothCompatibleVersions = array_values(
+ array_intersect($upgradeCompatibilityStatus->compatibleVersions, $currentCompatibilityStatus->compatibleVersions)
+ );
+
+ if (!empty($bothCompatibleVersions))
+ {
+ $upgradeOldestVersion = $bothCompatibleVersions[0];
+ $upgradeUpdateVersion = end($bothCompatibleVersions);
+ }
+ }
+
+ if (version_compare($upgradeOldestVersion, $extensionVersion, '>'))
+ {
+ // Installed version is empty or older than the oldest compatible update: Update required
+ $resultGroup = 2;
+ }
+ else
+ {
+ // Current version is compatible
+ $resultGroup = 3;
+ }
+
+ if ($currentUpdateVersion !== false && version_compare($upgradeUpdateVersion, $currentUpdateVersion, '<'))
+ {
+ // Special case warning when version compatible with target is lower than current
+ $upgradeWarning = 2;
+ }
+ }
+ elseif ($currentUpdateVersion !== false)
+ {
+ // No compatible version for target version but there is a compatible version for current version
+ $resultGroup = 1;
+ }
+ else
+ {
+ // No update server available
+ $resultGroup = 1;
+ }
+
+ // Do we need to capture
+ $extensionResults[] = [
+ 'id' => $extensionID,
+ 'upgradeCompatibilityStatus' => (object) [
+ 'state' => $upgradeCompatibilityStatus->state,
+ 'compatibleVersion' => $upgradeUpdateVersion
+ ],
+ 'currentCompatibilityStatus' => (object) [
+ 'state' => $currentCompatibilityStatus->state,
+ 'compatibleVersion' => $currentUpdateVersion
+ ],
+ 'resultGroup' => $resultGroup,
+ 'upgradeWarning' => $upgradeWarning,
+ ];
+ }
+
+ $this->app->mimeType = 'application/json';
+ $this->app->charSet = 'utf-8';
+ $this->app->setHeader('Content-Type', $this->app->mimeType . '; charset=' . $this->app->charSet);
+ $this->app->sendHeaders();
+
+ try
+ {
+ $return = [
+ 'compatibility' => $extensionResults,
+ 'extensions' => $leftover,
+ ];
+
+ echo new JsonResponse($return);
+ }
+ catch (\Exception $e)
+ {
+ echo $e;
+ }
+
+ $this->app->close();
+ }
+
/**
* Fetch and report updates in \JSON format, for AJAX requests
*
diff --git a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
index a4318560674e9..e24e607386d2f 100644
--- a/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
+++ b/administrator/components/com_joomlaupdate/src/View/Joomlaupdate/HtmlView.php
@@ -115,6 +115,22 @@ class HtmlView extends BaseHtmlView
*/
protected $nonCoreCriticalPlugins = [];
+ /**
+ * Should I disable the confirmation checkbox for pre-update extension version checks?
+ *
+ * @var boolean
+ * @since __DEPLOY_VERSION__
+ */
+ protected $noVersionCheck = false;
+
+ /**
+ * Should I disable the confirmation checkbox for taking a backup before updating?
+ *
+ * @var boolean
+ * @since __DEPLOY_VERSION__
+ */
+ protected $noBackupCheck = false;
+
/**
* Renders the view
*
@@ -243,6 +259,9 @@ public function display($tpl = null)
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT');
}
+ $this->noVersionCheck = $params->get('versioncheck', 1) == 0;
+ $this->noBackupCheck = $params->get('backupcheck', 1) == 0;
+
// Remove temporary files
$this->getModel()->removePackageFiles();
diff --git a/administrator/components/com_joomlaupdate/src/View/Upload/HtmlView.php b/administrator/components/com_joomlaupdate/src/View/Upload/HtmlView.php
index 9ffbbfdca3f14..3ca0a5fb4ba25 100644
--- a/administrator/components/com_joomlaupdate/src/View/Upload/HtmlView.php
+++ b/administrator/components/com_joomlaupdate/src/View/Upload/HtmlView.php
@@ -11,6 +11,7 @@
\defined('_JEXEC') or die;
+use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
@@ -50,6 +51,14 @@ class HtmlView extends BaseHtmlView
*/
protected $warnings = [];
+ /**
+ * Should I disable the confirmation checkbox for taking a backup before updating?
+ *
+ * @var boolean
+ * @since __DEPLOY_VERSION__
+ */
+ protected $noBackupCheck = false;
+
/**
* Renders the view.
*
@@ -74,6 +83,9 @@ public function display($tpl = null)
$this->warnings = $this->get('Items', 'warnings');
}
+ $params = ComponentHelper::getParams('com_joomlaupdate');
+ $this->noBackupCheck = $params->get('backupcheck', 1) == 0;
+
$this->addToolbar();
// Render the view.
diff --git a/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php b/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php
index 2961b2d945065..63f5e5d5473f2 100644
--- a/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php
+++ b/administrator/components/com_joomlaupdate/tmpl/joomlaupdate/preupdatecheck.php
@@ -29,6 +29,7 @@
// Text::script doesn't have a sprintf equivalent so work around this
$this->document->addScriptOptions('nonCoreCriticalPlugins', $this->nonCoreCriticalPlugins);
+// Push Joomla! Update client-side error messages
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_CONFIRM_MESSAGE');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_NO_COMPATIBILITY_INFORMATION');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSION_WARNING_UNKNOWN');
@@ -41,6 +42,13 @@
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_POTENTIALLY_DANGEROUS_PLUGIN_CONFIRM_MESSAGE');
Text::script('COM_JOOMLAUPDATE_VIEW_DEFAULT_HELP');
+// Push Joomla! core Joomla.Request error messages
+Text::script('JLIB_JS_AJAX_ERROR_CONNECTION_ABORT');
+Text::script('JLIB_JS_AJAX_ERROR_NO_CONTENT');
+Text::script('JLIB_JS_AJAX_ERROR_OTHER');
+Text::script('JLIB_JS_AJAX_ERROR_PARSE');
+Text::script('JLIB_JS_AJAX_ERROR_TIMEOUT');
+
$compatibilityTypes = array(
'COM_JOOMLAUPDATE_VIEW_DEFAULT_EXTENSIONS_RUNNING_PRE_UPDATE_CHECKS' => array(
'class' => 'info',
@@ -301,7 +309,7 @@
version; ?>
|
-
+ noVersionCheck): ?>
+
- |