Skip to content

Commit

Permalink
[BUGFIX] Check for exceptions instead of number of affected rows
Browse files Browse the repository at this point in the history
Saving a scheduler task without any changes leads to 0 affected
rows which must not be interpreted as an error.

Resolves: #85366
Releases: master, 8.7
Change-Id: I474e16478cb09ad4940aaab5fe1d3eb21498c4c4
Reviewed-on: https://review.typo3.org/57491
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
  • Loading branch information
georgringer authored and maddy2101 committed Jul 6, 2018
1 parent ab410c5 commit 085662b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions typo3/sysext/scheduler/Classes/Scheduler.php
Expand Up @@ -249,6 +249,7 @@ public function removeTask(Task\AbstractTask $task)
*/
public function saveTask(Task\AbstractTask $task)
{
$result = true;
$taskUid = $task->getTaskUid();
if (!empty($taskUid)) {
try {
Expand All @@ -270,14 +271,18 @@ public function saveTask(Task\AbstractTask $task)
'task_group' => $task->getTaskGroup(),
'serialized_task_object' => serialize($task)
];
$result = GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_scheduler_task')
->update(
'tx_scheduler_task',
$fields,
['uid' => $taskUid],
['serialized_task_object' => Connection::PARAM_LOB]
);
try {
GeneralUtility::makeInstance(ConnectionPool::class)
->getConnectionForTable('tx_scheduler_task')
->update(
'tx_scheduler_task',
$fields,
['uid' => $taskUid],
['serialized_task_object' => Connection::PARAM_LOB]
);
} catch (\Doctrine\DBAL\DBALException $e) {
$result = false;
}
} else {
$result = false;
}
Expand Down

0 comments on commit 085662b

Please sign in to comment.