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
88ba1a59
Commit
88ba1a59
authored
Jul 22, 2017
by
Scott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add option to choose caching driver
parent
1152e3f6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
6 deletions
+32
-6
CacheFactory.php
qa-include/Q2A/Storage/CacheFactory.php
+13
-0
FileCacheDriver.php
qa-include/Q2A/Storage/FileCacheDriver.php
+1
-1
MemcachedDriver.php
qa-include/Q2A/Storage/MemcachedDriver.php
+5
-0
options.php
qa-include/app/options.php
+2
-4
qa-lang-options.php
qa-include/lang/qa-lang-options.php
+3
-0
admin-default.php
qa-include/pages/admin/admin-default.php
+8
-1
No files found.
qa-include/Q2A/Storage/CacheFactory.php
View file @
88ba1a59
...
...
@@ -39,7 +39,20 @@ class Q2A_Storage_CacheFactory
'dir'
=>
defined
(
'QA_CACHE_DIRECTORY'
)
?
QA_CACHE_DIRECTORY
:
null
,
);
$driver
=
qa_opt
(
'caching_driver'
);
switch
(
$driver
)
{
case
'memcached'
:
self
::
$cacheDriver
=
new
Q2A_Storage_MemcachedDriver
(
$config
);
break
;
case
'filesystem'
:
default
:
self
::
$cacheDriver
=
new
Q2A_Storage_FileCacheDriver
(
$config
);
break
;
}
}
return
self
::
$cacheDriver
;
...
...
qa-include/Q2A/Storage/FileCacheDriver.php
View file @
88ba1a59
...
...
@@ -3,7 +3,7 @@
Question2Answer by Gideon Greenspan and contributors
http://www.question2answer.org/
File: qa-include/Q2A/Storage/FileCache.php
File: qa-include/Q2A/Storage/FileCache
Driver
.php
Description: File-based driver for caching system.
...
...
qa-include/Q2A/Storage/MemcachedDriver.php
View file @
88ba1a59
...
...
@@ -176,11 +176,16 @@ class Q2A_Storage_MemcachedDriver implements Q2A_Storage_CacheDriver
*/
public
function
getStats
()
{
$totalFiles
=
0
;
$totalBytes
=
0
;
if
(
$this
->
enabled
)
{
$stats
=
$this
->
memcached
->
getStats
();
$key
=
self
::
HOST
.
':'
.
self
::
PORT
;
$totalFiles
=
isset
(
$stats
[
$key
][
'curr_items'
])
?
$stats
[
$key
][
'curr_items'
]
:
0
;
$totalBytes
=
isset
(
$stats
[
$key
][
'bytes'
])
?
$stats
[
$key
][
'bytes'
]
:
0
;
}
return
array
(
'files'
=>
$totalFiles
,
...
...
qa-include/app/options.php
View file @
88ba1a59
...
...
@@ -211,10 +211,7 @@ function qa_reset_options($names)
*/
function
qa_default_option
(
$name
)
{
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
if
(
qa_to_override
(
__FUNCTION__
))
{
$args
=
func_get_args
();
return
qa_call_override
(
__FUNCTION__
,
$args
);
}
$fixed_defaults
=
array
(
'allow_anonymous_naming'
=>
1
,
...
...
@@ -237,6 +234,7 @@ function qa_default_option($name)
'avatar_store_size'
=>
400
,
'avatar_users_size'
=>
30
,
'caching_catwidget_time'
=>
30
,
'caching_driver'
=>
'filesystem'
,
'caching_enabled'
=>
0
,
'caching_q_start'
=>
7
,
'caching_q_time'
=>
30
,
...
...
qa-include/lang/qa-lang-options.php
View file @
88ba1a59
...
...
@@ -50,6 +50,9 @@ return array(
'block_ips_write'
=>
'Blocked IP addresses - separate by spaces or commas:'
,
'caching_catwidget_time'
=>
'Cache category widget for:'
,
'caching_enabled'
=>
'Enable caching:'
,
'caching_driver'
=>
'Caching driver'
,
'caching_filesystem'
=>
'Filesystem'
,
'caching_memcached'
=>
'Memcached'
,
'caching_q_start'
=>
'Start caching questions after:'
,
'caching_q_time'
=>
'Cache question pages for:'
,
'caching_qlist_time'
=>
'Cache question lists for:'
,
...
...
qa-include/pages/admin/admin-default.php
View file @
88ba1a59
...
...
@@ -650,7 +650,7 @@ switch ($adminsection) {
$subtitle
=
'admin/caching_title'
;
$formstyle
=
'wide'
;
$showoptions
=
array
(
'caching_enabled'
,
'caching_q_start'
,
'caching_q_time'
,
'caching_qlist_time'
,
'caching_catwidget_time'
);
$showoptions
=
array
(
'caching_enabled'
,
'caching_
driver'
,
'caching_
q_start'
,
'caching_q_time'
,
'caching_qlist_time'
,
'caching_catwidget_time'
);
break
;
...
...
@@ -1551,6 +1551,13 @@ foreach ($showoptions as $optionname) {
$optionfield
[
'suffix'
]
=
qa_lang_html
(
'admin/emails_per_minute'
);
break
;
case
'caching_driver'
:
qa_optionfield_make_select
(
$optionfield
,
array
(
'filesystem'
=>
qa_lang_html
(
'options/caching_filesystem'
),
'memcached'
=>
qa_lang_html
(
'options/caching_memcached'
),
),
$value
,
'filesystem'
);
break
;
case
'caching_q_time'
:
case
'caching_qlist_time'
:
case
'caching_catwidget_time'
:
...
...
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