From 6dd54198f6fe57de32db3dbadcd068d0e49b1b9d Mon Sep 17 00:00:00 2001 From: Jonathan Flueren <11487762+JonOfUs@users.noreply.github.com> Date: Wed, 13 Oct 2021 16:16:23 +0200 Subject: [PATCH] Store epoch to correct entry, fix uninitialized variable --- lib/Migration/TimestampMigration.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Migration/TimestampMigration.php b/lib/Migration/TimestampMigration.php index 2c3eec9..141744f 100644 --- a/lib/Migration/TimestampMigration.php +++ b/lib/Migration/TimestampMigration.php @@ -32,11 +32,13 @@ class TimestampMigration implements \OCP\Migration\IRepairStep $queryTimestamps = 'SELECT id, timestamp FROM `*PREFIX*gpodder_episode_action` WHERE timestamp_epoch = 0'; $timestamps = $this->db->executeQuery($queryTimestamps)->fetchAll(); + $result = null; + foreach ($timestamps as $timestamp) { $timestampEpoch = (new DateTime($timestamp["timestamp"]))->format("U"); $sql = 'UPDATE `*PREFIX*gpodder_episode_action` ' . 'SET `timestamp_epoch` = ' . $timestampEpoch . ' ' - . 'WHERE `timestamp_epoch` = 0'; + . 'WHERE `id` = ' . $timestamp["id"]; $result = $this->db->executeUpdate($sql);