Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
74cf718a
Commit
74cf718a
authored
Jul 19, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete expired cache button
parent
5af87666
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
17 deletions
+15
-17
FileCacheDriver.php
qa-include/Q2A/Storage/FileCacheDriver.php
+1
-2
recalc.php
qa-include/ajax/recalc.php
+1
-1
recalc.php
qa-include/app/recalc.php
+8
-13
qa-lang-admin.php
qa-include/lang/qa-lang-admin.php
+0
-1
admin-default.php
qa-include/pages/admin/admin-default.php
+5
-0
No files found.
qa-include/Q2A/Storage/FileCacheDriver.php
View file @
74cf718a
...
@@ -160,8 +160,7 @@ class Q2A_Storage_FileCacheDriver
...
@@ -160,8 +160,7 @@ class Q2A_Storage_FileCacheDriver
if
(
is_readable
(
$file
))
{
if
(
is_readable
(
$file
))
{
$fp
=
fopen
(
$file
,
'r'
);
$fp
=
fopen
(
$file
,
'r'
);
$key
=
fgets
(
$fp
);
$key
=
fgets
(
$fp
);
$expiry
=
fgets
(
$fp
);
$expiry
=
(
int
)
trim
(
fgets
(
$fp
));
// fclose($fp);
if
(
is_numeric
(
$expiry
)
&&
time
()
>
$expiry
)
{
if
(
is_numeric
(
$expiry
)
&&
time
()
>
$expiry
)
{
$wasDeleted
=
$this
->
deleteFile
(
$file
);
$wasDeleted
=
$this
->
deleteFile
(
$file
);
}
}
...
...
qa-include/ajax/recalc.php
View file @
74cf718a
...
@@ -33,7 +33,7 @@ if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
...
@@ -33,7 +33,7 @@ if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) {
$state
=
qa_post_text
(
'state'
);
$state
=
qa_post_text
(
'state'
);
$stoptime
=
time
()
+
3
;
$stoptime
=
time
()
+
3
;
while
(
qa_recalc_perform_step
(
$state
)
&&
(
time
()
<
$stoptime
)
)
while
(
qa_recalc_perform_step
(
$state
)
&&
time
()
<
$stoptime
)
;
;
$message
=
qa_recalc_get_message
(
$state
);
$message
=
qa_recalc_get_message
(
$state
);
...
...
qa-include/app/recalc.php
View file @
74cf718a
...
@@ -523,23 +523,23 @@ function qa_recalc_perform_step(&$state)
...
@@ -523,23 +523,23 @@ function qa_recalc_perform_step(&$state)
qa_recalc_transition
(
$state
,
'doblobstodb_complete'
);
qa_recalc_transition
(
$state
,
'doblobstodb_complete'
);
break
;
break
;
case
'docachetrim'
:
qa_recalc_transition
(
$state
,
'docachetrim_process'
);
break
;
case
'docacheclear'
:
case
'docacheclear'
:
qa_recalc_transition
(
$state
,
'docacheclear_process'
);
qa_recalc_transition
(
$state
,
'docacheclear_process'
);
break
;
break
;
case
'docachetrim_process'
:
case
'docacheclear_process'
:
case
'docacheclear_process'
:
$cacheDriver
=
Q2A_Storage_CacheFactory
::
getCacheDriver
();
$cacheDriver
=
Q2A_Storage_CacheFactory
::
getCacheDriver
();
$cacheStats
=
$cacheDriver
->
getStats
();
$cacheStats
=
$cacheDriver
->
getStats
();
$limit
=
min
(
$cacheStats
[
'files'
],
20
);
$limit
=
min
(
$cacheStats
[
'files'
],
20
);
if
(
$next
>
$length
)
{
if
(
$cacheStats
[
'files'
]
>
0
&&
$next
<=
$length
)
{
qa_recalc_transition
(
$state
,
'docacheclear_error'
);
$deleted
=
$cacheDriver
->
clear
(
$limit
,
$next
,
(
$operation
===
'docachetrim_process'
));
break
;
}
if
(
$cacheStats
[
'files'
]
>
0
)
{
$deleted
=
$cacheDriver
->
clear
(
$limit
,
$next
);
$done
+=
$deleted
;
$done
+=
$deleted
;
$next
+=
$limit
-
$deleted
;
//
if some files were not deleted, skip them next time
$next
+=
$limit
-
$deleted
;
//
skip files that weren't deleted on next iteration
$continue
=
true
;
$continue
=
true
;
}
else
{
}
else
{
qa_recalc_transition
(
$state
,
'docacheclear_complete'
);
qa_recalc_transition
(
$state
,
'docacheclear_complete'
);
...
@@ -554,7 +554,7 @@ function qa_recalc_perform_step(&$state)
...
@@ -554,7 +554,7 @@ function qa_recalc_perform_step(&$state)
if
(
$continue
)
if
(
$continue
)
$state
=
$operation
.
"
\t
"
.
$length
.
"
\t
"
.
$next
.
"
\t
"
.
$done
;
$state
=
$operation
.
"
\t
"
.
$length
.
"
\t
"
.
$next
.
"
\t
"
.
$done
;
return
$continue
&&
(
$done
<
$length
)
;
return
$continue
&&
$done
<
$length
;
}
}
...
@@ -784,11 +784,6 @@ function qa_recalc_get_message($state)
...
@@ -784,11 +784,6 @@ function qa_recalc_get_message($state)
$message
=
qa_recalc_progress_lang
(
'admin/caching_delete_progress'
,
$done
,
$length
);
$message
=
qa_recalc_progress_lang
(
'admin/caching_delete_progress'
,
$done
,
$length
);
break
;
break
;
case
'docacheclear_error'
:
$message
=
qa_lang
(
'admin/caching_delete_error'
);
break
;
case
'docachetrim_complete'
:
case
'docacheclear_complete'
:
case
'docacheclear_complete'
:
$message
=
qa_lang
(
'admin/caching_delete_complete'
);
$message
=
qa_lang
(
'admin/caching_delete_complete'
);
break
;
break
;
...
...
qa-include/lang/qa-lang-admin.php
View file @
74cf718a
...
@@ -56,7 +56,6 @@ return array(
...
@@ -56,7 +56,6 @@ return array(
'caching_cleanup'
=>
'Caching clean-up operations'
,
'caching_cleanup'
=>
'Caching clean-up operations'
,
'caching_delete_all'
=>
'Delete entire cache'
,
'caching_delete_all'
=>
'Delete entire cache'
,
'caching_delete_complete'
=>
'Cache successfully deleted'
,
'caching_delete_complete'
=>
'Cache successfully deleted'
,
'caching_delete_error'
=>
'There was an error deleting some cache files'
,
'caching_delete_expired'
=>
'Delete expired cache'
,
'caching_delete_expired'
=>
'Delete expired cache'
,
'caching_delete_progress'
=>
'Deleted ^1 of ^2 cache files...'
,
'caching_delete_progress'
=>
'Deleted ^1 of ^2 cache files...'
,
'caching_dir_error'
=>
'The directory ^ defined as QA_CACHE_DIRECTORY is not writable by the web server.'
,
'caching_dir_error'
=>
'The directory ^ defined as QA_CACHE_DIRECTORY is not writable by the web server.'
,
...
...
qa-include/pages/admin/admin-default.php
View file @
74cf718a
...
@@ -1815,6 +1815,11 @@ switch ($adminsection) {
...
@@ -1815,6 +1815,11 @@ switch ($adminsection) {
),
),
'buttons'
=>
array
(
'buttons'
=>
array
(
'delete_expired'
=>
array
(
'label'
=>
qa_lang_html
(
'admin/caching_delete_expired'
),
'tags'
=>
'name="docachetrim" onclick="return qa_recalc_click(this.name, this, '
.
qa_js
(
qa_lang_html
(
'admin/delete_stop'
))
.
', \'cachetrim_note\');"'
,
'note'
=>
'<span id="cachetrim_note"></span>'
,
),
'delete_all'
=>
array
(
'delete_all'
=>
array
(
'label'
=>
qa_lang_html
(
'admin/caching_delete_all'
),
'label'
=>
qa_lang_html
(
'admin/caching_delete_all'
),
'tags'
=>
'name="docacheclear" onclick="return qa_recalc_click(this.name, this, '
.
qa_js
(
qa_lang_html
(
'admin/delete_stop'
))
.
', \'cacheclear_note\');"'
,
'tags'
=>
'name="docacheclear" onclick="return qa_recalc_click(this.name, this, '
.
qa_js
(
qa_lang_html
(
'admin/delete_stop'
))
.
', \'cacheclear_note\');"'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment