Skip to content

Commit 1daab57

Browse files
authored
Merge pull request #28318 from nextcloud/bugfix/noid/flow-oracle-allow-null-on-name
Make "name" column nullable for workflows
2 parents 283f394 + 15a62c5 commit 1daab57

File tree

7 files changed

+72
-5
lines changed

7 files changed

+72
-5
lines changed

apps/workflowengine/appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<name>Nextcloud workflow engine</name>
66
<summary>Nextcloud workflow engine</summary>
77
<description>Nextcloud workflow engine</description>
8-
<version>2.4.0</version>
8+
<version>2.4.1</version>
99
<licence>agpl</licence>
1010
<author>Arthur Schiwon</author>
1111
<author>Julius Härtl</author>

apps/workflowengine/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
'OCA\\WorkflowEngine\\Manager' => $baseDir . '/../lib/Manager.php',
3333
'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => $baseDir . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php',
3434
'OCA\\WorkflowEngine\\Migration\\Version2000Date20190808074233' => $baseDir . '/../lib/Migration/Version2000Date20190808074233.php',
35+
'OCA\\WorkflowEngine\\Migration\\Version2200Date20210805101925' => $baseDir . '/../lib/Migration/Version2200Date20210805101925.php',
3536
'OCA\\WorkflowEngine\\Service\\Logger' => $baseDir . '/../lib/Service/Logger.php',
3637
'OCA\\WorkflowEngine\\Service\\RuleMatcher' => $baseDir . '/../lib/Service/RuleMatcher.php',
3738
'OCA\\WorkflowEngine\\Settings\\ASettings' => $baseDir . '/../lib/Settings/ASettings.php',

apps/workflowengine/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ class ComposerStaticInitWorkflowEngine
4747
'OCA\\WorkflowEngine\\Manager' => __DIR__ . '/..' . '/../lib/Manager.php',
4848
'OCA\\WorkflowEngine\\Migration\\PopulateNewlyIntroducedDatabaseFields' => __DIR__ . '/..' . '/../lib/Migration/PopulateNewlyIntroducedDatabaseFields.php',
4949
'OCA\\WorkflowEngine\\Migration\\Version2000Date20190808074233' => __DIR__ . '/..' . '/../lib/Migration/Version2000Date20190808074233.php',
50+
'OCA\\WorkflowEngine\\Migration\\Version2200Date20210805101925' => __DIR__ . '/..' . '/../lib/Migration/Version2200Date20210805101925.php',
5051
'OCA\\WorkflowEngine\\Service\\Logger' => __DIR__ . '/..' . '/../lib/Service/Logger.php',
5152
'OCA\\WorkflowEngine\\Service\\RuleMatcher' => __DIR__ . '/..' . '/../lib/Service/RuleMatcher.php',
5253
'OCA\\WorkflowEngine\\Settings\\ASettings' => __DIR__ . '/..' . '/../lib/Settings/ASettings.php',

apps/workflowengine/lib/Controller/AWorkflowController.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,26 @@
3636
use OCP\AppFramework\OCS\OCSForbiddenException;
3737
use OCP\AppFramework\OCSController;
3838
use OCP\IRequest;
39+
use Psr\Log\LoggerInterface;
3940

4041
abstract class AWorkflowController extends OCSController {
4142

4243
/** @var Manager */
4344
protected $manager;
4445

46+
/** @var LoggerInterface */
47+
private $logger;
48+
4549
public function __construct(
4650
$appName,
4751
IRequest $request,
48-
Manager $manager
52+
Manager $manager,
53+
LoggerInterface $logger
4954
) {
5055
parent::__construct($appName, $request);
5156

5257
$this->manager = $manager;
58+
$this->logger = $logger;
5359
}
5460

5561
/**
@@ -115,6 +121,7 @@ public function create(
115121
} catch (\DomainException $e) {
116122
throw new OCSForbiddenException($e->getMessage(), $e);
117123
} catch (Exception $e) {
124+
$this->logger->error('Error when inserting flow', ['exception' => $e]);
118125
throw new OCSException('An internal error occurred', $e->getCode(), $e);
119126
}
120127
}
@@ -142,6 +149,7 @@ public function update(
142149
} catch (\DomainException $e) {
143150
throw new OCSForbiddenException($e->getMessage(), $e);
144151
} catch (Exception $e) {
152+
$this->logger->error('Error when updating flow with id ' . $id, ['exception' => $e]);
145153
throw new OCSException('An internal error occurred', $e->getCode(), $e);
146154
}
147155
}
@@ -160,6 +168,7 @@ public function destroy(int $id): DataResponse {
160168
} catch (\DomainException $e) {
161169
throw new OCSForbiddenException($e->getMessage(), $e);
162170
} catch (Exception $e) {
171+
$this->logger->error('Error when deleting flow with id ' . $id, ['exception' => $e]);
163172
throw new OCSException('An internal error occurred', $e->getCode(), $e);
164173
}
165174
}

apps/workflowengine/lib/Controller/UserWorkflowsController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use OCP\IRequest;
3636
use OCP\IUserSession;
3737
use OCP\WorkflowEngine\IManager;
38+
use Psr\Log\LoggerInterface;
3839

3940
class UserWorkflowsController extends AWorkflowController {
4041

@@ -48,9 +49,10 @@ public function __construct(
4849
$appName,
4950
IRequest $request,
5051
Manager $manager,
51-
IUserSession $session
52+
IUserSession $session,
53+
LoggerInterface $logger
5254
) {
53-
parent::__construct($appName, $request, $manager);
55+
parent::__construct($appName, $request, $manager, $logger);
5456

5557
$this->session = $session;
5658
}

apps/workflowengine/lib/Migration/Version2000Date20190808074233.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
9191
'default' => '',
9292
]);
9393
$table->addColumn('name', Types::STRING, [
94-
'notnull' => true,
94+
'notnull' => false,
9595
'length' => 256,
9696
'default' => '',
9797
]);
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* @copyright Copyright (c) 2021 Vincent Petry <vincent@nextcloud.com>
7+
*
8+
* @author Vincent Petry <vincent@nextcloud.com>
9+
*
10+
* @license GNU AGPL version 3 or any later version
11+
*
12+
* This program is free software: you can redistribute it and/or modify
13+
* it under the terms of the GNU Affero General Public License as
14+
* published by the Free Software Foundation, either version 3 of the
15+
* License, or (at your option) any later version.
16+
*
17+
* This program is distributed in the hope that it will be useful,
18+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
19+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20+
* GNU Affero General Public License for more details.
21+
*
22+
* You should have received a copy of the GNU Affero General Public License
23+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24+
*
25+
*/
26+
namespace OCA\WorkflowEngine\Migration;
27+
28+
use Closure;
29+
use OCP\DB\ISchemaWrapper;
30+
use OCP\Migration\IOutput;
31+
use OCP\Migration\SimpleMigrationStep;
32+
33+
class Version2200Date20210805101925 extends SimpleMigrationStep {
34+
35+
/**
36+
* @param IOutput $output
37+
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
38+
* @param array $options
39+
* @return null|ISchemaWrapper
40+
*/
41+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
42+
/** @var ISchemaWrapper $schema */
43+
$schema = $schemaClosure();
44+
45+
if ($schema->hasTable('flow_operations')) {
46+
$table = $schema->getTable('flow_operations');
47+
$table->changeColumn('name', [
48+
'notnull' => false,
49+
]);
50+
}
51+
52+
return $schema;
53+
}
54+
}

0 commit comments

Comments
 (0)