mirror of
https://github.com/friendica/friendica
synced 2025-04-29 13:44:23 +02:00
Add Temporal::utcNow()
This commit is contained in:
parent
38ff1b455b
commit
8aff8a76eb
51 changed files with 191 additions and 180 deletions
|
@ -1406,8 +1406,8 @@ class DFRN
|
|||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
|
||||
intval($contact["uid"]),
|
||||
intval($contact["id"]),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::convert($birthday)),
|
||||
dbesc(Temporal::convert($birthday . " + 1 day ")),
|
||||
dbesc($bdtext),
|
||||
|
@ -1889,7 +1889,7 @@ class DFRN
|
|||
intval($suggest["cid"]),
|
||||
dbesc($suggest["body"]),
|
||||
dbesc($hash),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
intval(0)
|
||||
);
|
||||
|
||||
|
@ -2086,7 +2086,7 @@ class DFRN
|
|||
}
|
||||
|
||||
$fields = ['title' => $item["title"], 'body' => $item["body"],
|
||||
'tag' => $item["tag"], 'changed' => Temporal::convert(),
|
||||
'tag' => $item["tag"], 'changed' => Temporal::utcNow(),
|
||||
'edited' => Temporal::convert($item["edited"])];
|
||||
|
||||
$condition = ["`uri` = ? AND `uid` IN (0, ?)", $item["uri"], $importer["importer_uid"]];
|
||||
|
@ -2836,7 +2836,7 @@ class DFRN
|
|||
`body` = '', `title` = ''
|
||||
WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
|
||||
dbesc($when),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc($uri),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
|
@ -2849,7 +2849,7 @@ class DFRN
|
|||
`body` = '', `title` = ''
|
||||
WHERE `uri` = '%s' AND `uid` IN (0, %d)",
|
||||
dbesc($when),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc($uri),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
|
|
|
@ -77,7 +77,7 @@ class Diaspora
|
|||
$r = q(
|
||||
"INSERT INTO `contact` (`uid`, `created`, `name`, `nick`, `addr`, `url`, `nurl`, `batch`, `network`, `rel`, `blocked`, `pending`, `writable`, `name-date`, `uri-date`, `avatar-date`)
|
||||
VALUES (0, '%s', '%s', 'relay', '%s', '%s', '%s', '%s', '%s', %d, 0, 0, 1, '%s', '%s', '%s')",
|
||||
Temporal::convert(),
|
||||
Temporal::utcNow(),
|
||||
dbesc($addr),
|
||||
dbesc($addr),
|
||||
dbesc($server),
|
||||
|
@ -85,9 +85,9 @@ class Diaspora
|
|||
dbesc($batch),
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
intval(CONTACT_IS_FOLLOWER),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert())
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utcNow())
|
||||
);
|
||||
|
||||
$relais = q("SELECT `batch`, `id`, `name`,`network` FROM `contact` WHERE `uid` = 0 AND `batch` = '%s' LIMIT 1", dbesc($batch));
|
||||
|
@ -871,7 +871,7 @@ class Diaspora
|
|||
dbesc($arr["confirm"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc($arr["url"]),
|
||||
dbesc($arr["network"])
|
||||
);
|
||||
|
@ -894,7 +894,7 @@ class Diaspora
|
|||
dbesc($arr["network"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(Temporal::convert())
|
||||
dbesc(Temporal::utcNow())
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1656,7 +1656,7 @@ class Diaspora
|
|||
if (isset($data->created_at)) {
|
||||
$created_at = Temporal::convert(notags(unxmlify($data->created_at)));
|
||||
} else {
|
||||
$created_at = Temporal::convert();
|
||||
$created_at = Temporal::utcNow();
|
||||
}
|
||||
|
||||
if (isset($data->thread_parent_guid)) {
|
||||
|
@ -1831,7 +1831,7 @@ class Diaspora
|
|||
|
||||
dba::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
|
||||
dba::update('conv', ['updated' => Temporal::utcNow()], ['id' => $conversation["id"]]);
|
||||
|
||||
notification(
|
||||
[
|
||||
|
@ -1897,7 +1897,7 @@ class Diaspora
|
|||
dbesc($guid),
|
||||
dbesc($author),
|
||||
dbesc($created_at),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc($subject),
|
||||
dbesc($participants)
|
||||
);
|
||||
|
@ -2164,7 +2164,7 @@ class Diaspora
|
|||
|
||||
dba::unlock();
|
||||
|
||||
dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
|
||||
dba::update('conv', ['updated' => Temporal::utcNow()], ['id' => $conversation["id"]]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2331,7 +2331,7 @@ class Diaspora
|
|||
dbesc($name),
|
||||
dbesc($nick),
|
||||
dbesc($author),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc($birthday),
|
||||
dbesc($location),
|
||||
dbesc($about),
|
||||
|
@ -2537,7 +2537,7 @@ class Diaspora
|
|||
intval($importer["uid"]),
|
||||
dbesc($ret["network"]),
|
||||
dbesc($ret["addr"]),
|
||||
Temporal::convert(),
|
||||
Temporal::utcNow(),
|
||||
dbesc($ret["url"]),
|
||||
dbesc(normalise_link($ret["url"])),
|
||||
dbesc($batch),
|
||||
|
@ -2580,7 +2580,7 @@ class Diaspora
|
|||
0,
|
||||
dbesc(L10n::t("Sharing notification from Diaspora network")),
|
||||
dbesc($hash),
|
||||
dbesc(Temporal::convert())
|
||||
dbesc(Temporal::utcNow())
|
||||
);
|
||||
} else {
|
||||
// automatic friend approval
|
||||
|
@ -2611,8 +2611,8 @@ class Diaspora
|
|||
WHERE `id` = %d
|
||||
",
|
||||
intval($new_relation),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
intval($contact_record["id"])
|
||||
);
|
||||
|
||||
|
@ -2852,8 +2852,8 @@ class Diaspora
|
|||
'deleted' => true,
|
||||
'title' => '',
|
||||
'body' => '',
|
||||
'edited' => Temporal::convert(),
|
||||
'changed' => Temporal::convert()],
|
||||
'edited' => Temporal::utcNow(),
|
||||
'changed' => Temporal::utcNow()],
|
||||
['id' => $item["id"]]
|
||||
);
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ class OStatus
|
|||
$contact["location"] = $value;
|
||||
}
|
||||
|
||||
$contact['name-date'] = Temporal::convert();
|
||||
$contact['name-date'] = Temporal::utcNow();
|
||||
|
||||
dba::update('contact', $contact, ['id' => $contact["id"]], $current);
|
||||
|
||||
|
@ -220,7 +220,7 @@ class OStatus
|
|||
'nurl' => normalise_link($author["author-link"]),
|
||||
'nick' => $contact["nick"], 'alias' => $contact["alias"],
|
||||
'about' => $contact["about"], 'location' => $contact["location"],
|
||||
'success_update' => Temporal::convert(), 'last-update' => Temporal::convert()];
|
||||
'success_update' => Temporal::utcNow(), 'last-update' => Temporal::utcNow()];
|
||||
|
||||
dba::update('contact', $fields, ['id' => $cid], $old_contact);
|
||||
|
||||
|
@ -558,7 +558,7 @@ class OStatus
|
|||
dba::update(
|
||||
'item',
|
||||
['deleted' => true, 'title' => '', 'body' => '',
|
||||
'edited' => Temporal::convert(), 'changed' => Temporal::convert()],
|
||||
'edited' => Temporal::utcNow(), 'changed' => Temporal::utcNow()],
|
||||
['id' => $deleted["id"]]
|
||||
);
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ class PortableContact
|
|||
$contact = ["url" => $profile];
|
||||
|
||||
if ($gcontacts[0]["created"] <= NULL_DATE) {
|
||||
$contact['created'] = Temporal::convert();
|
||||
$contact['created'] = Temporal::utcNow();
|
||||
}
|
||||
|
||||
if ($force) {
|
||||
|
@ -338,7 +338,7 @@ class PortableContact
|
|||
if ($server_url != "") {
|
||||
if (!self::checkServer($server_url, $gcontacts[0]["network"], $force)) {
|
||||
if ($force) {
|
||||
$fields = ['last_failure' => Temporal::convert()];
|
||||
$fields = ['last_failure' => Temporal::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
}
|
||||
|
||||
|
@ -412,14 +412,14 @@ class PortableContact
|
|||
|
||||
// Set the date of the last contact
|
||||
/// @todo By now the function "update_gcontact" doesn't work with this field
|
||||
//$contact["last_contact"] = Temporal::convert();
|
||||
//$contact["last_contact"] = Temporal::utcNow();
|
||||
|
||||
$contact = array_merge($contact, $noscrape);
|
||||
|
||||
GContact::update($contact);
|
||||
|
||||
if (trim($noscrape["updated"]) != "") {
|
||||
$fields = ['last_contact' => Temporal::convert()];
|
||||
$fields = ['last_contact' => Temporal::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." was last updated at ".$noscrape["updated"]." (noscrape)", LOGGER_DEBUG);
|
||||
|
@ -468,7 +468,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
if (($data["poll"] == "") || (in_array($data["network"], [NETWORK_FEED, NETWORK_PHANTOM]))) {
|
||||
$fields = ['last_failure' => Temporal::convert()];
|
||||
$fields = ['last_failure' => Temporal::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (profile)", LOGGER_DEBUG);
|
||||
|
@ -484,7 +484,7 @@ class PortableContact
|
|||
$feedret = Network::curl($data["poll"]);
|
||||
|
||||
if (!$feedret["success"]) {
|
||||
$fields = ['last_failure' => Temporal::convert()];
|
||||
$fields = ['last_failure' => Temporal::utcNow()];
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
logger("Profile ".$profile." wasn't reachable (no feed)", LOGGER_DEBUG);
|
||||
|
@ -533,7 +533,7 @@ class PortableContact
|
|||
|
||||
public static function updateNeeded($created, $updated, $last_failure, $last_contact)
|
||||
{
|
||||
$now = strtotime(Temporal::convert());
|
||||
$now = strtotime(Temporal::utcNow());
|
||||
|
||||
if ($updated > $last_contact) {
|
||||
$contact_time = strtotime($updated);
|
||||
|
@ -922,7 +922,7 @@ class PortableContact
|
|||
$gserver = dba::selectFirst('gserver', [], ['nurl' => normalise_link($server_url)]);
|
||||
if (DBM::is_result($gserver)) {
|
||||
if ($gserver["created"] <= NULL_DATE) {
|
||||
$fields = ['created' => Temporal::convert()];
|
||||
$fields = ['created' => Temporal::utcNow()];
|
||||
$condition = ['nurl' => normalise_link($server_url)];
|
||||
dba::update('gserver', $fields, $condition);
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ class PortableContact
|
|||
// Mastodon uses the "@" for user profiles.
|
||||
// But this can be misunderstood.
|
||||
if (parse_url($server_url, PHP_URL_USER) != '') {
|
||||
dba::update('gserver', ['last_failure' => Temporal::convert()], ['nurl' => normalise_link($server_url)]);
|
||||
dba::update('gserver', ['last_failure' => Temporal::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -985,7 +985,7 @@ class PortableContact
|
|||
if (DBM::is_result($gserver) && ($orig_server_url == $server_url) &&
|
||||
($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
dba::update('gserver', ['last_failure' => Temporal::convert()], ['nurl' => normalise_link($server_url)]);
|
||||
dba::update('gserver', ['last_failure' => Temporal::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1000,7 +1000,7 @@ class PortableContact
|
|||
// Quit if there is a timeout
|
||||
if ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||
dba::update('gserver', ['last_failure' => Temporal::convert()], ['nurl' => normalise_link($server_url)]);
|
||||
dba::update('gserver', ['last_failure' => Temporal::utcNow()], ['nurl' => normalise_link($server_url)]);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1332,9 +1332,9 @@ class PortableContact
|
|||
|
||||
if ($failure) {
|
||||
$last_contact = $orig_last_contact;
|
||||
$last_failure = Temporal::convert();
|
||||
$last_failure = Temporal::utcNow();
|
||||
} else {
|
||||
$last_contact = Temporal::convert();
|
||||
$last_contact = Temporal::utcNow();
|
||||
$last_failure = $orig_last_failure;
|
||||
}
|
||||
|
||||
|
@ -1362,7 +1362,7 @@ class PortableContact
|
|||
dba::update('gserver', $fields, ['nurl' => normalise_link($server_url)]);
|
||||
} elseif (!$failure) {
|
||||
$fields['nurl'] = normalise_link($server_url);
|
||||
$fields['created'] = Temporal::convert();
|
||||
$fields['created'] = Temporal::utcNow();
|
||||
dba::insert('gserver', $fields);
|
||||
}
|
||||
logger("End discovery for server " . $server_url, LOGGER_DEBUG);
|
||||
|
@ -1526,7 +1526,7 @@ class PortableContact
|
|||
}
|
||||
}
|
||||
|
||||
$fields = ['last_poco_query' => Temporal::convert()];
|
||||
$fields = ['last_poco_query' => Temporal::utcNow()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
|
||||
return true;
|
||||
|
@ -1535,7 +1535,7 @@ class PortableContact
|
|||
self::checkServer($server["url"], $server["network"], true);
|
||||
|
||||
// If we couldn't reach the server, we will try it some time later
|
||||
$fields = ['last_poco_query' => Temporal::convert()];
|
||||
$fields = ['last_poco_query' => Temporal::utcNow()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
|
||||
return false;
|
||||
|
@ -1561,7 +1561,7 @@ class PortableContact
|
|||
foreach ($r as $server) {
|
||||
if (!self::checkServer($server["url"], $server["network"])) {
|
||||
// The server is not reachable? Okay, then we will try it later
|
||||
$fields = ['last_poco_query' => Temporal::convert()];
|
||||
$fields = ['last_poco_query' => Temporal::utcNow()];
|
||||
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue