aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2012-06-16 17:22:42 -0400
committerCash Costello <cash.costello@gmail.com>2012-06-16 17:22:42 -0400
commit65c3cca827ba5471cc1a49ad13178fc1aba6c964 (patch)
tree26c660a984b4140b3d674a144712a57434ba3468 /engine/lib/entities.php
parent0f64abea5d18ea883bf40c1712f72423a1d1317b (diff)
downloadelgg-65c3cca827ba5471cc1a49ad13178fc1aba6c964.tar.gz
elgg-65c3cca827ba5471cc1a49ad13178fc1aba6c964.tar.bz2
Fixes #4157 setting class name in cache when update_subtype() is called
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php12
1 files changed, 9 insertions, 3 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index c06e7fb99..ae5df66f7 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -331,7 +331,7 @@ function remove_subtype($type, $subtype) {
}
/**
- * Update a registered ElggEntity type, subtype, and classname
+ * Update a registered ElggEntity type, subtype, and class name
*
* @param string $type Type
* @param string $subtype Subtype
@@ -340,7 +340,7 @@ function remove_subtype($type, $subtype) {
* @return bool
*/
function update_subtype($type, $subtype, $class = '') {
- global $CONFIG;
+ global $CONFIG, $SUBTYPE_CACHE;
if (!$id = get_subtype_id($type, $subtype)) {
return FALSE;
@@ -348,10 +348,16 @@ function update_subtype($type, $subtype, $class = '') {
$type = sanitise_string($type);
$subtype = sanitise_string($subtype);
- return update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes
+ $result = update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes
SET type = '$type', subtype = '$subtype', class = '$class'
WHERE id = $id
");
+
+ if ($result && isset($SUBTYPE_CACHE[$id])) {
+ $SUBTYPE_CACHE[$id]->class = $class;
+ }
+
+ return $result;
}
/**