Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
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
TeDomum
Nextcloud
Commits
53e51fe4
Commit
53e51fe4
authored
12 years ago
by
Bart Visscher
Browse files
Options
Downloads
Patches
Plain Diff
Clean user cache on login
parent
8a02a885
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/base.php
+2
-1
2 additions, 1 deletion
lib/base.php
lib/cache/file.php
+21
-0
21 additions, 0 deletions
lib/cache/file.php
with
23 additions
and
1 deletion
lib/base.php
+
2
−
1
View file @
53e51fe4
...
...
@@ -346,8 +346,9 @@ class OC{
}
}
// register cache cleanup
// register cache cleanup
jobs
OC_BackgroundJob_RegularTask
::
register
(
'OC_Cache_FileGlobal'
,
'gc'
);
OC_Hook
::
connect
(
'OC_User'
,
'post_login'
,
'OC_Cache_File'
,
'loginListener'
);
// Check for blacklisted files
OC_Hook
::
connect
(
'OC_Filesystem'
,
'write'
,
'OC_Filesystem'
,
'isBlacklisted'
);
...
...
This diff is collapsed.
Click to expand it.
lib/cache/file.php
+
21
−
0
View file @
53e51fe4
...
...
@@ -74,4 +74,25 @@ class OC_Cache_File{
}
return
true
;
}
public
function
gc
()
{
$storage
=
$this
->
getStorage
();
if
(
$storage
and
$storage
->
is_dir
(
'/'
))
{
$now
=
time
();
$dh
=
$storage
->
opendir
(
'/'
);
while
(
$file
=
readdir
(
$dh
))
{
if
(
$file
!=
'.'
and
$file
!=
'..'
)
{
$mtime
=
$storage
->
filemtime
(
'/'
.
$file
);
if
(
$mtime
<
$now
)
{
$storage
->
unlink
(
'/'
.
$file
);
}
}
}
}
}
public
static
function
loginListener
()
{
$c
=
new
self
();
$c
->
gc
();
}
}
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