[ticket/17656] Add shorter guest session length and new AI bots#6960
[ticket/17656] Add shorter guest session length and new AI bots#6960marc1706 wants to merge 7 commits into
Conversation
PHPBB-17656
| public function add_bots(): void | ||
| { | ||
| $bots = [ | ||
| // 'BotName' => 'Agent partial name', |
There was a problem hiding this comment.
Hmm, opposed to search bots leading traffic to my site, I don't think I want to have these bots in the same category since they copy contents, train their datasets and consume resources without contributing to anyrhing useful.
There was a problem hiding this comment.
What do you mean with leading traffic to your site? This will cause these to show up as Bots visiting your site and the bots will see less user-specific links and therefore should be less likely to crawl useless links or sites.
| 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), | ||
| 'legend1' => 'GENERAL_SETTINGS', | ||
| 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), | ||
| 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60:9999999999', 'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), |
There was a problem hiding this comment.
Maybe use fool proof max values here.
There was a problem hiding this comment.
Default is 3600, not sure what a sensible max length would be :)
There was a problem hiding this comment.
In other settings we use 99.999 minutes e.g. for time span for post edits. So roughly 70 days.
I would use here like a maximum of 1 day, ca. 80k to 99k seconds.
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated, shorter lifecycle for anonymous (guest) sessions and expands the built-in bot list to include common AI crawlers, aiming to reduce session table growth and improve handling of modern crawler traffic.
Changes:
- Add guest-only session GC (
session_guest_gc()) and a new cron task to run it on an independent (tighter) schedule. - Add new configuration options (and ACP UI strings/fields) for guest session length/GC interval, plus install-time defaults.
- Add a migration to create AI crawler bot users and bot-agent entries.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| phpBB/phpbb/session.php | Adds a new session_guest_gc() method to delete expired anonymous sessions and update a dedicated last-run timestamp. |
| phpBB/phpbb/db/migration/data/v33x/guest_session_config.php | Adds new guest session config keys and introduces a new sessions-table index to support guest session operations. |
| phpBB/phpbb/db/migration/data/v33x/ai_crawler_bots.php | Adds a migration to create multiple AI crawler bot accounts and bot-agent entries. |
| phpBB/phpbb/cron/task/core/tidy_guest_sessions.php | Introduces a new cron task that runs guest-only session cleanup based on new config intervals. |
| phpBB/language/en/acp/board.php | Adds ACP language strings for the new session GC/guest session settings. |
| phpBB/install/schemas/schema_data.sql | Seeds default values for the new guest session settings (and dynamic last-run key) on fresh installs. |
| phpBB/includes/acp/acp_board.php | Exposes session GC and new guest session settings in the ACP “Load Settings” section. |
| phpBB/config/default/container/services_cron.yml | Registers the new cron task service for guest session cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
PHPBB-17656
PHPBB-17656
Checklist:
Tracker ticket:
https://tracker.phpbb.com/browse/PHPBB-17656