mirror of
https://github.com/friendica/friendica
synced 2025-04-28 03:10:11 +00:00
Add Temporal::utc() shorthand to Temporal::convert()
This commit is contained in:
parent
ca8209a2ce
commit
35d06bd9eb
22 changed files with 173 additions and 128 deletions
|
@ -229,7 +229,7 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
$check_date = Temporal::convert($last_update);
|
||||
$check_date = Temporal::utc($last_update);
|
||||
|
||||
$r = q(
|
||||
"SELECT `item`.*, `item`.`id` AS `item_id`,
|
||||
|
@ -421,7 +421,7 @@ class DFRN
|
|||
|
||||
XML::addElement($doc, $mail, "dfrn:id", $item['uri']);
|
||||
XML::addElement($doc, $mail, "dfrn:in-reply-to", $item['parent-uri']);
|
||||
XML::addElement($doc, $mail, "dfrn:sentdate", Temporal::convert($item['created'] . '+00:00', 'UTC', 'UTC', Temporal::ATOM));
|
||||
XML::addElement($doc, $mail, "dfrn:sentdate", Temporal::utc($item['created'] . '+00:00', Temporal::ATOM));
|
||||
XML::addElement($doc, $mail, "dfrn:subject", $item['title']);
|
||||
XML::addElement($doc, $mail, "dfrn:content", $item['body']);
|
||||
|
||||
|
@ -587,7 +587,7 @@ class DFRN
|
|||
|
||||
/// @todo We need a way to transmit the different page flags like "PAGE_PRVGROUP"
|
||||
|
||||
XML::addElement($doc, $root, "updated", Temporal::convert("now", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $root, "updated", Temporal::utcNow(Temporal::ATOM));
|
||||
|
||||
$author = self::addAuthor($doc, $owner, $authorelement, $public);
|
||||
$root->appendChild($author);
|
||||
|
@ -622,9 +622,9 @@ class DFRN
|
|||
|
||||
$author = $doc->createElement($authorelement);
|
||||
|
||||
$namdate = Temporal::convert($owner['name-date'].'+00:00', 'UTC', 'UTC', Temporal::ATOM);
|
||||
$uridate = Temporal::convert($owner['uri-date'].'+00:00', 'UTC', 'UTC', Temporal::ATOM);
|
||||
$picdate = Temporal::convert($owner['avatar-date'].'+00:00', 'UTC', 'UTC', Temporal::ATOM);
|
||||
$namdate = Temporal::utc($owner['name-date'].'+00:00', Temporal::ATOM);
|
||||
$uridate = Temporal::utc($owner['uri-date'].'+00:00', Temporal::ATOM);
|
||||
$picdate = Temporal::utc($owner['avatar-date'].'+00:00', Temporal::ATOM);
|
||||
|
||||
$attributes = [];
|
||||
|
||||
|
@ -903,7 +903,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($item['deleted']) {
|
||||
$attributes = ["ref" => $item['uri'], "when" => Temporal::convert($item['edited'] . '+00:00', 'UTC', 'UTC', Temporal::ATOM)];
|
||||
$attributes = ["ref" => $item['uri'], "when" => Temporal::utc($item['edited'] . '+00:00', Temporal::ATOM)];
|
||||
return XML::createElement($doc, "at:deleted-entry", "", $attributes);
|
||||
}
|
||||
|
||||
|
@ -983,8 +983,8 @@ class DFRN
|
|||
XML::addElement($doc, $entry, "id", $item["uri"]);
|
||||
XML::addElement($doc, $entry, "title", $item["title"]);
|
||||
|
||||
XML::addElement($doc, $entry, "published", Temporal::convert($item["created"] . "+00:00", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::convert($item["edited"] . "+00:00", "UTC", "UTC", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "published", Temporal::utc($item["created"] . "+00:00", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::utc($item["edited"] . "+00:00", Temporal::ATOM));
|
||||
|
||||
// "dfrn:env" is used to read the content
|
||||
XML::addElement($doc, $entry, "dfrn:env", base64url_encode($body, true));
|
||||
|
@ -1388,7 +1388,7 @@ class DFRN
|
|||
"SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1",
|
||||
intval($contact["uid"]),
|
||||
intval($contact["id"]),
|
||||
dbesc(Temporal::convert($birthday)),
|
||||
dbesc(Temporal::utc($birthday)),
|
||||
dbesc("birthday")
|
||||
);
|
||||
|
||||
|
@ -1408,8 +1408,8 @@ class DFRN
|
|||
intval($contact["id"]),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::convert($birthday)),
|
||||
dbesc(Temporal::convert($birthday . " + 1 day ")),
|
||||
dbesc(Temporal::utc($birthday)),
|
||||
dbesc(Temporal::utc($birthday . " + 1 day ")),
|
||||
dbesc($bdtext),
|
||||
dbesc($bdtext2),
|
||||
dbesc("birthday")
|
||||
|
@ -2081,13 +2081,13 @@ class DFRN
|
|||
|
||||
if (self::isEditedTimestampNewer($current, $item)) {
|
||||
// do not accept (ignore) an earlier edit than one we currently have.
|
||||
if (Temporal::convert($item["edited"]) < $current["edited"]) {
|
||||
if (Temporal::utc($item["edited"]) < $current["edited"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = ['title' => $item["title"], 'body' => $item["body"],
|
||||
'tag' => $item["tag"], 'changed' => Temporal::utcNow(),
|
||||
'edited' => Temporal::convert($item["edited"])];
|
||||
'edited' => Temporal::utc($item["edited"])];
|
||||
|
||||
$condition = ["`uri` = ? AND `uid` IN (0, ?)", $item["uri"], $importer["importer_uid"]];
|
||||
dba::update('item', $fields, $condition);
|
||||
|
@ -2422,7 +2422,7 @@ class DFRN
|
|||
|
||||
// Is there an existing item?
|
||||
if (DBM::is_result($current) && self::isEditedTimestampNewer($current[0], $item)
|
||||
&& (Temporal::convert($item["edited"]) < $current[0]["edited"])
|
||||
&& (Temporal::utc($item["edited"]) < $current[0]["edited"])
|
||||
) {
|
||||
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
|
||||
return;
|
||||
|
@ -2753,9 +2753,9 @@ class DFRN
|
|||
}
|
||||
}
|
||||
if ($when) {
|
||||
$when = Temporal::convert($when);
|
||||
$when = Temporal::utc($when);
|
||||
} else {
|
||||
$when = Temporal::convert("now");
|
||||
$when = Temporal::utcNow();
|
||||
}
|
||||
|
||||
if (!$uri || !$importer["id"]) {
|
||||
|
@ -3157,8 +3157,8 @@ class DFRN
|
|||
return false;
|
||||
}
|
||||
|
||||
$existing_edited = Temporal::convert($existing['edited']);
|
||||
$update_edited = Temporal::convert($update['edited']);
|
||||
$existing_edited = Temporal::utc($existing['edited']);
|
||||
$update_edited = Temporal::utc($update['edited']);
|
||||
|
||||
return (strcmp($existing_edited, $update_edited) < 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue