From fea281ca77bce03ecdb803615eab4906b98fc1c4 Mon Sep 17 00:00:00 2001 From: HugoFara Date: Sat, 21 Jan 2023 12:30:06 +0900 Subject: [PATCH] Fixed #78? Better default date for new words. Invalid default value for 'WoStatusChanged' HugoFara/lwt#78 --- docs/CHANGELOG.md | 1 + docs/info.html | 1 + inc/database_connect.php | 38 +++++++++++++++++++------------------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 52c82bb87..d40e9a5e0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -8,6 +8,7 @@ For git tags, official releases are marked like "v1.0.0", while unofficial ones ### Fixed * Markdown: enforced consistency with official style recomendations. The documentation display got improved. +* The default date for new words was note accepted depending on the SQL configuration, causing issues with Docker installation. See [#78](https://github.com/HugoFara/lwt/issues/78). ## [Unreleased] diff --git a/docs/info.html b/docs/info.html index 1c13bed9b..2ad4a17c3 100644 --- a/docs/info.html +++ b/docs/info.html @@ -1941,6 +1941,7 @@

[Unreleased]

Fixed

2.6.0-fork (January 01 2023)

Added

diff --git a/inc/database_connect.php b/inc/database_connect.php index f1ce5c18a..38f87c183 100644 --- a/inc/database_connect.php +++ b/inc/database_connect.php @@ -1762,7 +1762,7 @@ function check_update_db($debug, $tbpref, $dbname): void // Rebuild Tables if missing (current versions!) - if (!in_array($tbpref . 'archivedtexts', $tables)) { + if (!in_array("{$tbpref}archivedtexts", $tables)) { if ($debug) { echo '

DEBUG: rebuilding archivedtexts

'; } @@ -1784,7 +1784,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'languages', $tables)) { + if (!in_array("{$tbpref}languages", $tables)) { if ($debug) { echo '

DEBUG: rebuilding languages

'; } @@ -1812,7 +1812,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'sentences', $tables)) { + if (!in_array("{$tbpref}sentences", $tables)) { if ($debug) { echo '

DEBUG: rebuilding sentences

'; } @@ -1834,7 +1834,7 @@ function check_update_db($debug, $tbpref, $dbname): void $count++; } - if (!in_array($tbpref . 'settings', $tables)) { + if (!in_array("{$tbpref}settings", $tables)) { if ($debug) { echo '

DEBUG: rebuilding settings

'; } @@ -1849,7 +1849,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'textitems2', $tables)) { + if (!in_array("{$tbpref}textitems2", $tables)) { if ($debug) { echo '

DEBUG: rebuilding textitems2

'; } @@ -1868,7 +1868,7 @@ function check_update_db($debug, $tbpref, $dbname): void '' ); // Add data from the old database system - if (in_array($tbpref . 'textitems', $tables)) { + if (in_array("{$tbpref}textitems", $tables)) { runsql( "INSERT INTO {$tbpref}textitems2 ( Ti2WoID, Ti2LgID, Ti2TxID, Ti2SeID, Ti2Order, Ti2WordCount, @@ -1886,13 +1886,13 @@ function check_update_db($debug, $tbpref, $dbname): void WHERE TiWordCount<2 OR WoID IS NOT NULL", '' ); - runsql('TRUNCATE ' . $tbpref . 'textitems', ''); + runsql("TRUNCATE {$tbpref}textitems", ''); } $count++; } - if (!in_array($tbpref . 'temptextitems', $tables)) { + if (!in_array("{$tbpref}temptextitems", $tables)) { if ($debug) { echo '

DEBUG: rebuilding temptextitems

'; } @@ -1908,7 +1908,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'tempwords', $tables)) { + if (!in_array("{$tbpref}tempwords", $tables)) { if ($debug) { echo '

DEBUG: rebuilding tempwords

'; } @@ -1926,7 +1926,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'texts', $tables)) { + if (!in_array("{$tbpref}texts", $tables)) { if ($debug) { echo '

DEBUG: rebuilding texts

'; } @@ -1949,7 +1949,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'words', $tables)) { + if (!in_array("{$tbpref}words", $tables)) { if ($debug) { echo '

DEBUG: rebuilding words

'; } @@ -1965,7 +1965,7 @@ function check_update_db($debug, $tbpref, $dbname): void WoSentence varchar(1000) DEFAULT NULL, WoWordCount tinyint(3) unsigned NOT NULL DEFAULT 0, WoCreated timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - WoStatusChanged timestamp NOT NULL DEFAULT '0000-00-00 00:00:01', + WoStatusChanged timestamp NOT NULL DEFAULT '1970-01-01 12:00:00', WoTodayScore double NOT NULL DEFAULT '0', WoTomorrowScore double NOT NULL DEFAULT '0', WoRandom double NOT NULL DEFAULT '0', @@ -1986,7 +1986,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'tags', $tables)) { + if (!in_array("{$tbpref}tags", $tables)) { if ($debug) { echo '

DEBUG: rebuilding tags

'; } @@ -2002,7 +2002,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'wordtags', $tables)) { + if (!in_array("{$tbpref}wordtags", $tables)) { if ($debug) { echo '

DEBUG: rebuilding wordtags

'; } @@ -2017,7 +2017,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'tags2', $tables)) { + if (!in_array("{$tbpref}tags2", $tables)) { if ($debug) { echo '

DEBUG: rebuilding tags2

'; } @@ -2033,7 +2033,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'texttags', $tables)) { + if (!in_array("{$tbpref}texttags", $tables)) { if ($debug) { echo '

DEBUG: rebuilding texttags

'; } @@ -2047,7 +2047,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'newsfeeds', $tables)) { + if (!in_array("{$tbpref}newsfeeds", $tables)) { if ($debug) { echo '

DEBUG: rebuilding newsfeeds

'; } @@ -2069,7 +2069,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'feedlinks', $tables)) { + if (!in_array("{$tbpref}feedlinks", $tables)) { if ($debug) { echo '

DEBUG: rebuilding feedlinks

'; } @@ -2092,7 +2092,7 @@ function check_update_db($debug, $tbpref, $dbname): void ); } - if (!in_array($tbpref . 'archtexttags', $tables)) { + if (!in_array("{$tbpref}archtexttags", $tables)) { if ($debug) { echo '

DEBUG: rebuilding archtexttags

'; }