mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2025-01-25 16:18:26 +00:00
Modify how environmental errors are rendered
This commit is contained in:
parent
7f7e445722
commit
435f8d1430
@ -40,6 +40,10 @@ COM_PATCHTESTER_PURGE_NA="No cache files to remove."
|
|||||||
COM_PATCHTESTER_PURGE_SUCCESS="Purge operation completed successfully, %s files removed."
|
COM_PATCHTESTER_PURGE_SUCCESS="Purge operation completed successfully, %s files removed."
|
||||||
COM_PATCHTESTER_PURGE_SUCCESS_1="Purge operation completed successfully, %s file removed."
|
COM_PATCHTESTER_PURGE_SUCCESS_1="Purge operation completed successfully, %s file removed."
|
||||||
COM_PATCHTESTER_REPO_IS_GONE="The patch could not be applied because the repository is missing"
|
COM_PATCHTESTER_REPO_IS_GONE="The patch could not be applied because the repository is missing"
|
||||||
|
COM_PATCHTESTER_REQUIREMENT_HTTPS="HTTPS wrappers must be enabled"
|
||||||
|
COM_PATCHTESTER_REQUIREMENT_OPENSSL="The OpenSSL extension must be installed and enabled in your php.ini"
|
||||||
|
COM_PATCHTESTER_REQUIREMENTS_HEADING="Requirements Not Met"
|
||||||
|
COM_PATCHTESTER_REQUIREMENTS_NOT_MET="Your system does not meet the requirements to run the Patch Tester extension:"
|
||||||
COM_PATCHTESTER_REVERT_OK="Patch successfully reverted"
|
COM_PATCHTESTER_REVERT_OK="Patch successfully reverted"
|
||||||
COM_PATCHTESTER_REVERT_PATCH="Revert Patch"
|
COM_PATCHTESTER_REVERT_PATCH="Revert Patch"
|
||||||
COM_PATCHTESTER_SEARCH_IN_PULL_ID="Pull ID"
|
COM_PATCHTESTER_SEARCH_IN_PULL_ID="Pull ID"
|
||||||
|
@ -8,12 +8,17 @@
|
|||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/** @type PatchtesterViewPulls $this */
|
||||||
|
|
||||||
JHtml::_('behavior.tooltip');
|
JHtml::_('behavior.tooltip');
|
||||||
JHtml::_('behavior.modal');
|
JHtml::_('behavior.modal');
|
||||||
|
|
||||||
$listOrder = $this->escape($this->state->get('list.ordering'));
|
$listOrder = $this->escape($this->state->get('list.ordering'));
|
||||||
$listDirn = $this->escape($this->state->get('list.direction'));
|
$listDirn = $this->escape($this->state->get('list.direction'));
|
||||||
|
|
||||||
|
if (count($this->envErrors)) :
|
||||||
|
$this->loadTemplate('errors');
|
||||||
|
else :
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var submitpatch = function (task, id) {
|
var submitpatch = function (task, id) {
|
||||||
@ -83,3 +88,4 @@ $listDirn = $this->escape($this->state->get('list.direction'));
|
|||||||
<?php echo JHtml::_('form.token'); ?>
|
<?php echo JHtml::_('form.token'); ?>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<?php endif;
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package PatchTester
|
||||||
|
*
|
||||||
|
* @copyright Copyright (C) 2011 - 2012 Ian MacLennan, Copyright (C) 2013 - 2014 Open Source Matters, Inc. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/** @type PatchtesterViewPulls $this */
|
||||||
|
?>
|
||||||
|
<h3><?php echo JText::_('COM_PATCHTESTER_REQUIREMENTS_HEADING'); ?></h3>
|
||||||
|
<p><?php echo JText::_('COM_PATCHTESTER_REQUIREMENTS_NOT_MET'); ?></p>
|
||||||
|
<ul>
|
||||||
|
<?php foreach ($this->envErrors as $error) : ?>
|
||||||
|
<li><?php echo $error; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
@ -8,6 +8,8 @@
|
|||||||
|
|
||||||
defined('_JEXEC') or die;
|
defined('_JEXEC') or die;
|
||||||
|
|
||||||
|
/** @type PatchtesterViewPulls $this */
|
||||||
|
|
||||||
foreach ($this->items as $i => $item) :
|
foreach ($this->items as $i => $item) :
|
||||||
$status = '';
|
$status = '';
|
||||||
|
|
||||||
|
@ -16,6 +16,14 @@ defined('_JEXEC') or die;
|
|||||||
*/
|
*/
|
||||||
class PatchtesterViewPulls extends JViewLegacy
|
class PatchtesterViewPulls extends JViewLegacy
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Array containing environment errors
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 2.0
|
||||||
|
*/
|
||||||
|
protected $envErrors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array of open pull requests
|
* Array of open pull requests
|
||||||
*
|
*
|
||||||
@ -55,38 +63,23 @@ class PatchtesterViewPulls extends JViewLegacy
|
|||||||
*
|
*
|
||||||
* @return mixed A string if successful, otherwise a Error object.
|
* @return mixed A string if successful, otherwise a Error object.
|
||||||
*
|
*
|
||||||
* @see fetch()
|
|
||||||
* @since 1.0
|
* @since 1.0
|
||||||
*/
|
*/
|
||||||
public function display($tpl = null)
|
public function display($tpl = null)
|
||||||
{
|
{
|
||||||
// TODO: move the check
|
|
||||||
$checkErrs = array();
|
|
||||||
|
|
||||||
if (!extension_loaded('openssl'))
|
if (!extension_loaded('openssl'))
|
||||||
{
|
{
|
||||||
$checkErrs[] = 'The OpenSSL extension must be installed and enabled in your php.ini';
|
$this->envErrors[] = JText::_('COM_PATCHTESTER_REQUIREMENT_OPENSSL');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array('https', stream_get_wrappers()))
|
if (!in_array('https', stream_get_wrappers()))
|
||||||
{
|
{
|
||||||
$checkErrs[] = 'https wrappers must be enabled';
|
$this->envErrors[] = JText::_('COM_PATCHTESTER_REQUIREMENT_HTTPS');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($checkErrs))
|
// Only process the data if there are no environment errors
|
||||||
|
if (!count($this->envErrors))
|
||||||
{
|
{
|
||||||
$application = JFactory::getApplication();
|
|
||||||
|
|
||||||
$application->enqueueMessage('Your system does not meet the requirements to run the PullTester extension:', 'error');
|
|
||||||
|
|
||||||
foreach ($checkErrs as $error)
|
|
||||||
{
|
|
||||||
$application->enqueueMessage($error, 'error');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->state = $this->get('State');
|
$this->state = $this->get('State');
|
||||||
$this->items = $this->get('Items');
|
$this->items = $this->get('Items');
|
||||||
$this->patches = $this->get('AppliedPatches');
|
$this->patches = $this->get('AppliedPatches');
|
||||||
@ -101,6 +94,7 @@ class PatchtesterViewPulls extends JViewLegacy
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->addToolbar();
|
$this->addToolbar();
|
||||||
|
|
||||||
@ -117,7 +111,12 @@ class PatchtesterViewPulls extends JViewLegacy
|
|||||||
protected function addToolbar()
|
protected function addToolbar()
|
||||||
{
|
{
|
||||||
JToolBarHelper::title(JText::_('COM_PATCHTESTER'), 'patchtester');
|
JToolBarHelper::title(JText::_('COM_PATCHTESTER'), 'patchtester');
|
||||||
|
|
||||||
|
if (!count($this->envErrors))
|
||||||
|
{
|
||||||
JToolbarHelper::custom('purge', 'delete.png', 'delete_f2.png', 'COM_PATCHTESTER_PURGE_CACHE', false);
|
JToolbarHelper::custom('purge', 'delete.png', 'delete_f2.png', 'COM_PATCHTESTER_PURGE_CACHE', false);
|
||||||
|
}
|
||||||
|
|
||||||
JToolBarHelper::preferences('com_patchtester');
|
JToolBarHelper::preferences('com_patchtester');
|
||||||
|
|
||||||
JFactory::getDocument()->addStyleDeclaration(
|
JFactory::getDocument()->addStyleDeclaration(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user