Skip to content

Commit

Permalink
Joomla Update extension compatibility improvements
Browse files Browse the repository at this point in the history
Make the confirmation checkboxes optional (controlled by component options)
  • Loading branch information
Nicholas K. Dionysopoulos committed Jan 1, 2022
1 parent 7636321 commit 0c3872c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
22 changes: 22 additions & 0 deletions administrator/components/com_joomlaupdate/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,27 @@
showon="updatesource:custom"
/>

<field
name="noversioncheck"
type="radio"
label="COM_JOOMLAUPDATE_CONFIG_NOVERSIONCHECK_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

<field
name="nobackupcheck"
type="radio"
label="COM_JOOMLAUPDATE_CONFIG_NOBACKUPCHECK_LABEL"
layout="joomla.form.field.radio.switcher"
default="0"
>
<option value="0">JNO</option>
<option value="1">JYES</option>
</field>

</fieldset>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -243,6 +259,9 @@ public function display($tpl = null)
$this->updateSourceKey = Text::_('COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_DEFAULT');
}

$this->noVersionCheck = $params->get('noversioncheck', 0) == 1;
$this->noBackupCheck = $params->get('nobackupcheck', 0) == 1;

// Remove temporary files
$this->getModel()->removePackageFiles();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ class="extension-check upcomp hidden"

<form action="<?php echo Route::_('index.php?option=com_joomlaupdate&layout=update'); ?>" method="post" class="d-flex flex-column mb-5">

<?php if (!$this->noVersionCheck): ?>
<div id="preupdatecheckbox">
<div class="form-check d-flex justify-content-center mb-3">
<input type="checkbox" class="me-3" id="noncoreplugins" name="noncoreplugins" value="1" required />
Expand All @@ -339,8 +340,10 @@ class="extension-check upcomp hidden"
</label>
</div>
</div>
<?php endif; ?>

<button class="btn btn-lg btn-warning disabled submitupdate mx-auto" type="submit" disabled>
<button class="btn btn-lg btn-warning <?php echo $this->noVersionCheck ? '' : 'disabled' ?> submitupdate mx-auto"
type="submit" <?php echo $this->noVersionCheck ? '' : 'disabled' ?>>
<?php echo Text::_('COM_JOOMLAUPDATE_VIEW_DEFAULT_INSTALLUPDATE'); ?>
</button>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@
endif;

// Confirm backup and check
$displayData['content'] .= '<div class="form-check d-flex justify-content-center">
<input class="form-check-input me-2" type="checkbox" value="" id="joomlaupdate-confirm-backup">
$classVisibility = $this->noBackupCheck ? 'd-none' : '';
$checked = $this->noBackupCheck ? 'checked' : '';
$displayData['content'] .= '<div class="form-check d-flex justify-content-center ' . $classVisibility . '">
<input class="form-check-input me-2" type="checkbox" value="" id="joomlaupdate-confirm-backup" ' . $checked . '>
<label class="form-check-label" for="joomlaupdate-confirm-backup">
' . Text::_('COM_JOOMLAUPDATE_UPDATE_CONFIRM_BACKUP') . '
</label>
Expand Down
2 changes: 2 additions & 0 deletions administrator/language/en-GB/com_joomlaupdate.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
COM_JOOMLAUPDATE_CAPTIVE_HEADLINE="Confirm your credentials"
COM_JOOMLAUPDATE_CHECKED_UPDATES="Checked for updates."
COM_JOOMLAUPDATE_CONFIG_CUSTOMURL_LABEL="Custom URL"
COM_JOOMLAUPDATE_CONFIG_NOBACKUPCHECK_LABEL="Disable backup before update confirmation"
COM_JOOMLAUPDATE_CONFIG_NOVERSIONCHECK_LABEL="Disable extension version check confirmation"
COM_JOOMLAUPDATE_CONFIG_SOURCES_DESC="Configure where Joomla gets its update information from."
COM_JOOMLAUPDATE_CONFIG_SOURCES_LABEL="Update Source"
COM_JOOMLAUPDATE_CONFIG_UPDATESOURCE_CUSTOM="Custom URL"
Expand Down

0 comments on commit 0c3872c

Please sign in to comment.