User tests: Successful: Unsuccessful:
To try and sum things up:
JSession
can now lazy start a session; calls to get()
, set()
, has()
, and clear()
will start the session if it hasn't explicitly been started previouslyJSession::start()
is called from the application constructors to one of the first actions done after $app->execute()
is called. The advantage here is that now sessions are started after the application has been instantiated and set to JFactory::$application
.onAfterRender
event instead of when the session is originally started; garbage collection will occur for the database session handler as part of the PHP session APIJApplicationCms::checkSession()
now optionally accepts the JSession
object that should be checked and this will be a mandatory argument as of 4.0. This method is called as part of the afterSessionStart
event which may occur without a session object stored to JFactory
.afterSessionStart
event now includes the JSession
object for which the session was started for as an argument of the event, this should be used instead of fetching the session from JFactory
JSessionStorageDatabase
is dependent on the application to insert the session record into the database table, the logic is added to the write()
method to remove this dependencygc()
method is called when the session is started.JApplicationCms::checkSession()
is adjusted to only manipulate the time
column when not using the database session handler to preserve the record's integrity when written by the session API1) Download the branch from https://github.com/mbabker/joomla-cms/archive/refactor-session-metadata-coupling.zip
2) Install Joomla; sessions in the installation application should continue to function correctly
3) Use Joomla normally; sessions should continue to function correctly
4) With the database session handler enabled, JApplicationCms::checkSession()
should only be executed when the session is new. As this is only ensuring the extra metadata is present in the database, it is not required for every page load. All requests after the session is started will have the record in the database updated by the session handler only (or any place making an explicit query to the #__session
database table). As well, the new JApplicationCms::cleanupSessionMetadata()
method should never be called.
5) With any other session handler enabled, JApplicationCms::checkSession()
should only be called if the session is new or the time is an even numbered second. The new JApplicationCms::cleanupSessionMetadata()
method should be called when the onAfterRender
event is triggered and the delete query should only run when the time is an even numbered second.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Labels |
Added:
?
|
Category | ⇒ | Libraries Unit Tests |
Labels |
Look, I know this is tricky as all can be to properly test, but there are major logic and workflow fixes introduced here that are somewhat needed to break some existing bad practices. Some tests here would be appreciated...
Is this going anywhere or can I close for lack of interest?
from my part i find all your PR interresting but because of gsoc project lack of time ATM.
Out of sync yet again and apparently too complex for the user base. I'm done.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-09-12 20:50:39 |
Closed_By | ⇒ | mbabker |
This has only been open 4 months, even some simpler PRs have been open since Aug 18, 2014 ;-)
After the discussion yesterday I'm keeping my PRs limited to things that a user can click in the backend after installing a patch with patch tester since apparently requesting testing on highly technical matters such as this is asking for too much.
please don't close your PR michael, i think most of them are important.
i don't have always time to test all of them, but i try to test them when possible.
Status | Closed | ⇒ | New |
Closed_Date | 2016-09-12 20:50:37 | ⇒ | |
Closed_By | mbabker | ⇒ |
Status | New | ⇒ | Pending |
I will try this one last time. Key points here:
$session->start()
to correctly start the session right now; similar to other parts of the API that lazy load, the session can now do the sameJSession
object stored to the factory); this is resolved by passing the event dependency through the dispatcherloadSession()
method is also performing session garbage collection when the database handler is in use; this is a waste of cycles as the underlying PHP API has mechanisms to perform garbage collection AND handles expired sessions just fine without us beating it to the punchThese are all deep rooted architectural issues that need to be addressed and the only way to do so is testing through these technically heavy patches.
Fixed. That last merge didn't go well at all.
I have tested this item
1) Download the branch from https://github.com/mbabker/joomla-cms/archive/refactor-session-metadata-coupling.zip
2) Install Joomla; sessions in the installation application should continue to function correctly
OK
3) Use Joomla normally; sessions should continue to function correctly
OK
4) With the database session handler enabled, JApplicationCms::checkSession() should only be executed when the session is new. As this is only ensuring the extra metadata is present in the database, it is not required for every page load. All requests after the session is started will have the record in the database updated by the session handler only (or any place making an explicit query to the #__session database table). As well, the new JApplicationCms::cleanupSessionMetadata() method should never be called.
OK. Added $this->enqueueMessage('checkSession called', 'notice');
in JApplicationCms::checkSession() to confirm.
5) With any other session handler enabled, JApplicationCms::checkSession() should only be called if the session is new or the time is an even numbered second. The new JApplicationCms::cleanupSessionMetadata() method should be called when the onAfterRender event is triggered and the delete query should only run when the time is an even numbered second.
Didn't test don't have other session handler to test.
Should be able to use the filesystem (PHP, None, whatever it's called in the UI these days).
ok of course!
I have tested this item
PHP, Database
No memcache
Works with PHP as session handler too, with this handler the notice added appears somewhat random as supposed (should only be called [...] or the time is an even numbered second
).
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
|
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-09-18 15:40:27 |
Closed_By | ⇒ | wilsonge |
Labels |
Removed:
?
|
Reverting this PR solves the issue
This should not have been merged into 3.6.3 it was not a bug fix and should have waited for 3.7
Wouldn't have mattered what branch it went into. Still would've hit the same bugs because some condition's not going to be tested through normally and it's going to result in someone getting something broken. So, I'm not pushing it anymore. We'll just stick with the broken global state and default structures we have now.
I have followed the steps provided. I successfully tested 1-3 steps. But not able to understand 4th and 5th step clearly. I am sure this is me who don’t understand as I don’t much familiar with joomla framework so far.
Thank you.?
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10905.