Skip to content

Commit 2ab99ff

Browse files
authored
Merge pull request #209 from os2display/release/2.0.6
Release 2.0.6
2 parents 7ca858a + 27ac22d commit 2ab99ff

File tree

8 files changed

+44
-10
lines changed

8 files changed

+44
-10
lines changed

.github/workflows/php_upgrade.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,12 @@ jobs:
6363
MYSQL_PASSWORD: db
6464
MYSQL_DATABASE: db_test
6565
MYSQL_ROOT_PASSWORD: password
66-
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
66+
# https://mariadb.org/mariadb-server-docker-official-images-healthcheck-without-mysqladmin/
67+
options: >-
68+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
69+
--health-interval=5s
70+
--health-timeout=2s
71+
--health-retries=3
6772
strategy:
6873
fail-fast: false
6974
matrix:

.github/workflows/pr.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,12 @@ jobs:
221221
MYSQL_PASSWORD: db
222222
MYSQL_DATABASE: db_test
223223
MYSQL_ROOT_PASSWORD: password
224-
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
224+
# https://mariadb.org/mariadb-server-docker-official-images-healthcheck-without-mysqladmin/
225+
options: >-
226+
--health-cmd="healthcheck.sh --connect --innodb_initialized"
227+
--health-interval=5s
228+
--health-timeout=2s
229+
--health-retries=3
225230
strategy:
226231
fail-fast: false
227232
matrix:

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
44

55
## [Unreleased]
66

7+
## [2.0.6] - 2024-06-28
8+
9+
- [#208](https://github.com/os2display/display-api-service/pull/208)
10+
- Removed feed items from Notified where image returns 403.
11+
- Fixed phpunit github actions healthcheck for mariadb.
12+
- [#207](https://github.com/os2display/display-api-service/pull/207)
13+
- Fixed parameter not set error in (os2display) api container.
14+
715
## [2.0.5] - 2024-05-21
816

917
- [#206](https://github.com/os2display/display-api-service/pull/206)

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
"vendor/bin/phpunit --stop-on-failure"
139139
],
140140
"test-setup": [
141-
"bin/console cache:clear --env=test --no-debug",
141+
"bin/console --env=test cache:clear --no-debug",
142142
"bin/console --env=test doctrine:database:drop --if-exists --force --quiet",
143143
"bin/console --env=test doctrine:database:create --no-interaction --if-not-exists --quiet",
144144
"bin/console --env=test doctrine:migrations:migrate --no-interaction --quiet"

infrastructure/os2display/display-api-service/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,4 +151,5 @@ RUN chmod +x /usr/local/bin/docker-entrypoint.sh
151151

152152
WORKDIR ${APP_PATH}
153153

154-
CMD [ "docker-entrypoint.sh" ]
154+
CMD ["php-fpm"]
155+
ENTRYPOINT [ "docker-entrypoint.sh" ]

infrastructure/os2display/display-api-service/docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ if [ "${1#-}" != "$1" ]; then
1717
fi
1818

1919
## Start the PHP FPM process.
20-
echo "Starting PHP 8.2 FPM"
20+
echo "Starting PHP 8.3 FPM"
2121

22-
exec php-fpm "$@"
22+
exec "$@"

src/Feed/NotifiedFeedType.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,23 @@ public function getData(Feed $feed): array
4848

4949
$token = $secrets['token'];
5050

51-
$data = $this->getMentions($token, $pageSize, $configuration['feeds']);
51+
$data = $this->getMentions($token, 1, $pageSize, $configuration['feeds']);
5252

53-
return array_map(fn (array $item) => $this->getFeedItemObject($item), $data);
53+
$feedItems = array_map(fn (array $item) => $this->getFeedItemObject($item), $data);
54+
55+
$result = [];
56+
57+
// Check that image is accessible, otherwise leave out the feed element.
58+
foreach ($feedItems as $feedItem) {
59+
$response = $this->client->request(Request::METHOD_HEAD, $feedItem['mediaUrl']);
60+
$statusCode = $response->getStatusCode();
61+
62+
if (200 == $statusCode) {
63+
$result[] = $feedItem;
64+
}
65+
}
66+
67+
return $result;
5468
} catch (\Throwable $throwable) {
5569
$this->logger->error('{code}: {message}', [
5670
'code' => $throwable->getCode(),
@@ -115,11 +129,11 @@ public function getConfigOptions(Request $request, FeedSource $feedSource, strin
115129
return null;
116130
}
117131

118-
public function getMentions(string $token, int $pageSize = 10, array $searchProfileIds = []): array
132+
public function getMentions(string $token, int $page = 1, int $pageSize = 10, array $searchProfileIds = []): array
119133
{
120134
$body = [
135+
'page' => $page,
121136
'pageSize' => $pageSize,
122-
'page' => 1,
123137
'searchProfileIds' => $searchProfileIds,
124138
];
125139

tests/Feed/NotifiedFeedTypeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ public function testGetFeed(): void
4848
$response->method('toArray')->willReturn(
4949
NotifiedFeedTypeData::getData()
5050
);
51+
$response->method('getStatusCode')->willReturn(200);
5152

5253
$httpClientMock->method('request')->willReturn($response);
5354

0 commit comments

Comments
 (0)