Author: Luffy (sy-records) Committer: GitHub (web-flow) Pusher: sy-records Date: 2026-11-30T11:15:35+08:00
Commit: https://github.com/php/web-master/commit/fd4104569f1e14dbd80af8f11c104849cb280dc9 Raw diff: https://github.com/php/web-master/commit/fd4104569f1e14dbd80af8f11c104849cb280dc9.diff Handle case when no low-rated notes are found Changed paths: M scripts/remove-low-rated-notes Diff: diff --git a/scripts/remove-low-rated-notes b/scripts/remove-low-rated-notes index 6d31bd5..b378b94 100755 --- a/scripts/remove-low-rated-notes +++ b/scripts/remove-low-rated-notes @@ -30,6 +30,11 @@ foreach ($result as $row) { $count++; } +if ($count === 0) { + echo "No notes found with a rating less than " . RATING_THRESHOLD . " and older than " . AGE_THRESHOLD . ".\n"; + exit(0); +} + $body = "Following were the {$count} notes with a rating less than " . RATING_THRESHOLD . " and\nare older than " . AGE_THRESHOLD. ".\n\n" . sprintf("These notes represented %.1f%% of the %d total user notes,\nand have now been removed.\n\n", ($count / $total) * 100, $total) . $table;
