mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 08:22:07 +02:00
MDL-36381 cachestores: fixed bug when editing with checkbox/bool
This commit is contained in:
parent
067200e212
commit
d837df0d77
11
cache/stores/file/lib.php
vendored
11
cache/stores/file/lib.php
vendored
@ -553,11 +553,14 @@ class cachestore_file implements cache_store, cache_is_key_aware {
|
||||
if (!empty($config['path'])) {
|
||||
$data['path'] = $config['path'];
|
||||
}
|
||||
if (!empty($config['autocreate'])) {
|
||||
$data['autocreate'] = $config['autocreate'];
|
||||
if (isset($config['autocreate'])) {
|
||||
$data['autocreate'] = (bool)$config['autocreate'];
|
||||
}
|
||||
if (!empty($config['prescan'])) {
|
||||
$data['prescan'] = $config['prescan'];
|
||||
if (isset($config['singledirectory'])) {
|
||||
$data['singledirectory'] = (bool)$config['singledirectory'];
|
||||
}
|
||||
if (isset($config['prescan'])) {
|
||||
$data['prescan'] = (bool)$config['prescan'];
|
||||
}
|
||||
$editform->set_data($data);
|
||||
}
|
||||
|
8
cache/stores/memcached/lib.php
vendored
8
cache/stores/memcached/lib.php
vendored
@ -408,8 +408,8 @@ class cachestore_memcached implements cache_store {
|
||||
}
|
||||
$data['servers'] = join("\n", $servers);
|
||||
}
|
||||
if (!empty($config['compression'])) {
|
||||
$data['compression'] = 1;
|
||||
if (isset($config['compression'])) {
|
||||
$data['compression'] = (bool)$config['compression'];
|
||||
}
|
||||
if (!empty($config['serialiser'])) {
|
||||
$data['serialiser'] = $config['serialiser'];
|
||||
@ -420,8 +420,8 @@ class cachestore_memcached implements cache_store {
|
||||
if (!empty($config['hash'])) {
|
||||
$data['hash'] = $config['hash'];
|
||||
}
|
||||
if (!empty($config['bufferwrites'])) {
|
||||
$data['bufferwrites'] = 1;
|
||||
if (isset($config['bufferwrites'])) {
|
||||
$data['bufferwrites'] = (bool)$config['bufferwrites'];
|
||||
}
|
||||
$editform->set_data($data);
|
||||
}
|
||||
|
15
cache/stores/mongodb/lib.php
vendored
15
cache/stores/mongodb/lib.php
vendored
@ -419,6 +419,7 @@ class cachestore_mongodb implements cache_store {
|
||||
$return['usesafe'] = true;
|
||||
if (!empty($data->usesafevalue)) {
|
||||
$return['usesafe'] = (int)$data->usesafevalue;
|
||||
$return['usesafevalue'] = $return['usesafe'];
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
@ -438,8 +439,8 @@ class cachestore_mongodb implements cache_store {
|
||||
if (!empty($config['database'])) {
|
||||
$data['database'] = $config['database'];
|
||||
}
|
||||
if (!empty($config['extendedmode'])) {
|
||||
$data['extendedmode'] = 1;
|
||||
if (isset($config['extendedmode'])) {
|
||||
$data['extendedmode'] = (bool)$config['extendedmode'];
|
||||
}
|
||||
if (!empty($config['username'])) {
|
||||
$data['username'] = $config['username'];
|
||||
@ -450,11 +451,11 @@ class cachestore_mongodb implements cache_store {
|
||||
if (!empty($config['replicaset'])) {
|
||||
$data['replicaset'] = $config['replicaset'];
|
||||
}
|
||||
if (!empty($config['usesafe'])) {
|
||||
$data['usesafe'] = 1;
|
||||
if ($data['usesafe'] !== true) {
|
||||
$data['usesafevalue'] = (int)$data['usesafe'];
|
||||
}
|
||||
if (isset($config['usesafevalue'])) {
|
||||
$data['usesafe'] = true;
|
||||
$data['usesafevalue'] = (int)$data['usesafe'];
|
||||
} else if (isset($config['usesafe'])) {
|
||||
$data['usesafe'] = (bool)$config['usesafe'];
|
||||
}
|
||||
$editform->set_data($data);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user