since we dont know from which version the update is being executed we always fix timestamps

This commit is contained in:
thrillfall 2021-10-06 14:53:13 +02:00
parent 414ad1a024
commit 1243a7144a

View File

@ -3,7 +3,6 @@ declare(strict_types=1);
namespace OCA\GPodderSync\Migration; namespace OCA\GPodderSync\Migration;
use OCP\IConfig;
use OCP\IDBConnection; use OCP\IDBConnection;
use OCP\Migration\IOutput; use OCP\Migration\IOutput;
use Safe\DateTime; use Safe\DateTime;
@ -11,12 +10,10 @@ use Safe\DateTime;
class TimestampMigration implements \OCP\Migration\IRepairStep class TimestampMigration implements \OCP\Migration\IRepairStep
{ {
private IDBConnection $db; private IDBConnection $db;
private IConfig $config;
public function __construct(IDBConnection $db, IConfig $config) public function __construct(IDBConnection $db)
{ {
$this->db = $db; $this->db = $db;
$this->config = $config;
} }
/** /**
@ -32,12 +29,6 @@ class TimestampMigration implements \OCP\Migration\IRepairStep
*/ */
public function run(IOutput $output) public function run(IOutput $output)
{ {
$installedVersion = $this->config->getAppValue('gpoddersync', 'installed_version');
if (\version_compare($installedVersion, '2.1.0', '>')) {
return;
}
$queryTimestamps = 'SELECT id, timestamp FROM `*PREFIX*gpodder_episode_action` WHERE timestamp_epoch = 0'; $queryTimestamps = 'SELECT id, timestamp FROM `*PREFIX*gpodder_episode_action` WHERE timestamp_epoch = 0';
$timestamps = $this->db->executeQuery($queryTimestamps)->fetchAll(); $timestamps = $this->db->executeQuery($queryTimestamps)->fetchAll();