User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Since Joomla 3.8.4, if you use Database Session Handler, session data won't be deleted on page loads like in older version of Joomla anymore, it now relies on PHP session data garbage collection proces to delete session data and could cause session data stay longer in database than expected. On some hostings, session.gc_probability http://php.net/manual/en/session.configuration.php#ini.session.gc-probability even has value set to 0, mean session data won't be deleted at all.
This PR implements a simple CLI script so that you can setup cron job to clean up session data if needed. It will be more reliable than rely on session data garbage collection and for high traffic website, you will get big performance improvement (set session.gc_probability to 0 and setup cron job to delete session data- see #19146 for a use case)
Go to System - Global Configuration, look at System tab, set Session Handler to Database, Session Lifetime to 1 minute
Access to frontend of your site so that a new record will be inserted into #__session table
Access to your site database via PHPMyadmin, look at #__session, you should see some records
Wait for about one minute
Run this CLI script. I don't know about Linux, but on Windows, I just need to run this command from Command Line php D:\www\joomla\cli\sessionGc.php (D:\www\joomla needs to be replaced with the path of your Joomla installation)
Check #__session table again, you should see that the old records were deleted (maybe all records deleted)
Maybe we need to document this new feature if accepted
Status | New | ⇒ | Pending |
Category | ⇒ | CLI Libraries |
Honestly, direct calling the storage layer of the session should be avoided, that part of the API is typically an internal detail and in 4.0 you honestly don't have direct access to it (you have to go through a Joomla\Session\SessionInterface
implementation, in the CMS that's Joomla\CMS\Session\Session
to interact with sessions at any level unless you're using Reflection to get access to stuff you shouldn't). So what is there now is fine.
Labels |
Added:
?
|
I have tested this item
It's a new feature so semantic versioning says 3.9
@brianteeman It is an additional feature to provide a way to fix the change we made in 3.8.4, so It could go into 3.8.5 if it is possible
3.8.5 has a specific purpose and is not getting crammed full of miscellaneous stuff.
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-02-14 15:28:06 |
Closed_By | ⇒ | mbabker |
Another way can be only: