From 81f76e4251d08b416cbf153824344a8bb5aa229e Mon Sep 17 00:00:00 2001 From: Sebastian Enns Date: Mon, 23 Sep 2019 15:33:46 +0200 Subject: [PATCH] Added an additional condition to ignore the "apply by ci path" automatically if j3 is used. Fixed a bug where patches could be applied by the old patcher even if there are no files to patch, because they got ignored during parsing. --- .../com_patchtester/PatchTester/Model/PullModel.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php index 4687a97..928e16d 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php @@ -156,7 +156,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 ((bool) $params->get('ci_switch', 1)) + if (version_compare(JVERSION, "4", "ge") && (bool) $params->get('ci_switch', 1)) { return $this->applyWithCIServer($id); } @@ -366,6 +366,11 @@ class PullModel extends AbstractModel $parsedFiles = $this->parseFileList($files); + if (!count($parsedFiles)) + { + return false; + } + foreach ($parsedFiles as $file) { switch ($file->action) @@ -585,7 +590,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 ((bool) $params->get('ci_switch', 1) || $id === $this->getPatchChain($id)->insert_id) + if (version_compare(JVERSION, "4", "ge") && ((bool) $params->get('ci_switch', 1) || $id === $this->getPatchChain($id)->insert_id)) { return $this->revertWithCIServer($id); }