31
0
mirror of https://github.com/joomla-extensions/patchtester.git synced 2024-05-30 20:30:48 +00:00

Fixes to previous commit.

This commit is contained in:
datsepp 2019-09-12 12:58:17 +02:00
parent 26b5399df6
commit 4ffb145b61
9 changed files with 25 additions and 24 deletions

View File

@ -44,12 +44,12 @@ class ResetController extends AbstractController
// Check the applied patches in the database first
$appliedPatches = $pullModel->getPatchesDividedInProcs();
if (count($appliedPatches[0]))
if (count($appliedPatches["git"]))
{
$revertErrored = false;
// Let's try to cleanly revert all applied patches
foreach ($appliedPatches as $patch)
foreach ($appliedPatches["git"] as $patch)
{
try
{
@ -62,16 +62,17 @@ class ResetController extends AbstractController
}
}
if (count($appliedPatches[1]))
if (count($appliedPatches["ci"]))
{
$revertErrored = false;
// Let's try to cleanly revert all applied patches with ci
foreach ($appliedPatches as $patch)
foreach ($appliedPatches["ci"] as $patch)
{
try
{
$pullModel->revertWithCIServer($patch->id);
$pullModel->revertWithCIServer($patch->insert_id);
}
catch (\RuntimeException $e)
{

View File

@ -82,7 +82,6 @@ abstract class Helper
// Set name of the zip archive
$options->set('zip.name', 'build.zip');
$options->set('zip.log.name', 'deleted_files.log');
$options->set('zip.chain.name', 'patch_chain.json');
// Set temp archive for extracting and downloading files
$options->set('folder.temp', Factory::getConfig()->get('tmp_path'));

View File

@ -618,13 +618,13 @@ class PullModel extends AbstractModel
$patchChain = $this->getLastChain();
// Allow only reverts in order of the patch chain
if ($patchChain[0]->insert_id != $id)
if ($patchChain->insert_id != $id)
{
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_NOT_IN_ORDER_OF_PATCHCHAIN', $patchChain[0]->pull_id));
throw new \RuntimeException(Text::sprintf('COM_PATCHTESTER_NOT_IN_ORDER_OF_PATCHCHAIN', $patchChain->pull_id));
}
else
{
$this->removeLastChain($patchChain[0]->insert_id);
$this->removeLastChain($patchChain->insert_id);
}
// We don't want to restore files from an older version
@ -910,14 +910,15 @@ class PullModel extends AbstractModel
$appliedByGit = $db->setQuery(
$db->getQuery(true)
->select('pulls.id, pulls.pull_id')
->from('#__patchtester_chain chain')
->leftJoin('#__patchtester_pulls pulls', 'chain.id != pulls.id')
)->loadObject();
->select('tests.id, tests.pull_id')
->from('#__patchtester_tests tests')
->leftJoin('#__patchtester_chain chain', 'tests.id = chain.insert_id')
->where('chain.insert_id IS NULL')
)->loadObjectList('pull_id');
$appliedByCI = $this->getPatchChain();
return [$appliedByGit, $appliedByCI];
return ["git" => $appliedByGit, "ci" => $appliedByCI];
}
/**

View File

@ -22,7 +22,7 @@ CREATE TABLE IF NOT EXISTS `#__patchtester_tests` (
CREATE TABLE IF NOT EXISTS `#__patchtester_chain` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`insert_id` int(11) NOT NULL
`pull_id` int(11) NOT NULL
`insert_id` int(11) NOT NULL,
`pull_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@ -23,6 +23,6 @@ CREATE TABLE IF NOT EXISTS "#__patchtester_tests" (
CREATE TABLE IF NOT EXISTS "#__patchtester_chain" (
"id" serial NOT NULL,
"insert_id" bigint NOT NULL,
"pull_id" bigint NOT NULL
"pull_id" bigint NOT NULL,
PRIMARY KEY (`id`)
);

View File

@ -28,8 +28,8 @@ CREATE TABLE [#__patchtester_tests](
CREATE TABLE [#__patchtester_chain] (
[id] [bigint] IDENTITY(1,1) NOT NULL,
[insert_id] [bigint] NOT NULL
[pull_id] [bigint] NOT NULL
[insert_id] [bigint] NOT NULL,
[pull_id] [bigint] NOT NULL,
CONSTRAINT [PK_#__patchtester_chain] PRIMARY KEY CLUSTERED
(
[id] ASC

View File

@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS `#__patchtester_chain` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`insert_id` int(11) NOT NULL
`pull_id` int(11) NOT NULL
`insert_id` int(11) NOT NULL,
`pull_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

View File

@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS "#__patchtester_chain" (
"id" serial NOT NULL,
"insert_id" bigint NOT NULL,
"pull_id" bigint NOT NULL
"pull_id" bigint NOT NULL,
PRIMARY KEY (`id`)
);

View File

@ -1,7 +1,7 @@
CREATE TABLE [#__patchtester_chain] (
[id] [bigint] IDENTITY(1,1) NOT NULL,
[insert_id] [bigint] NOT NULL
[pull_id] [bigint] NOT NULL
[insert_id] [bigint] NOT NULL,
[pull_id] [bigint] NOT NULL,
CONSTRAINT [PK_#__patchtester_chain] PRIMARY KEY CLUSTERED
(
[id] ASC