From d67c35ee42ba80e3ef9e69ddebf53b65c40aca92 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 31 Mar 2024 17:10:55 -0700 Subject: [PATCH] Sort date as int in expire.php. --- Rocksolid_Light/rslight/scripts/expire.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Rocksolid_Light/rslight/scripts/expire.php b/Rocksolid_Light/rslight/scripts/expire.php index a70208b..0234d3e 100644 --- a/Rocksolid_Light/rslight/scripts/expire.php +++ b/Rocksolid_Light/rslight/scripts/expire.php @@ -65,7 +65,7 @@ foreach ($grouplist as $groupline) { $database = $spooldir . '/articles-overview.db3'; $dbh = overview_db_open($database); - $query = $dbh->prepare('SELECT number FROM overview WHERE newsgroup=:newsgroup AND date<:expireme'); + $query = $dbh->prepare('SELECT number FROM overview WHERE newsgroup=:newsgroup AND CAST(date AS int)<:expireme'); $query->execute([ ':newsgroup' => $group, ':expireme' => $expireme @@ -74,7 +74,7 @@ foreach ($grouplist as $groupline) { while ($query_row = $query->fetch()) { $get_row[] = $query_row; } - $stmt = $dbh->prepare('DELETE FROM overview WHERE newsgroup=:newsgroup AND date<:expireme'); + $stmt = $dbh->prepare('DELETE FROM overview WHERE newsgroup=:newsgroup AND CAST(date AS int)<:expireme'); $grouppath = preg_replace('/\./', '/', $group); $status = "deleted"; $statusdate = time(); @@ -107,7 +107,7 @@ foreach ($grouplist as $groupline) { $dbh = null; if ($articles_dbh) { // Delete any extraneous articles from group-articles database - $articles_stmt = $articles_dbh->prepare('DELETE FROM articles WHERE newsgroup=:newsgroup AND date<:expireme'); + $articles_stmt = $articles_dbh->prepare('DELETE FROM articles WHERE newsgroup=:newsgroup AND CAST(date AS int)<:expireme'); $articles_stmt->execute([ ':newsgroup' => $group, ':expireme' => $expireme @@ -163,7 +163,7 @@ function convert_max_articles_to_days($group) } $database = $spooldir . '/articles-overview.db3'; $overview_dbh = overview_db_open($database); - $overview_query = $overview_dbh->prepare('SELECT * FROM overview WHERE newsgroup=:newsgroup ORDER BY date DESC LIMIT :count'); + $overview_query = $overview_dbh->prepare('SELECT * FROM overview WHERE newsgroup=:newsgroup ORDER BY CAST(date AS int) DESC LIMIT :count'); $overview_query->execute([ ':newsgroup' => $group, ':count' => $count