Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
c4669d77
Unverified
Commit
c4669d77
authored
7 years ago
by
Peter Rotich
Committed by
GitHub
7 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #3899 from JediKev/issue/clean-expired-sessions
cron: Delete Expired Sessions
parents
acac3707
5a8fdeae
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.cron.php
+6
-0
6 additions, 0 deletions
include/class.cron.php
include/class.ostsession.php
+8
-0
8 additions, 0 deletions
include/class.ostsession.php
with
14 additions
and
0 deletions
include/class.cron.php
+
6
−
0
View file @
c4669d77
...
...
@@ -51,6 +51,11 @@ class Cron {
AttachmentFile
::
deleteOrphans
();
}
function
CleanExpiredSessions
()
{
require_once
(
INCLUDE_DIR
.
'class.ostsession.php'
);
DbSessionBackend
::
cleanup
();
}
function
MaybeOptimizeTables
()
{
// Once a week on a 5-minute cron
$chance
=
rand
(
1
,
2000
);
...
...
@@ -100,6 +105,7 @@ class Cron {
self
::
MailFetcher
();
self
::
TicketMonitor
();
self
::
PurgeLogs
();
self
::
CleanExpiredSessions
();
// Run file purging about every 10 cron runs
if
(
mt_rand
(
1
,
9
)
==
4
)
self
::
CleanOrphanedFiles
();
...
...
This diff is collapsed.
Click to expand it.
include/class.ostsession.php
+
8
−
0
View file @
c4669d77
...
...
@@ -158,6 +158,10 @@ abstract class SessionBackend {
return
$this
->
update
(
$id
,
$i
[
'touched'
]
?
session_encode
()
:
$data
);
}
function
cleanup
()
{
$this
->
gc
(
0
);
}
abstract
function
read
(
$id
);
abstract
function
update
(
$id
,
$data
);
abstract
function
destroy
(
$id
);
...
...
@@ -220,6 +224,10 @@ extends SessionBackend {
return
SessionData
::
objects
()
->
filter
([
'session_id'
=>
$id
])
->
delete
();
}
function
cleanup
()
{
self
::
gc
(
0
);
}
function
gc
(
$maxlife
){
SessionData
::
objects
()
->
filter
([
'session_expire__lte'
=>
SqlFunction
::
NOW
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment