Skip to content

Commit

Permalink
fix: import of translations for cronjobs was missing (#321)
Browse files Browse the repository at this point in the history
refactor: retrieval of webroot path
chore: add sqlite to docker image
  • Loading branch information
ellite authored May 13, 2024
1 parent 46f933a commit a524419
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 24 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /var/www/html

# Update packages and install dependencies
RUN apk upgrade --no-cache && \
apk add --no-cache sqlite-dev libpng libpng-dev libjpeg-turbo libjpeg-turbo-dev freetype freetype-dev curl autoconf libgomp icu-dev nginx dcron tzdata imagemagick imagemagick-dev libzip-dev && \
apk add --no-cache sqlite-dev libpng libpng-dev libjpeg-turbo libjpeg-turbo-dev freetype freetype-dev curl autoconf libgomp icu-dev nginx dcron tzdata imagemagick imagemagick-dev libzip-dev sqlite && \
docker-php-ext-install pdo pdo_sqlite && \
docker-php-ext-enable pdo pdo_sqlite && \
docker-php-ext-configure gd --with-freetype --with-jpeg && \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ See instructions to run Wallos below.
0 9 * * * php /var/www/html/endpoints/cronjobs/sendnotifications.php >> /var/log/cron/sendnotifications.log 2>&1
```

5. If your web root is not `/var/www/html/` adjust both the cronjobs above and `/endpoints/cronjobs/conf.php` accordingly.
5. If your web root is not `/var/www/html/` adjust the cronjobs above accordingly.

#### Updating

Expand Down
6 changes: 0 additions & 6 deletions endpoints/cronjobs/conf.php

This file was deleted.

5 changes: 1 addition & 4 deletions endpoints/cronjobs/createdatabase.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

require_once 'conf.php';

$databaseFile = $webPath . 'db/wallos.db';
$databaseFile = __DIR__ . '/../../db/wallos.db';

if (!file_exists($databaseFile)) {
echo "Database does not exist. Creating it...\n";
Expand Down Expand Up @@ -234,7 +232,6 @@
} else {
echo "Database already exist. Checking for upgrades...\n";

$databaseFile = $webPath . 'db/wallos.db';
$db = new SQLite3($databaseFile);
$db->busyTimeout(5000);

Expand Down
9 changes: 4 additions & 5 deletions endpoints/cronjobs/sendnotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require_once 'conf.php';
require_once $webPath . 'includes/connect_endpoint_crontabs.php';
require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php';

$days = 1;
$emailNotificationsEnabled = false;
Expand Down Expand Up @@ -152,9 +151,9 @@

// Email notifications if enabled
if ($emailNotificationsEnabled) {
require $webPath . 'libs/PHPMailer/PHPMailer.php';
require $webPath . 'libs/PHPMailer/SMTP.php';
require $webPath . 'libs/PHPMailer/Exception.php';
require __DIR__ . '/../../libs/PHPMailer/PHPMailer.php';
require __DIR__ . '/../../libs/PHPMailer/SMTP.php';
require __DIR__ . '/../../libs/PHPMailer/Exception.php';

$stmt = $db->prepare('SELECT * FROM user WHERE id = :id');
$stmt->bindValue(':id', 1, SQLITE3_INTEGER);
Expand Down
3 changes: 1 addition & 2 deletions endpoints/cronjobs/updateexchange.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
require_once 'conf.php';
require_once $webPath . 'includes/connect_endpoint_crontabs.php';
require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php';

$query = "SELECT api_key FROM fixer";
$result = $db->query($query);
Expand Down
4 changes: 2 additions & 2 deletions endpoints/cronjobs/updatenextpayment.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require_once 'conf.php';
require_once $webPath . 'includes/connect_endpoint_crontabs.php';

require_once __DIR__ . '/../../includes/connect_endpoint_crontabs.php';

$currentDate = new DateTime();
$currentDateString = $currentDate->format('Y-m-d');
Expand Down
2 changes: 1 addition & 1 deletion endpoints/notifications/savediscordnotifications.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
$query = "INSERT INTO discord_notifications (enabled, webhook_url, bot_username, bot_avatar_url)
VALUES (:enabled, :webhook_url, :bot_username, :bot_avatar_url)";
} else {
$query = "UPDATE pushover_notifications
$query = "UPDATE discord_notifications
SET enabled = :enabled, webhook_url = :webhook_url, bot_username = :bot_username, bot_avatar_url = :bot_avatar_url";
}

Expand Down
6 changes: 5 additions & 1 deletion includes/connect_endpoint_crontabs.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?php

$databaseFile = '/var/www/html/db/wallos.db';
$databaseFile = __DIR__ . '/../db/wallos.db';
$db = new SQLite3($databaseFile);
$db->busyTimeout(5000);

if (!$db) {
die('Connection to the database failed.');
}

require_once __DIR__ . '/../includes/i18n/languages.php';
require_once __DIR__ . '/../includes/i18n/getlang.php';
require_once __DIR__ . '/../includes/i18n/' . $lang . '.php';

?>
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v1.27.0";
$version = "v1.27.1";
?>

0 comments on commit a524419

Please sign in to comment.