Commit 22b02ebf authored by JonBob's avatar JonBob

Caching ahoy!

parent 0a1feead
......@@ -154,7 +154,15 @@ function content_access($op, $node) {
* Implementation of hook_load().
*/
function content_load($node) {
return _content_field_invoke('load', $node);
$cid = 'content:'. $node->nid;
if ($cached = cache_get($cid)) {
return unserialize($cached->data);
}
else {
$additions = _content_field_invoke('load', $node);
cache_set($cid, serialize($additions), CACHE_PERMANENT);
return $additions;
}
}
/**
......@@ -169,6 +177,7 @@ function content_insert($node) {
*/
function content_update($node) {
_content_field_invoke('update', $node);
cache_clear_all('content:'. $node->nid);
}
/**
......@@ -176,6 +185,7 @@ function content_update($node) {
*/
function content_delete($node) {
_content_field_invoke('delete', $node);
cache_clear_all('content:'. $node->nid);
}
/**
......
......@@ -454,7 +454,7 @@ function field_field($op, $node, $field, $a2, $a3, $a4) {
if (is_array($node_field)) {
foreach ($node_field as $delta => $item) {
if ($item['value'] != '') {
if (preg_match('/[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}/', $item['value']) {
if (preg_match('/[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}/', $item['value'])) {
form_set_error($field['field_name'] .']['. $delta .'][value', t('%name must be entered in ISO 8601 format (YYYYMMDDThh:mm:ss).', array('%name' => t($field['label']))));
}
}
......@@ -464,7 +464,7 @@ function field_field($op, $node, $field, $a2, $a3, $a4) {
else {
if (isset($node_field['value'])) {
if ($node_field['value'] != '') {
if (preg_match('/[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}/', $node_field['value']) {
if (preg_match('/[0-9]{8}T[0-9]{2}:[0-9]{2}:[0-9]{2}/', $node_field['value'])) {
form_set_error($field['field_name'] .'][value', t('%name must be entered in ISO 8601 format (YYYYMMDDThh:mm:ss).', array('%name' => t($field['label']))));
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment