Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
86623358
Commit
86623358
authored
Jun 4, 2014
by
Thomas Müller
Browse files
Options
Downloads
Plain Diff
Merge pull request #8849 from owncloud/trash_expire_fix
get files in trash from file cache
parents
6b2b903e
9f3fcf03
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files_trashbin/lib/trashbin.php
+9
-8
9 additions, 8 deletions
apps/files_trashbin/lib/trashbin.php
with
9 additions
and
8 deletions
apps/files_trashbin/lib/trashbin.php
+
9
−
8
View file @
86623358
...
...
@@ -730,6 +730,8 @@ class Trashbin {
*/
private
static
function
expire
(
$trashbinSize
,
$user
)
{
$view
=
new
\OC\Files\View
(
'/'
.
$user
.
'/files_trashbin'
);
// let the admin disable auto expire
$autoExpire
=
\OC_Config
::
getValue
(
'trashbin_auto_expire'
,
true
);
if
(
$autoExpire
===
false
)
{
...
...
@@ -740,19 +742,18 @@ class Trashbin {
$availableSpace
=
self
::
calculateFreeSpace
(
$trashbinSize
);
$size
=
0
;
$query
=
\OC_DB
::
prepare
(
'SELECT `location`,`type`,`id`,`timestamp` FROM `*PREFIX*files_trash` WHERE `user`=?'
);
$result
=
$query
->
execute
(
array
(
$user
))
->
fetchAll
();
$retention_obligation
=
\OC_Config
::
getValue
(
'trashbin_retention_obligation'
,
self
::
DEFAULT_RETENTION_OBLIGATION
);
$limit
=
time
()
-
(
$retention_obligation
*
86400
);
foreach
(
$result
as
$r
)
{
$timestamp
=
$r
[
'timestamp'
];
$filename
=
$r
[
'id'
];
if
(
$r
[
'timestamp'
]
<
$limit
)
{
$dirContent
=
$view
->
getDirectoryContent
(
'/files'
);
foreach
(
$dirContent
as
$file
)
{
$timestamp
=
$file
[
'mtime'
];
$filename
=
pathinfo
(
$file
[
'name'
],
PATHINFO_FILENAME
);
if
(
$timestamp
<
$limit
)
{
$size
+=
self
::
delete
(
$filename
,
$timestamp
);
\OC_Log
::
write
(
'files_trashbin'
,
'remove "'
.
$filename
.
'" fom trash bin because it is older than '
.
$retention_obligation
,
\OC_log
::
INFO
);
\OC_Log
::
write
(
'files_trashbin'
,
'remove "'
.
$filename
.
'" f
r
om trash bin because it is older than '
.
$retention_obligation
,
\OC_log
::
INFO
);
}
}
$availableSpace
+=
$size
;
...
...
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
sign in
to comment