Skip to content

Commit

Permalink
Merge pull request #324 from infograf768/min_version
Browse files Browse the repository at this point in the history
Raise minimum version to 3.8.0 part2
  • Loading branch information
infograf768 authored Dec 27, 2017
2 parents ff89c58 + cc76fce commit 24245fc
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 13 deletions.
2 changes: 1 addition & 1 deletion component/admin/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
name="gh_branch"
type="text"
class="ltr"
default="master"
default="staging"
label="COM_LOCALISE_LABEL_GITHUB_BRANCH"
description="COM_LOCALISE_LABEL_GITHUB_BRANCH_DESC" />
<field
Expand Down
1 change: 1 addition & 0 deletions component/admin/language/en-GB/en-GB.com_localise.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ COM_LOCALISE_ACCESS_DELETE="Delete"
COM_LOCALISE_ACCESS_DELETE_DESC="Delete description"
COM_LOCALISE_ACCESS_EDIT="Edit"
COM_LOCALISE_ACCESS_EDIT_DESC="Edit description"
COM_LOCALISE_ERROR_INSTALL_JVERSION="The Localise component requires version %s or newer of Joomla!"
COM_LOCALISE_FIELDSET_FTP="FTP"
COM_LOCALISE_FIELDSET_FTP_DESC="For modifying files, Joomla! will most likely need your FTP account details. Please enter them in the form fields below."
COM_LOCALISE_HEADER_MANAGER="Localisation Manager: %s"
Expand Down
23 changes: 14 additions & 9 deletions component/admin/models/fields/releases.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,30 @@ protected function getOptions()
$gh_project . '/releases'
);

// Allowed tricks.
// Configured to 0 the 2.5.x series are not allowed. Configured to 1 it is allowed.
$allow_25x = 1;

foreach ($releases as $release)
{
$tag_name = $release->tag_name;
$tag_part = explode(".", $tag_name);
$undoted = str_replace('.', '', $tag_name);
$excluded = 0;

if ($tag_part[0] == '2' && $allow_25x == '0')
if (version_compare(JVERSION, '3', 'ge'))
{
$excluded = 1;
if ($tag_part[0] != '3')
{
$excluded = 1;
}
}
elseif ($tag_part[0] != '3' && $tag_part[0] != '2')
elseif (version_compare(JVERSION, '4', 'ge'))
{
// Exclude platforms or similar stuff.
$excluded = 1;
if ($tag_part[0] == '4' || $tag_part[0] == '3')
{
$excluded = 0;
}
else
{
$excluded = 1;
}
}

// Filtering by "is_numeric" disable betas or similar releases.
Expand Down
9 changes: 9 additions & 0 deletions component/admin/views/languages/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class LocaliseViewLanguages extends JViewLegacy

protected $form;

protected $minCmsVersion = '3.8';

/**
* Display the view
*
Expand All @@ -42,6 +44,13 @@ public function display($tpl = null)
$this->state = $this->get('State');
$this->form = $this->get('Form');

if (version_compare(JVERSION, $this->minCmsVersion, 'lt'))
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_LOCALISE_ERROR_INSTALL_JVERSION', $this->minCmsVersion), 'warning');

return false;
}

LocaliseHelper::addSubmenu('languages');

// Check for errors.
Expand Down
9 changes: 9 additions & 0 deletions component/admin/views/packages/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class LocaliseViewPackages extends JViewLegacy

protected $state;

protected $minCmsVersion = '3.8';

/**
* Display the view
*
Expand All @@ -44,6 +46,13 @@ public function display($tpl = null)
$this->form = $this->get('Form');
$this->file = $app->input->get('file');

if (version_compare(JVERSION, $this->minCmsVersion, 'lt'))
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_LOCALISE_ERROR_INSTALL_JVERSION', $this->minCmsVersion), 'warning');

return false;
}

LocaliseHelper::addSubmenu('packages');

// Check for errors.
Expand Down
9 changes: 9 additions & 0 deletions component/admin/views/translations/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class LocaliseViewTranslations extends JViewLegacy

protected $state;

protected $minCmsVersion = '3.8';

/**
* Display the view
*
Expand All @@ -45,6 +47,13 @@ public function display($tpl = null)
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');

if (version_compare(JVERSION, $this->minCmsVersion, 'lt'))
{
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_LOCALISE_ERROR_INSTALL_JVERSION', $this->minCmsVersion), 'warning');

return false;
}

LocaliseHelper::addSubmenu('translations');

// Check for errors.
Expand Down
6 changes: 3 additions & 3 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ class Com_LocaliseInstallerScript extends JInstallerScript
* The extension name. This should be set in the installer script.
*
* @var string
* @since 4.0.31
* @since 4.0.32
*/
protected $extension = 'com_localise';
/**
* Minimum PHP version required to install the extension
*
* @var string
* @since 4.0.31
* @since 4.0.32
*/
protected $minimumPhp = '5.3.10';
/**
* Minimum Joomla! version required to install the extension
*
* @var string
* @since 4.0.31
* @since 4.0.32
*/
protected $minimumJoomla = '3.8.0';
}

0 comments on commit 24245fc

Please sign in to comment.