From 10f3e5766cffbd851b139287d02ad01610d0bab0 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 21 Mar 2020 16:22:11 +0100 Subject: [PATCH 1/2] Delete libraries/autoload_psr4.php Delete libraries/autoload_psr4.php when applying or reverting patches on Joomla 4 and later. --- .../PatchTester/Model/PullModel.php | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php index 69bcd6f..757f093 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php @@ -337,6 +337,12 @@ class PullModel extends AbstractModel // Write or create patch chain for correct order of patching $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')) + { + File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); + } + // Change the media version $version = new Version; $version->refreshMediaVersion(); @@ -506,6 +512,12 @@ 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')) + { + File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); + } + // Change the media version $version = new Version; $version->refreshMediaVersion(); @@ -713,6 +725,12 @@ 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')) + { + File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); + } + // Change the media version $version = new Version; $version->refreshMediaVersion(); @@ -822,6 +840,12 @@ 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')) + { + File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); + } + // Change the media version $version = new Version; $version->refreshMediaVersion(); From 98b69ee49c5c8fddacb02559b6efed2108a8bc47 Mon Sep 17 00:00:00 2001 From: Richard Fath Date: Sat, 21 Mar 2020 16:34:25 +0100 Subject: [PATCH 2/2] Fix silly typo causing syntax error --- .../com_patchtester/PatchTester/Model/PullModel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php index 757f093..cfe8645 100644 --- a/administrator/components/com_patchtester/PatchTester/Model/PullModel.php +++ b/administrator/components/com_patchtester/PatchTester/Model/PullModel.php @@ -338,7 +338,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 (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); } @@ -513,7 +513,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 (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); } @@ -726,7 +726,7 @@ 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')) + if (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); } @@ -841,7 +841,7 @@ 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')) + if (version_compare(JVERSION, '4', 'ge') && file_exists(JPATH_LIBRARIES . '/autoload_psr4.php')) { File::delete(JPATH_LIBRARIES . '/autoload_psr4.php'); }