aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 10313fc8c..927be4b1d 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -772,7 +772,7 @@ function elgg_entity_exists($guid) {
*
* callback => string A callback function to pass each row through
*
- * @return mixed int if count is true, an array of entity objects, or false on failure
+ * @return mixed if count, int. if not count, array or false if no entities. false also on errors.
* @since 1.7.0
* @see elgg_get_entities_from_metadata()
* @see elgg_get_entities_from_relationship()
@@ -846,9 +846,6 @@ function elgg_get_entities(array $options = array()) {
$wheres[] = elgg_get_entity_time_where_sql('e', $options['created_time_upper'],
$options['created_time_lower'], $options['modified_time_upper'], $options['modified_time_lower']);
- // remove identical where clauses
- $wheres = array_unique($wheres);
-
// see if any functions failed
// remove empty strings on successful functions
foreach ($wheres as $i => $where) {
@@ -859,6 +856,9 @@ function elgg_get_entities(array $options = array()) {
}
}
+ // remove identical where clauses
+ $wheres = array_unique($wheres);
+
// evaluate join clauses
if (!is_array($options['joins'])) {
$options['joins'] = array($options['joins']);
@@ -1118,8 +1118,12 @@ function elgg_get_guid_based_where_sql($column, $guids) {
$guids_sanitized = array();
foreach ($guids as $guid) {
- if (($guid != sanitise_int($guid))) {
- return FALSE;
+ if ($guid !== ELGG_ENTITIES_NO_VALUE) {
+ $guid = sanitise_int($guid);
+
+ if (!$guid) {
+ return false;
+ }
}
$guids_sanitized[] = $guid;
}
@@ -1494,6 +1498,7 @@ function delete_entity($guid, $recursive = true) {
$entity_disable_override = access_get_show_hidden_status();
access_show_hidden_entities(true);
+ $ia = elgg_set_ignore_access(true);
$sub_entities = get_data("SELECT * from {$CONFIG->dbprefix}entities
WHERE container_guid=$guid
or owner_guid=$guid
@@ -1506,6 +1511,7 @@ function delete_entity($guid, $recursive = true) {
access_show_hidden_entities($entity_disable_override);
$__RECURSIVE_DELETE_TOKEN = null;
+ elgg_set_ignore_access($ia);
}
// Now delete the entity itself
@@ -1515,8 +1521,8 @@ function delete_entity($guid, $recursive = true) {
$entity->deleteOwnedAnnotations();
$entity->deleteRelationships();
- remove_from_river_by_subject($guid);
- remove_from_river_by_object($guid);
+ elgg_delete_river(array('subject_guid' => $guid));
+ elgg_delete_river(array('object_guid' => $guid));
remove_all_private_settings($guid);
$res = delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}");