mirror of
https://github.com/joomla-extensions/patchtester.git
synced 2025-01-12 09:51:18 +00:00
Fixed resetting the pull requests
Signed-off-by: Roland Dalmulder <contact@rolandd.com>
This commit is contained in:
parent
c1ab5c56ea
commit
568f372f8d
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
namespace PatchTester\Controller;
|
namespace PatchTester\Controller;
|
||||||
|
|
||||||
|
use Joomla\CMS\Component\ComponentHelper;
|
||||||
use Joomla\CMS\Factory;
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\CMS\Filesystem\Folder;
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
use Joomla\CMS\Language\Text;
|
use Joomla\CMS\Language\Text;
|
||||||
@ -45,14 +46,17 @@ class ResetController extends AbstractController
|
|||||||
// Check the applied patches in the database first
|
// Check the applied patches in the database first
|
||||||
$appliedPatches = $testsModel->getAppliedPatches();
|
$appliedPatches = $testsModel->getAppliedPatches();
|
||||||
|
|
||||||
if (is_array($appliedPatches['git']) && count($appliedPatches['git']))
|
$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))
|
||||||
{
|
{
|
||||||
// Let's try to cleanly revert all applied patches
|
// Let's try to cleanly revert all applied patches with ci
|
||||||
foreach ($appliedPatches as $patch)
|
foreach ($appliedPatches as $patch)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$pullModel->revertWithGitHub($patch->id);
|
$pullModel->revertWithCIServer($patch->id);
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e)
|
catch (\RuntimeException $e)
|
||||||
{
|
{
|
||||||
@ -60,15 +64,14 @@ class ResetController extends AbstractController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (is_array($appliedPatches['ci']) && count($appliedPatches['ci']))
|
|
||||||
{
|
{
|
||||||
// Let's try to cleanly revert all applied patches with ci
|
// Let's try to cleanly revert all applied patches
|
||||||
foreach ($appliedPatches['ci'] as $patch)
|
foreach ($appliedPatches as $patch)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$pullModel->revertWithCIServer($patch->insert_id);
|
$pullModel->revertWithGitHub($patch->id);
|
||||||
}
|
}
|
||||||
catch (\RuntimeException $e)
|
catch (\RuntimeException $e)
|
||||||
{
|
{
|
||||||
@ -140,9 +143,9 @@ class ResetController extends AbstractController
|
|||||||
$type = 'notice';
|
$type = 'notice';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $exception)
|
||||||
{
|
{
|
||||||
$msg = $e->getMessage();
|
$msg = $exception->getMessage();
|
||||||
$type = 'error';
|
$type = 'error';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user