diff --git a/installation/src/Model/ChecksModel.php b/installation/src/Model/ChecksModel.php index 5f09dac2e1d24..ae820e727cf50 100644 --- a/installation/src/Model/ChecksModel.php +++ b/installation/src/Model/ChecksModel.php @@ -10,6 +10,7 @@ namespace Joomla\CMS\Installation\Model; +use Joomla\CMS\Component\ComponentHelper; use Joomla\CMS\Factory; use Joomla\CMS\Form\Form; use Joomla\CMS\Language\Text; @@ -253,4 +254,18 @@ public function getForm($view = null) return $form; } + + /** + * Check if auto updates are disabled + * + * @return boolean + * + * @since __DEPLOY_VERSION__ + */ + public function getAutoUpdatesDisabled(): bool + { + $updates = ComponentHelper::getParams('com_joomlaupdate'); + + return !$updates->get('autoupdate', 0) && !$updates->get('autoupdate_status', 0); + } } diff --git a/installation/src/View/Remove/HtmlView.php b/installation/src/View/Remove/HtmlView.php index 705caad32a5de..0c062f2b1035c 100644 --- a/installation/src/View/Remove/HtmlView.php +++ b/installation/src/View/Remove/HtmlView.php @@ -66,6 +66,14 @@ class HtmlView extends BaseHtmlView */ protected $installed_languages; + /** + * If updates are disabled, we hide the box + * + * @var boolean + * @since __DEPLOY_VERSION__ + */ + protected $autoUpdatesDisabled = false; + /** * Execute and display a template script. * @@ -92,6 +100,8 @@ public function display($tpl = null) $this->phpoptions = $checksModel->getPhpOptions(); $this->phpsettings = $checksModel->getPhpSettings(); + $this->autoUpdatesDisabled = $checksModel->getAutoUpdatesDisabled(); + parent::display($tpl); } } diff --git a/installation/template/js/remove.js b/installation/template/js/remove.js index c430c7e7f7268..3e72ecec592e1 100644 --- a/installation/template/js/remove.js +++ b/installation/template/js/remove.js @@ -10,6 +10,7 @@ if (document.getElementById('installAddFeatures')) { document.getElementById('installAddFeatures').addEventListener('click', function(e) { e.preventDefault(); document.getElementById('installLanguages').classList.add('active'); + document.getElementById('automatedUpdates')?.classList?.remove('active'); document.getElementById('installCongrat').classList.remove('active'); document.getElementById('installFinal').classList.remove('active'); document.getElementById('installRecommended').classList.remove('active'); @@ -19,6 +20,7 @@ if (document.getElementById('installAddFeatures')) { if (document.getElementById('skipLanguages')) { document.getElementById('skipLanguages').addEventListener('click', function(e) { e.preventDefault(); + document.getElementById('automatedUpdates')?.classList?.add('active'); document.getElementById('installCongrat').classList.add('active'); document.getElementById('installFinal').classList.add('active'); document.getElementById('installRecommended').classList.add('active'); @@ -165,12 +167,19 @@ if (document.getElementById('installLanguagesButton')) { document.getElementById('installLanguagesButton').addEventListener('click', function(e) { e.preventDefault(); var form = document.getElementById('languagesForm'); - if (form) { + if (form) { + Joomla.removeMessages(); + document.body.appendChild(document.createElement('joomla-core-loader')); + // Install the extra languages - if (Joomla.install(['languages'], form)) { - document.getElementById('installLanguages').classList.remove('active'); - document.getElementById('installFinal').classList.add('active'); - } + try { + Joomla.install(['languages'], form, true); + } catch (err) { + const loader = document.querySelector('joomla-core-loader'); + if (loader) { + loader.remove(); + } + } } }) } diff --git a/installation/template/js/template.js b/installation/template/js/template.js index 568c45909ae9e..a8caefc4b2934 100644 --- a/installation/template/js/template.js +++ b/installation/template/js/template.js @@ -153,7 +153,7 @@ * * @param tasks An array of install tasks to execute */ - Joomla.install = function(tasks, form) { + Joomla.install = function(tasks, form, fromSubmit) { const progress = document.getElementById('progressbar'); const progress_text = document.getElementById('progress-text'); if (!form) { @@ -163,7 +163,7 @@ if (progress_text) { progress_text.innerText = Joomla.Text._('INSTL_FINISHED'); } - setTimeout(Joomla.goToPage, 2000, 'remove'); + setTimeout(Joomla.goToPage, 2000, 'remove', fromSubmit); return; } @@ -226,7 +226,7 @@ progress.setAttribute('value', parseInt(progress.getAttribute('value')) + 1); progress_text.innerText = Joomla.Text._('INSTL_IN_PROGRESS'); } - Joomla.install(tasks, form); + Joomla.install(tasks, form, fromSubmit); }, onError: function(xhr){ if (progress_text) { diff --git a/installation/tmpl/remove/default.php b/installation/tmpl/remove/default.php index cb7ddd493efa4..99ff60cc1d3a3 100644 --- a/installation/tmpl/remove/default.php +++ b/installation/tmpl/remove/default.php @@ -139,6 +139,7 @@ class="form-check-input" + autoUpdatesDisabled)) : ?>
@@ -151,6 +152,7 @@ class="form-check-input"
+