Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update info.xml to support Nextcloud 30 #179

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- main
- 'ci-*'
- "ci-*"

env:
APP_NAME: gpoddersync
Expand All @@ -18,9 +18,9 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.1', '8.2']
databases: ['sqlite']
server-versions: ['stable27', 'stable28', 'stable29']
php-versions: ["8.1", "8.2"]
databases: ["sqlite"]
server-versions: ["stable27", "stable28", "stable29", "stable30"]

name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}

Expand Down Expand Up @@ -75,9 +75,9 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.1', '8.2']
databases: ['mysql']
server-versions: ['stable27', 'stable28', 'stable29']
php-versions: ["8.1", "8.2"]
databases: ["mysql"]
server-versions: ["stable27", "stable28", "stable29", "stable30"]

name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}

Expand Down Expand Up @@ -141,9 +141,9 @@ jobs:
# do not stop on another job's failure
fail-fast: false
matrix:
php-versions: ['8.1', '8.2']
databases: ['pgsql']
server-versions: ['stable27', 'stable28', 'stable29']
php-versions: ["8.1", "8.2"]
databases: ["pgsql"]
server-versions: ["stable27", "stable28", "stable29", "stable30"]

name: php${{ matrix.php-versions }}-${{ matrix.databases }}-${{ matrix.server-versions }}

Expand Down
2 changes: 1 addition & 1 deletion appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</documentation>
<dependencies>
<php min-version="8.1"/>
<nextcloud min-version="27" max-version="29"/>
<nextcloud min-version="27" max-version="30"/>
</dependencies>
<repair-steps>
<post-migration>
Expand Down
55 changes: 30 additions & 25 deletions lib/Migration/TimestampMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@

use OCP\IDBConnection;
use OCP\Migration\IOutput;
use Safe\DateTime;
use DateTime;

class TimestampMigration implements \OCP\Migration\IRepairStep
{
private IDBConnection $db;
private IDBConnection $db;

public function __construct(IDBConnection $db)
{
$this->db = $db;
}
public function __construct(IDBConnection $db)
{
$this->db = $db;
}

/**
/**
* @inheritDoc
*/
public function getName() : string
public function getName(): string
{
return "Migrate timestamp values to integer to store unix epoch";
}
Expand All @@ -29,22 +29,27 @@ public function getName() : string
*/
public function run(IOutput $output)
{
$queryTimestamps = 'SELECT id, timestamp FROM `*PREFIX*gpodder_episode_action` WHERE timestamp_epoch = 0';
$timestamps = $this->db->executeQuery($queryTimestamps)->fetchAll();

$result = 0;

foreach ($timestamps as $timestamp) {
$timestampEpoch = (new DateTime($timestamp["timestamp"]))->format("U");
$sql = 'UPDATE `*PREFIX*gpodder_episode_action` '
. 'SET `timestamp_epoch` = ' . $timestampEpoch . ' '
. 'WHERE `id` = ' . $timestamp["id"];

$result += $this->db->executeUpdate($sql);

}

return $result;
$queryTimestamps =
"SELECT id, timestamp FROM `*PREFIX*gpodder_episode_action` WHERE timestamp_epoch = 0";
$timestamps = $this->db->executeQuery($queryTimestamps)->fetchAll();

$result = 0;

foreach ($timestamps as $timestamp) {
$timestampEpoch = (new DateTime($timestamp["timestamp"]))->format(
"U"
);
$sql =
"UPDATE `*PREFIX*gpodder_episode_action` " .
"SET `timestamp_epoch` = " .
$timestampEpoch .
" " .
"WHERE `id` = " .
$timestamp["id"];

$result += $this->db->executeUpdate($sql);
}

return $result;
}

}