X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fitems.php;h=24eb1b30fb7b97c823238d2a2989b9d9413b589e;hb=9521f39ebea7603098e4f96f5edb6c85a40fc646;hp=2b6fb9a1fe046a1c5b3966dda84cb4520799dcc7;hpb=069dd5b75d83ed3f2c3a4b9f38292fe310a6a87d;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; }