diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-23 20:06:36 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-23 20:06:36 +0000 |
commit | 5595bf0ccbd10869f20ccd0ee4f7ad1935956408 (patch) | |
tree | 89a6c4cdee7b479992fb856fe359f53a474160e2 /engine/lib/entities.php | |
parent | 14907be8f9af6f5ef681ce49b82c3b83df52b8a1 (diff) | |
download | elgg-5595bf0ccbd10869f20ccd0ee4f7ad1935956408.tar.gz elgg-5595bf0ccbd10869f20ccd0ee4f7ad1935956408.tar.bz2 |
Added remove_subtype() and update_subtype().
git-svn-id: http://code.elgg.org/elgg/trunk@5488 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index fd46b062d..e3fa0cb52 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1462,6 +1462,44 @@ function add_subtype($type, $subtype, $class = "") { } /** + * Removes a registered subtype + * + * @param string $type + * @param string $subtype + */ +function remove_subtype($type, $subtype) { + global $CONFIG; + + $type = sanitise_string($type); + $subtype = sanitise_string($subtype); + + return delete_data("DELETE FROM {$CONFIG->dbprefix}entity_subtypes WHERE type = '$type' AND subtype = '$subtype'"); +} + +/** + * Update the registered information + * + * @param string $type + * @param string $subtype + * @param string $class + */ +function update_subtype($type, $subtype, $class = '') { + global $CONFIG; + + if (!$id = get_subtype_id($type, $subtype)) { + return FALSE; + } + $type = sanitise_string($type); + $subtype = sanitise_string($subtype); + + return update_data("UPDATE {$CONFIG->dbprefix}entity_subtypes + SET type = '$type', subtype = '$subtype', class = '$class' + WHERE id = $id + "); +} + + +/** * Update an existing entity. * * @param int $guid |