Session improvements #316
No reviewers
Labels
No labels
Component: User interface
Component: Wymeditor
Help wanted
Level: Difficult
Level: Easy
Level: Moderate
Pagetype: Festival
Pagetype: Mailinglist
Pagetype: Peer reviewed article
Pagetype: Text
Privacy GDPR AVG
status: has conflicts
Status: Needs changes
Status: Needs discussion
Status: Needs review
Status: Ready to merge
Status: Waiting for response
Type: Bug
Type: Enhancement
Type: Question
Usecase: De Stadsbron
Usecase: Koppelting
Usecase: MeetjeStad
Value: Coders
Value: Security
Value: Users
Value: Visitors
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
harmen/hypha!316
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "session-improvements"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR improves the way sessions are handled. In particular:
Hyphaclass (that containedHyphaFiles) is merged intoRequestContext(the former was a nice idea, but predated the latter and the latter is probably a better place).HyphaSessionclass encapsulates all session access.$_POSTaccesses were converted to useHyphaRequestinstead.The first two points where what I originally set out to achieve, the other improvements and refactorings were either on the path those, were made possible by these refactorings, or did I just think of while working on this code.
One of the changes this PR made was to not write the session on every request if it was not changed. However, I realized that this could actually cause the session to expire (session file deleted by the PHP session GC), because that checks for modified time rather than access time. This would mean the session lifetime was counted from login, rather than last access, which did not seem a good idea. So I removed that change and instead documented that the writing is intentional instead.
I just rebased this on top of master, now #331 is merged (which removes a few commits from this PR).
@ -0,0 +5,4 @@* It should always be used instead of direct access to* $_SESSION.*/class HyphaSession {To ensure the lock it would be better to apply the singleton pattern;
The
*/should be on the next line when it comes to comment blocks.This should be
themeHtmlin stead ofhtml;$O_O->data->themeHtml->read();This should be
themeHtmlin stead ofhtml;$O_O->data->themeHtml->writeWithLock($contents);This should be
themeCssin stead ofcss;$O_O->data->css->read();This should be
themeCssin stead ofcss;$O_O->data->css->writeWithLock($contents);Fixed.
Fixed.
Fixed.
Fixed.
@ -0,0 +5,4 @@* It should always be used instead of direct access to* $_SESSION.*/class HyphaSession {Done.
Rebased on top of master, fixed a few things and added one more commit to prevent multiple instances of HyphaSession from being created. Ready to merge next.