- Issue created by @a.dmitriiev
Hi @a.dmitriiev,
I have reproduced the issue by deleting the flood table and visiting the /admin/people/flood-unblock page, which resulted in the error:
The website encountered an unexpected error. Try again later.
To address this, I’ve added a validation to check whether the flood table exists:
If the table exists : The functionality works as expected.
If the table does not exist :- A logger error is recorded: "The flood table does not exist."
- The /admin/people/flood-unblock page displays the message: "There is no table found named flood."
I’ve attached screenshots showing the behavior before and after implementing the changes for your reference.
Please let me know if any additional changes are needed, such as:
- Displaying an error message at the top of the page.
- Adjusting the wording of the message.
Thank you !
- 🇩🇪Germany a.dmitriiev
There are also other public methods in
src/FloodUnblockManagerDatabase.php
class that query the sameflood
table. I think they also need this check. Hi @a.dmitriiev,
I have reviewed the additional public methods in the
src/FloodUnblockManagerDatabase.php
class that query the flood table and added the necessary validation to check whether the flood table exists. Here are the changes made:1. Added a floodTableExists() check in all relevant public methods of the FloodUnblockManagerDatabase class:
- floodUnblockClearEvent: Ensures the table exists before attempting to clear flood entries.
- getEntries: Returns an empty array if the table does not exist.
- getEventIds: Returns an empty array if the table does not exist.
2. Updated the Drush commands in FloodUnblockCommands to handle cases where getEventIds or floodUnblockClearEvent might not proceed due to the missing table.
Please let me know if any additional adjustments are needed. Thank you !
- 🇻🇳Vietnam thaoquang
I got same error
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db_hoathi.le_flood' doesn't exist: SELECT COUNT(*) AS "expression" FROM (SELECT 1 AS "expression" FROM "le_flood" "f") "subquery"; Array ( ) in Drupal\flood_control\FloodUnblockManagerDatabase->getEntries() (line 134 of /d11/modules/contrib/flood_control/src/FloodUnblockManagerDatabase.php).
- 🇮🇳India kalash-j jaipur
Hi @anish.ir,
Thanks for the updates! I have tested MR !54, and it is working as expected. The validation correctly prevents queries when the flood table is missing, ensuring better error handling. All instances of database queries on the flood table are properly wrapped with the existence check!
-
batigolix →
committed cc9ffe55 on 3.0.x authored by
anish.ir →
Issue #3497949 by anish.ir, kalash-j, a.dmitriiev, batigolix: Table '...
-
batigolix →
committed cc9ffe55 on 3.0.x authored by
anish.ir →
- Status changed to Fixed
26 days ago 7:04am 14 March 2025 Automatically closed - issue fixed for 2 weeks with no activity.