-
-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add session garbage collector check #16448
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 3.x #16448 +/- ##
============================================
- Coverage 21.75% 21.68% -0.07%
- Complexity 10478 10496 +18
============================================
Files 561 561
Lines 31590 31703 +113
============================================
+ Hits 6872 6875 +3
- Misses 24718 24828 +110 ☔ View full report in Codecov by Sentry. |
f26eb3c
to
a6f3218
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest following changes, it removes some unnecessary ifs and makes it slightly more readable.
*/ | ||
protected function _checkSessionsGarbageCollector() | ||
{ | ||
$success = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$success = false; | |
$status = 'success'; |
} else { | ||
$success = true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | |
$success = true; | |
} | |
} |
$success = @ini_set('session.gc_probability', 1); | ||
$success = $success !== false ? true : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$success = @ini_set('session.gc_probability', 1); | |
$success = $success !== false ? true : false; | |
$status = @ini_set('session.gc_probability', 1) !== false ? 'success' : 'fail'; |
if ($success) { | ||
$this->warn('session_gc', '', $this->install->lexicon('test_session_gc_success', ['gc_probability' => $gc_probability, 'gc_divisor' => $gc_divisor])); | ||
} else { | ||
$this->warn('session_gc', '', $this->install->lexicon('test_session_gc_fail', ['gc_probability' => $gc_probability, 'gc_divisor' => $gc_divisor])); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ($success) { | |
$this->warn('session_gc', '', $this->install->lexicon('test_session_gc_success', ['gc_probability' => $gc_probability, 'gc_divisor' => $gc_divisor])); | |
} else { | |
$this->warn('session_gc', '', $this->install->lexicon('test_session_gc_fail', ['gc_probability' => $gc_probability, 'gc_divisor' => $gc_divisor])); | |
} | |
$this->warn('session_gc', '', $this->install->lexicon("test_session_gc_$status", ['gc_probability' => $gc_probability, 'gc_divisor' => $gc_divisor])); | |
a6f3218
to
a6a7df9
Compare
a6a7df9
to
b3b1df3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Do the lexicons need to be in both default.inc.php and test.inc.php? |
@Mark-H To be honest, I don’t know, I haven’t figured it out. Other keys are present in both files. |
### What does it do? It often happens that the `modx_session` table grows uncontrollably (I have seen up to 5 gigabytes), which sometimes leads to complete non-operation of both the site and the server. I added session garbage collector check in installer. ![gc_installer_warn](https://user-images.githubusercontent.com/12523676/196445992-6b161c2c-519e-4cc4-bbe4-5ee67e60d150.png) ### Why is it needed? That there were no problems with overflow of the table `modx_session`. ### How to test Make the installation from scratch by changing the `session.gc_probability, session.gc_divisor` parameters. ### Related issue(s)/PR(s) #16287 #16275
What does it do?
It often happens that the
modx_session
table grows uncontrollably (I have seen up to 5 gigabytes), which sometimes leads to complete non-operation of both the site and the server.I added session garbage collector check in installer.
Why is it needed?
That there were no problems with overflow of the table
modx_session
.How to test
Make the installation from scratch by changing the
session.gc_probability, session.gc_divisor
parameters.Related issue(s)/PR(s)
#16287
#16275