From 702712a62e5fac858d8d88ee50314b872b37c209 Mon Sep 17 00:00:00 2001 From: Roland Dalmulder Date: Sun, 22 Mar 2020 10:41:28 +0100 Subject: [PATCH] Remove Joomla 4 check as this only runs on Joomla 4 Fixes #232 --- .../PatchTester/Model/PullModel.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php index 6451f3a..14ed671 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php @@ -89,7 +89,7 @@ class PullModel extends AbstractModel $params = ComponentHelper::getParams('com_patchtester'); // Decide based on repository settings whether patch will be applied through Github or CIServer - if (version_compare(JVERSION, '4', 'ge') && (bool) $params->get('ci_switch', 1)) + if ((bool) $params->get('ci_switch', 1)) { return $this->applyWithCIServer($id); } @@ -266,7 +266,7 @@ class PullModel extends AbstractModel $this->appendPatchChain($lastInserted, $id); // On Joomla 4 or later, remove the autoloader file - if (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) + if (file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); } @@ -591,7 +591,7 @@ class PullModel extends AbstractModel $this->saveAppliedPatch($pull->number, $parsedFiles, $pull->head->sha); // On Joomla 4 or later, remove the autoloader file - if (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) + if (file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); } @@ -689,9 +689,7 @@ class PullModel extends AbstractModel $params = ComponentHelper::getParams('com_patchtester'); // Decide based on repository settings whether patch will be applied through Github or CIServer - if (version_compare(JVERSION, '4', 'ge') && ((bool) $params->get('ci_switch', 1) - || $id === $this->getPatchChain($id)->insert_id) - ) + if (((bool) $params->get('ci_switch', 1) || $id === $this->getPatchChain($id)->insert_id)) { return $this->revertWithCIServer($id); } @@ -832,8 +830,8 @@ class PullModel extends AbstractModel Folder::delete($backupsPath); - // On Joomla 4 or later, remove the autoloader file - if (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) + // Remove the autoloader file + if (file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); } @@ -1029,8 +1027,8 @@ class PullModel extends AbstractModel } } - // On Joomla 4 or later, remove the autoloader file - if (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) + // Remove the autoloader file + if (file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); }