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
|
// Normally this constant is defined - but not if "pcntl" isn't installed
|
||||||
if (!defined("SIGTERM"))
|
if (!defined("SIGTERM")) {
|
||||||
define("SIGTERM", 15);
|
define("SIGTERM", 15);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Reverse the effect of magic_quotes_gpc if it is enabled.
|
* Reverse the effect of magic_quotes_gpc if it is enabled.
|
||||||
|
|
|
@ -214,11 +214,13 @@ function cron_poll_contacts($argc, $argv) {
|
||||||
|
|
||||||
$xml = false;
|
$xml = false;
|
||||||
|
|
||||||
if($manual_id)
|
if ($manual_id) {
|
||||||
$contact['last-update'] = NULL_DATE;
|
$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;
|
$contact['priority'] = 2;
|
||||||
|
}
|
||||||
|
|
||||||
if($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
|
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.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($r AS $pid)
|
foreach ($r AS $pid) {
|
||||||
if (!posix_kill($pid["pid"], 0))
|
if (!posix_kill($pid["pid"], 0)) {
|
||||||
q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = 0 WHERE `pid` = %d",
|
q("UPDATE `workerqueue` SET `executed` = '%s', `pid` = 0 WHERE `pid` = %d",
|
||||||
dbesc(NULL_DATE), intval($pid["pid"]));
|
dbesc(NULL_DATE), intval($pid["pid"]));
|
||||||
else {
|
} else {
|
||||||
// Kill long running processes
|
// Kill long running processes
|
||||||
|
|
||||||
// Check if the priority is in a valid range
|
// Check if the priority is in a valid range
|
||||||
|
@ -400,6 +400,7 @@ function poller_kill_stale_workers() {
|
||||||
} else
|
} else
|
||||||
logger("Worker process ".$pid["pid"]." (".implode(" ", $argv).") now runs for ".round($duration)." of ".$max_duration." allowed minutes. That's okay.", LOGGER_DEBUG);
|
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",
|
ORDER BY `priority`, `created` LIMIT 1",
|
||||||
dbesc(NULL_DATE),
|
dbesc(NULL_DATE),
|
||||||
intval($highest_priority));
|
intval($highest_priority));
|
||||||
if (dbm::is_result($r))
|
if (dbm::is_result($r)) {
|
||||||
return $r;
|
return $r;
|
||||||
|
}
|
||||||
// Give slower processes some processing time
|
// Give slower processes some processing time
|
||||||
$r = q("SELECT * FROM `workerqueue`
|
$r = q("SELECT * FROM `workerqueue`
|
||||||
WHERE `executed` <= '%s' AND `priority` > %d
|
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 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));
|
$r = q("SELECT * FROM `workerqueue` WHERE `executed` <= '%s' ORDER BY `priority`, `created` LIMIT 1", dbesc(NULL_DATE));
|
||||||
|
}
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -239,12 +239,12 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
|
||||||
);
|
);
|
||||||
|
|
||||||
if (count($x)) {
|
if (count($x)) {
|
||||||
if (($network == "") AND ($x[0]["network"] != NETWORK_STATUSNET))
|
if (($network == "") AND ($x[0]["network"] != NETWORK_STATUSNET)) {
|
||||||
$network = $x[0]["network"];
|
$network = $x[0]["network"];
|
||||||
|
}
|
||||||
if ($updated <= NULL_DATE)
|
if ($updated <= NULL_DATE) {
|
||||||
$updated = $x[0]["updated"];
|
$updated = $x[0]["updated"];
|
||||||
|
}
|
||||||
$created = $x[0]["created"];
|
$created = $x[0]["created"];
|
||||||
$server_url = $x[0]["server_url"];
|
$server_url = $x[0]["server_url"];
|
||||||
$nick = $x[0]["nick"];
|
$nick = $x[0]["nick"];
|
||||||
|
@ -465,10 +465,10 @@ function poco_last_updated($profile, $force = false) {
|
||||||
$gcontacts = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s'",
|
$gcontacts = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s'",
|
||||||
dbesc(normalise_link($profile)));
|
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'",
|
q("UPDATE `gcontact` SET `created` = '%s' WHERE `nurl` = '%s'",
|
||||||
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
|
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
|
||||||
|
}
|
||||||
if ($gcontacts[0]["server_url"] != "") {
|
if ($gcontacts[0]["server_url"] != "") {
|
||||||
$server_url = $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
|
// Maybe there aren't any entries. Then check if it is a valid feed
|
||||||
if ($last_updated == "")
|
if ($last_updated == "") {
|
||||||
if ($xpath->query('/atom:feed')->length > 0)
|
if ($xpath->query('/atom:feed')->length > 0) {
|
||||||
$last_updated = NULL_DATE;
|
$last_updated = NULL_DATE;
|
||||||
|
}
|
||||||
|
}
|
||||||
q("UPDATE `gcontact` SET `updated` = '%s', `last_contact` = '%s' WHERE `nurl` = '%s'",
|
q("UPDATE `gcontact` SET `updated` = '%s', `last_contact` = '%s' WHERE `nurl` = '%s'",
|
||||||
dbesc(dbm::date($last_updated)), dbesc(dbm::date()), dbesc(normalise_link($profile)));
|
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)));
|
$servers = q("SELECT * FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
|
||||||
if (dbm::is_result($servers)) {
|
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'",
|
q("UPDATE `gserver` SET `created` = '%s' WHERE `nurl` = '%s'",
|
||||||
dbesc(datetime_convert()), dbesc(normalise_link($server_url)));
|
dbesc(datetime_convert()), dbesc(normalise_link($server_url)));
|
||||||
|
}
|
||||||
$poco = $servers[0]["poco"];
|
$poco = $servers[0]["poco"];
|
||||||
$noscrape = $servers[0]["noscrape"];
|
$noscrape = $servers[0]["noscrape"];
|
||||||
|
|
||||||
|
|
|
@ -538,9 +538,9 @@ function contacts_content(App $a) {
|
||||||
? t('Never')
|
? t('Never')
|
||||||
: datetime_convert('UTC',date_default_timezone_get(),$contact['last-update'],'D, j M Y, g:i A'));
|
: 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"));
|
$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') : '');
|
$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));
|
$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!') : '');
|
$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'),
|
$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')));
|
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)))
|
if (in_array($contact['network'], array(NETWORK_FEED, NETWORK_MAIL, NETWORK_MAIL2)))
|
||||||
$poll_interval = contact_poll_interval($contact['priority'],(! $poll_enabled));
|
$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'])) : '');
|
$with = ((x($_POST,'with')) ? notags(trim($_POST['with'])) : '');
|
||||||
|
|
||||||
if(! strlen($howlong))
|
if(! strlen($howlong)) {
|
||||||
$howlong = NULL_DATE;
|
$howlong = NULL_DATE;
|
||||||
else
|
} else {
|
||||||
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
|
$howlong = datetime_convert(date_default_timezone_get(),'UTC',$howlong);
|
||||||
|
}
|
||||||
// linkify the relationship target if applicable
|
// linkify the relationship target if applicable
|
||||||
|
|
||||||
$withchanged = false;
|
$withchanged = false;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user