// Normally this constant is defined - but not if "pcntl" isn't installed
-if (!defined("SIGTERM"))
+if (!defined("SIGTERM")) {
define("SIGTERM", 15);
-
+}
/**
*
* Reverse the effect of magic_quotes_gpc if it is enabled.
$xml = false;
- if($manual_id)
+ if ($manual_id) {
$contact['last-update'] = NULL_DATE;
+ }
- if(in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS)))
+ if (in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
$contact['priority'] = 2;
+ }
if($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
// We should be getting everything via a hub. But just to be sure, let's check once a day.
return;
}
- foreach($r AS $pid)
- if (!posix_kill($pid["pid"], 0))
+ foreach ($r AS $pid) {
+ if (!posix_kill($pid["pid"], 0)) {
q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = 0 WHERE `pid` = %d",
dbesc(NULL_DATE), intval($pid["pid"]));
- else {
+ } else {
// Kill long running processes
// Check if the priority is in a valid range
} else
logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
}
+ }
}
/**
ORDER BY `priority`, `created` LIMIT 1",
dbesc(NULL_DATE),
intval($highest_priority));
- if (dbm::is_result($r))
+ if (dbm::is_result($r)) {
return $r;
-
+ }
// Give slower processes some processing time
$r = q("SELECT * FROM `workerqueue`
WHERE `executed` <= '%s' AND `priority` > %d
}
// If there is no result (or we shouldn't pass lower processes) we check without priority limit
- if (($highest_priority == 0) OR !dbm::is_result($r))
+ if (($highest_priority == 0) OR !dbm::is_result($r)) {
$r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE));
-
+ }
return $r;
}
);
if (count($x)) {
- if (($network == "") AND ($x[0]["network"] != NETWORK_STATUSNET))
+ if (($network == "") AND ($x[0]["network"] != NETWORK_STATUSNET)) {
$network = $x[0]["network"];
-
- if ($updated <= NULL_DATE)
+ }
+ if ($updated <= NULL_DATE) {
$updated = $x[0]["updated"];
-
+ }
$created = $x[0]["created"];
$server_url = $x[0]["server_url"];
$nick = $x[0]["nick"];
$gcontacts = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s'",
dbesc(normalise_link($profile)));
- if ($gcontacts[0]["created"] <= NULL_DATE)
+ if ($gcontacts[0]["created"] <= NULL_DATE) {
q("UPDATE `gcontact` SET `created` = '%s' WHERE `nurl` = '%s'",
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
-
+ }
if ($gcontacts[0]["server_url"] != "") {
$server_url = $gcontacts[0]["server_url"];
}
}
// Maybe there aren't any entries. Then check if it is a valid feed
- if ($last_updated == "")
- if ($xpath->query('/atom:feed')->length > 0)
+ if ($last_updated == "") {
+ if ($xpath->query('/atom:feed')->length > 0) {
$last_updated = NULL_DATE;
-
+ }
+ }
q("UPDATE `gcontact` SET `updated` = '%s', `last_contact` = '%s' WHERE `nurl` = '%s'",
dbesc(dbm::date($last_updated)), dbesc(dbm::date()), dbesc(normalise_link($profile)));
$servers = q("SELECT * FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
if (dbm::is_result($servers)) {
- if ($servers[0]["created"] <= NULL_DATE)
+ if ($servers[0]["created"] <= NULL_DATE) {
q("UPDATE `gserver` SET `created` = '%s' WHERE `nurl` = '%s'",
dbesc(datetime_convert()), dbesc(normalise_link($server_url)));
-
+ }
$poco = $servers[0]["poco"];
$noscrape = $servers[0]["noscrape"];
? t('Never')
: datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
- if ($contact['last-update'] > NULL_DATE)
+ if ($contact['last-update'] > NULL_DATE) {
$last_update .= ' ' . (($contact['last-update'] <= $contact['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
-
+ }
$lblsuggest = (($contact['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
$poll_enabled = in_array($contact['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2));
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < datetime_convert('','','now')) ? t('Communications lost with this contact!') : '');
- if ($contact['network'] == NETWORK_FEED)
+ if ($contact['network'] == NETWORK_FEED) {
$fetch_further_information = array('fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t('Fetch further information for feeds'),
array('0'=>t('Disabled'), '1'=>t('Fetch information'), '2'=>t('Fetch information and keywords')));
-
+ }
if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)))
$poll_interval = contact_poll_interval($contact['priority'],(! $poll_enabled));
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
- if(! strlen($howlong))
+ if(! strlen($howlong)) {
$howlong = NULL_DATE;
- else
+ } else {
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
-
+ }
// linkify the relationship target if applicable
$withchanged = false;