aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/group.php2
-rw-r--r--include/items.php9
2 files changed, 10 insertions, 1 deletions
diff --git a/include/group.php b/include/group.php
index 8866104fc..d1b336946 100644
--- a/include/group.php
+++ b/include/group.php
@@ -161,7 +161,7 @@ $o .= <<< EOT
EOT;
- $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d",
+ $r = q("SELECT * FROM `group` WHERE `deleted` = 0 AND `uid` = %d ORDER BY `name` ASC",
intval($_SESSION['uid'])
);
if(count($r)) {
diff --git a/include/items.php b/include/items.php
index cbf5e4d24..fbcac30cd 100644
--- a/include/items.php
+++ b/include/items.php
@@ -742,6 +742,15 @@ function item_store($arr,$force_parent = false) {
$arr['uri'], // already dbesc'd
intval($arr['uid'])
);
+ if(! count($r)) {
+ // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again.
+ sleep(3);
+ $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ $arr['uri'], // already dbesc'd
+ intval($arr['uid'])
+ );
+ }
+
if(count($r)) {
$current_post = $r[0]['id'];
logger('item_store: created item ' . $current_post);