Standards, what else?
This commit is contained in:
parent
1a436264cd
commit
132688d663
4
boot.php
4
boot.php
|
@ -449,9 +449,9 @@ define ('NULL_DATE', '0001-01-01 00:00:00');
|
|||
|
||||
|
||||
// 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.
|
||||
|
|
|
@ -214,11 +214,13 @@ function cron_poll_contacts($argc, $argv) {
|
|||
|
||||
$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.
|
||||
|
|
|
@ -364,11 +364,11 @@ function poller_kill_stale_workers() {
|
|||
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
|
||||
|
@ -400,6 +400,7 @@ function poller_kill_stale_workers() {
|
|||
} else
|
||||
logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -558,9 +559,9 @@ function poller_worker_process() {
|
|||
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
|
||||
|
@ -570,9 +571,9 @@ function poller_worker_process() {
|
|||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,12 +239,12 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
|||
);
|
||||
|
||||
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"];
|
||||
|
@ -465,10 +465,10 @@ function poco_last_updated($profile, $force = false) {
|
|||
$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"];
|
||||
}
|
||||
|
@ -664,10 +664,11 @@ function poco_last_updated($profile, $force = false) {
|
|||
}
|
||||
|
||||
// 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)));
|
||||
|
||||
|
@ -946,10 +947,10 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
|||
$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"];
|
||||
|
||||
|
|
|
@ -538,9 +538,9 @@ function contacts_content(App $a) {
|
|||
? 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));
|
||||
|
@ -560,10 +560,10 @@ function contacts_content(App $a) {
|
|||
|
||||
$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));
|
||||
|
||||
|
|
|
@ -233,11 +233,11 @@ function profiles_post(App $a) {
|
|||
|
||||
$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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user