From a524419e0a468147a2094dba81689dd643a0108b Mon Sep 17 00:00:00 2001 From: Miguel Ribeiro Date: Mon, 13 May 2024 17:45:59 +0200 Subject: [PATCH] fix: import of translations for cronjobs was missing (#321) refactor: retrieval of webroot path chore: add sqlite to docker image --- Dockerfile | 2 +- README.md | 2 +- endpoints/cronjobs/conf.php | 6 ------ endpoints/cronjobs/createdatabase.php | 5 +---- endpoints/cronjobs/sendnotifications.php | 9 ++++----- endpoints/cronjobs/updateexchange.php | 3 +-- endpoints/cronjobs/updatenextpayment.php | 4 ++-- endpoints/notifications/savediscordnotifications.php | 2 +- includes/connect_endpoint_crontabs.php | 6 +++++- includes/version.php | 2 +- 10 files changed, 17 insertions(+), 24 deletions(-) delete mode 100644 endpoints/cronjobs/conf.php diff --git a/Dockerfile b/Dockerfile index 2b3ae80..18ed4cd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 && \ diff --git a/README.md b/README.md index 857437f..5fb4d6b 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/endpoints/cronjobs/conf.php b/endpoints/cronjobs/conf.php deleted file mode 100644 index eabfc2e..0000000 --- a/endpoints/cronjobs/conf.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/endpoints/cronjobs/createdatabase.php b/endpoints/cronjobs/createdatabase.php index 2d54d7c..27a05c6 100644 --- a/endpoints/cronjobs/createdatabase.php +++ b/endpoints/cronjobs/createdatabase.php @@ -1,8 +1,6 @@ busyTimeout(5000); diff --git a/endpoints/cronjobs/sendnotifications.php b/endpoints/cronjobs/sendnotifications.php index 727feb6..82ced36 100644 --- a/endpoints/cronjobs/sendnotifications.php +++ b/endpoints/cronjobs/sendnotifications.php @@ -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; @@ -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); diff --git a/endpoints/cronjobs/updateexchange.php b/endpoints/cronjobs/updateexchange.php index 8065cf6..19b8d60 100644 --- a/endpoints/cronjobs/updateexchange.php +++ b/endpoints/cronjobs/updateexchange.php @@ -1,6 +1,5 @@ query($query); diff --git a/endpoints/cronjobs/updatenextpayment.php b/endpoints/cronjobs/updatenextpayment.php index 546939e..f3a4ef5 100644 --- a/endpoints/cronjobs/updatenextpayment.php +++ b/endpoints/cronjobs/updatenextpayment.php @@ -1,6 +1,6 @@ format('Y-m-d'); diff --git a/endpoints/notifications/savediscordnotifications.php b/endpoints/notifications/savediscordnotifications.php index 47ac2cc..2081aa3 100644 --- a/endpoints/notifications/savediscordnotifications.php +++ b/endpoints/notifications/savediscordnotifications.php @@ -42,7 +42,7 @@ require_once '../../includes/connect_endpoint.php'; $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"; } diff --git a/includes/connect_endpoint_crontabs.php b/includes/connect_endpoint_crontabs.php index a942c1f..5202cbb 100644 --- a/includes/connect_endpoint_crontabs.php +++ b/includes/connect_endpoint_crontabs.php @@ -1,6 +1,6 @@ busyTimeout(5000); @@ -8,4 +8,8 @@ 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'; + ?> \ No newline at end of file diff --git a/includes/version.php b/includes/version.php index d706619..b16c844 100644 --- a/includes/version.php +++ b/includes/version.php @@ -1,3 +1,3 @@