aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/access.php4
-rw-r--r--engine/lib/annotations.php4
-rw-r--r--engine/lib/elgglib.php2
-rw-r--r--engine/lib/entities.php6
-rw-r--r--engine/lib/metadata.php11
5 files changed, 19 insertions, 8 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index dba1e1ec6..6be252c6a 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -671,8 +671,10 @@ function add_user_to_access_collection($user_guid, $collection_id) {
return false;
}
+ // if someone tries to insert the same data twice, we do a no-op on duplicate key
$q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership
- SET access_collection_id = {$collection_id}, user_guid = {$user_guid}";
+ SET access_collection_id = $collection_id, user_guid = $user_guid
+ ON DUPLICATE KEY UPDATE user_guid = user_guid";
$result = insert_data($q);
return $result !== false;
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 5049d455b..f32dee0f0 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -209,9 +209,11 @@ function elgg_get_annotations(array $options = array()) {
* Deletes annotations based on $options.
*
* @warning Unlike elgg_get_annotations() this will not accept an empty options array!
+ * This requires at least one constraint: annotation_owner_guid(s),
+ * annotation_name(s), annotation_value(s), or guid(s) must be set.
*
* @param array $options An options array. {@See elgg_get_annotations()}
- * @return mixed
+ * @return mixed Null if the metadata name is invalid. Bool on success or fail.
* @since 1.8.0
*/
function elgg_delete_annotations(array $options) {
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 98e7af2a9..476408c61 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -1970,7 +1970,7 @@ function elgg_is_valid_options_for_batch_operation($options, $type) {
// at least one of these is required.
$required = array(
// generic restraints
- 'guid', 'guids', 'limit'
+ 'guid', 'guids'
);
switch ($type) {
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index f3bf9fb29..67011b802 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -1378,6 +1378,10 @@ function disable_entity($guid, $reason = "", $recursive = true) {
}
if ($recursive) {
+ $hidden = 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
@@ -1391,6 +1395,8 @@ function disable_entity($guid, $reason = "", $recursive = true) {
$e->disable($reason);
}
}
+ access_show_hidden_entities($hidden);
+ elgg_set_ignore_access($ia);
}
$entity->disableMetadata();
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 19e8aa3c8..012c73ad9 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -294,11 +294,11 @@ function elgg_get_metadata(array $options = array()) {
* Deletes metadata based on $options.
*
* @warning Unlike elgg_get_metadata() this will not accept an empty options array!
- * This requires some constraints: metadata_owner_guid(s),
- * metadata_name(s), metadata_value(s), or limit must be set.
+ * This requires at least one constraint: metadata_owner_guid(s),
+ * metadata_name(s), metadata_value(s), or guid(s) must be set.
*
- * @param array $options An options array. {@See elgg_get_metadata()}
- * @return mixed
+ * @param array $options An options array. {@see elgg_get_metadata()}
+ * @return mixed Null if the metadata name is invalid. Bool on success or fail.
* @since 1.8.0
*/
function elgg_delete_metadata(array $options) {
@@ -307,7 +307,8 @@ function elgg_delete_metadata(array $options) {
}
$options['metastring_type'] = 'metadata';
- return elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback');
+ $result = elgg_batch_metastring_based_objects($options, 'elgg_batch_delete_callback');
+ return $result;
}
/**