X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fitems.php;h=24eb1b30fb7b97c823238d2a2989b9d9413b589e;hb=45ebeba643a6d600e8778475f70f827f32bf3146;hp=2b6fb9a1fe046a1c5b3966dda84cb4520799dcc7;hpb=be7041c3e06ee5a799851ac3612849dde55a8198;p=friendica.git diff --git a/include/items.php b/include/items.php index 2b6fb9a1fe..24eb1b30fb 100644 --- a/include/items.php +++ b/include/items.php @@ -857,10 +857,15 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa } // Now we store the data in the spool directory - $file = 'item-'.round(microtime(true) * 10000).".msg"; - $spool = get_spoolpath().'/'.$file; - file_put_contents($spool, json_encode($arr)); - logger("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG); + // We use "microtime" to keep the arrival order and "mt_rand" to avoid duplicates + $file = 'item-'.round(microtime(true) * 10000).'-'.mt_rand().'.msg'; + + $spoolpath = get_spoolpath(); + if ($spoolpath != "") { + $spool = $spoolpath.'/'.$file; + file_put_contents($spool, json_encode($arr)); + logger("Item wasn't stored - Item was spooled into file ".$file, LOGGER_DEBUG); + } return 0; }