updated etxlink, ctools, colorbox, computed_field
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
* defaults to session_id().
|
||||
*
|
||||
* @deprecated $skip_cache is deprecated in favor of drupal_static*
|
||||
*
|
||||
* @return
|
||||
* The data that was cached.
|
||||
*/
|
||||
@@ -42,8 +43,11 @@ function ctools_object_cache_get($obj, $name, $skip_cache = FALSE, $sid = NULL)
|
||||
}
|
||||
|
||||
if (!array_key_exists($key, $cache)) {
|
||||
$data = db_query('SELECT * FROM {ctools_object_cache} WHERE sid = :session_id AND obj = :object AND name = :name', array(':session_id' => $sid, ':object' => $obj, ':name' => $name))
|
||||
->fetchObject();
|
||||
$data = db_query('SELECT * FROM {ctools_object_cache} WHERE sid = :session_id AND obj = :object AND name = :name', array(
|
||||
':session_id' => $sid,
|
||||
':object' => $obj,
|
||||
':name' => md5($name),
|
||||
))->fetchObject();
|
||||
if ($data) {
|
||||
$cache[$key] = unserialize($data->data);
|
||||
}
|
||||
@@ -83,7 +87,7 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) {
|
||||
->fields(array(
|
||||
'sid' => $sid,
|
||||
'obj' => $obj,
|
||||
'name' => $name,
|
||||
'name' => md5($name),
|
||||
'data' => serialize($cache),
|
||||
'updated' => REQUEST_TIME,
|
||||
))
|
||||
@@ -91,7 +95,7 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an object from the non-volatile ctools cache
|
||||
* Remove an object from the non-volatile ctools cache.
|
||||
*
|
||||
* @param $obj
|
||||
* A 128 character or less string to define what kind of object is being
|
||||
@@ -103,7 +107,6 @@ function ctools_object_cache_set($obj, $name, $cache, $sid = NULL) {
|
||||
* defaults to session_id().
|
||||
*/
|
||||
function ctools_object_cache_clear($obj, $name, $sid = NULL) {
|
||||
|
||||
if (!$sid) {
|
||||
$sid = session_id();
|
||||
}
|
||||
@@ -111,13 +114,12 @@ function ctools_object_cache_clear($obj, $name, $sid = NULL) {
|
||||
db_delete('ctools_object_cache')
|
||||
->condition('sid', $sid)
|
||||
->condition('obj', $obj)
|
||||
->condition('name', $name)
|
||||
->condition('name', md5($name))
|
||||
->execute();
|
||||
// Ensure the static cache is emptied of this obj:name set.
|
||||
drupal_static_reset('ctools_object_cache_get');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine if another user has a given object cached.
|
||||
*
|
||||
@@ -142,8 +144,11 @@ function ctools_object_cache_test($obj, $name, $sid = NULL) {
|
||||
$sid = session_id();
|
||||
}
|
||||
|
||||
return db_query('SELECT s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE s.sid <> :session_id AND c.obj = :obj AND c.name = :name ORDER BY c.updated ASC', array(':session_id' => $sid, ':obj' => $obj, ':name' => $name))
|
||||
->fetchObject();
|
||||
return db_query('SELECT s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE s.sid <> :session_id AND c.obj = :obj AND c.name = :name ORDER BY c.updated ASC', array(
|
||||
':session_id' => $sid,
|
||||
':obj' => $obj,
|
||||
':name' => md5($name),
|
||||
))->fetchObject();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,6 +167,7 @@ function ctools_object_cache_test($obj, $name, $sid = NULL) {
|
||||
* An array of objects containing the UID and updated date for each name found.
|
||||
*/
|
||||
function ctools_object_cache_test_objects($obj, $names) {
|
||||
array_walk($names, 'md5');
|
||||
return db_query("SELECT c.name, s.uid, c.updated FROM {ctools_object_cache} c INNER JOIN {sessions} s ON c.sid = s.sid WHERE c.obj = :obj AND c.name IN (:names) ORDER BY c.updated ASC", array(':obj' => $obj, ':names' => $names))
|
||||
->fetchAllAssoc('name');
|
||||
}
|
||||
@@ -180,7 +186,7 @@ function ctools_object_cache_test_objects($obj, $names) {
|
||||
function ctools_object_cache_clear_all($obj, $name) {
|
||||
db_delete('ctools_object_cache')
|
||||
->condition('obj', $obj)
|
||||
->condition('name', $name)
|
||||
->condition('name', md5($name))
|
||||
->execute();
|
||||
// Ensure the static cache is emptied of this obj:name set.
|
||||
$cache = &drupal_static('ctools_object_cache_get', array());
|
||||
@@ -197,7 +203,8 @@ function ctools_object_cache_clear_all($obj, $name) {
|
||||
*/
|
||||
function ctools_object_cache_clean($age = NULL) {
|
||||
if (empty($age)) {
|
||||
$age = 86400 * 7; // 7 days
|
||||
// 7 days.
|
||||
$age = 86400 * 7;
|
||||
}
|
||||
db_delete('ctools_object_cache')
|
||||
->condition('updated', REQUEST_TIME - $age, '<')
|
||||
|
||||
Reference in New Issue
Block a user