8000 [5.3] Task SessionGC delete metadata from db by alikon · Pull Request #46128 · joomla/joomla-cms · GitHub
[go: up one dir, main page]

Skip to content

Conversation

alikon
Copy link
Contributor
@alikon alikon commented Sep 19, 2025

Pull Request for Issue #45637 , #45032.

Summary of Changes

delete metadata from db too

Testing Instructions

  1. Set up a Joomla 5.x site with session handler set to "database"
  2. Enable the "System - Session Garbage Collector" plugin
  3. Schedule the com_plugins.task.sessiongc task using Joomla Scheduler
  4. Set the task to run daily via CLI using:
  5. php cli/joomla.php scheduler:run --all
  6. Let the session table grow over time with inactive sessions
  7. Check the number of records in the #__session table
  8. Now manually execute the same task via the Joomla backend (Scheduler > Tasks > Execute now)
  9. Check the #__session table again

Actual result BEFORE applying this Pull Request

When executed via the backend, the task successfully removes expired sessions.
When executed via CLI, the task is marked as "Completed" in the execution log, but expired session records remain in the database the session cleanup does not occur.

Expected result AFTER applying this Pull Request

Expired session records (older than the configured lifetime) are removed from the #__session table both when:

The task is executed via the backend
The task is executed via the CLI (cron)

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@joomdonation
Copy link
Contributor

Sorry @alikon. Thinking more about it, this still does not work properly with the combination of following conditions:

  • Task is executed via web
  • Session Handler is Database
  • Enable Session Data Cleanup parameter in the task set to No

To make it works for every possible cases, the if condition will be more complicated, difficult to understand for a very little benefit, so after thinking for a while, I think it will be best to restore the code to your original commit. Could you please do that? Sorry for the inconvenience.

@alikon
Copy link
Contributor Author
alikon commented Sep 23, 2025

I think it will be best to restore the code to your original commit. Could you please 918D do that? Sorry for the inconvenience.

@joomdonation yes done and don't worry it is always better to have another couple of eyes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0