- if(count($r)) {
-
- foreach($r as $contact) {
- if(!$contact['self']) {
- if(($contact['network'] === NETWORK_DIASPORA) && ($public_message))
- continue;
- q("INSERT INTO `deliverq` (`cmd`,`item`,`contact`) VALUES ('%s', %d, %d)",
- dbesc($cmd),
- intval($item_id),
- intval($contact['id'])
- );
- }
- }
-
-
- // This controls the number of deliveries to execute with each separate delivery process.
- // By default we'll perform one delivery per process. Assuming a hostile shared hosting
- // provider, this provides the greatest chance of deliveries if processes start getting
- // killed. We can also space them out with the delivery_interval to also help avoid them
- // getting whacked.
-
- // If $deliveries_per_process > 1, we will chain this number of multiple deliveries
- // together into a single process. This will reduce the overall number of processes
- // spawned for each delivery, but they will run longer.
-
- // When using the workerqueue, we don't need this functionality.
-
- $deliveries_per_process = intval(get_config('system','delivery_batch_count'));
- if (($deliveries_per_process <= 0) OR get_config("system", "worker"))
- $deliveries_per_process = 1;
-
- $this_batch = array();
-
- for($x = 0; $x < count($r); $x ++) {
- $contact = $r[$x];
-
- if($contact['self'])
+ if (dbm::is_result($r)) {
+ foreach ($r as $contact) {
+ if ($contact['self']) {