mirror of
https://github.com/friendica/friendica
synced 2025-04-28 03:10:11 +00:00
Move Temporal::convert() to DateTimeFormat::convert()
This commit is contained in:
parent
b7a7355292
commit
5e7285b9ba
64 changed files with 568 additions and 551 deletions
|
@ -26,8 +26,8 @@ use Friendica\Model\User;
|
|||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use Friendica\Util\XML;
|
||||
use Friendica\Content\Text\BBCode;
|
||||
|
||||
|
@ -229,7 +229,7 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
$check_date = Temporal::utc($last_update);
|
||||
$check_date = DateTimeFormat::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::utc($item['created'] . '+00:00', Temporal::ATOM));
|
||||
XML::addElement($doc, $mail, "dfrn:sentdate", DateTimeFormat::utc($item['created'] . '+00:00', DateTimeFormat::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::utcNow(Temporal::ATOM));
|
||||
XML::addElement($doc, $root, "updated", DateTimeFormat::utcNow(DateTimeFormat::ATOM));
|
||||
|
||||
$author = self::addAuthor($doc, $owner, $authorelement, $public);
|
||||
$root->appendChild($author);
|
||||
|
@ -622,9 +622,9 @@ class DFRN
|
|||
|
||||
$author = $doc->createElement($authorelement);
|
||||
|
||||
$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);
|
||||
$namdate = DateTimeFormat::utc($owner['name-date'].'+00:00', DateTimeFormat::ATOM);
|
||||
$uridate = DateTimeFormat::utc($owner['uri-date'].'+00:00', DateTimeFormat::ATOM);
|
||||
$picdate = DateTimeFormat::utc($owner['avatar-date'].'+00:00', DateTimeFormat::ATOM);
|
||||
|
||||
$attributes = [];
|
||||
|
||||
|
@ -903,7 +903,7 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($item['deleted']) {
|
||||
$attributes = ["ref" => $item['uri'], "when" => Temporal::utc($item['edited'] . '+00:00', Temporal::ATOM)];
|
||||
$attributes = ["ref" => $item['uri'], "when" => DateTimeFormat::utc($item['edited'] . '+00:00', DateTimeFormat::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::utc($item["created"] . "+00:00", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", Temporal::utc($item["edited"] . "+00:00", Temporal::ATOM));
|
||||
XML::addElement($doc, $entry, "published", DateTimeFormat::utc($item["created"] . "+00:00", DateTimeFormat::ATOM));
|
||||
XML::addElement($doc, $entry, "updated", DateTimeFormat::utc($item["edited"] . "+00:00", DateTimeFormat::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::utc($birthday)),
|
||||
dbesc(DateTimeFormat::utc($birthday)),
|
||||
dbesc("birthday")
|
||||
);
|
||||
|
||||
|
@ -1406,10 +1406,10 @@ class DFRN
|
|||
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s') ",
|
||||
intval($contact["uid"]),
|
||||
intval($contact["id"]),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(Temporal::utc($birthday)),
|
||||
dbesc(Temporal::utc($birthday . " + 1 day ")),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
dbesc(DateTimeFormat::utc($birthday)),
|
||||
dbesc(DateTimeFormat::utc($birthday . " + 1 day ")),
|
||||
dbesc($bdtext),
|
||||
dbesc($bdtext2),
|
||||
dbesc("birthday")
|
||||
|
@ -1889,7 +1889,7 @@ class DFRN
|
|||
intval($suggest["cid"]),
|
||||
dbesc($suggest["body"]),
|
||||
dbesc($hash),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
intval(0)
|
||||
);
|
||||
|
||||
|
@ -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::utc($item["edited"]) < $current["edited"]) {
|
||||
if (DateTimeFormat::utc($item["edited"]) < $current["edited"]) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$fields = ['title' => $item["title"], 'body' => $item["body"],
|
||||
'tag' => $item["tag"], 'changed' => Temporal::utcNow(),
|
||||
'edited' => Temporal::utc($item["edited"])];
|
||||
'tag' => $item["tag"], 'changed' => DateTimeFormat::utcNow(),
|
||||
'edited' => DateTimeFormat::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::utc($item["edited"]) < $current[0]["edited"])
|
||||
&& (DateTimeFormat::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::utc($when);
|
||||
$when = DateTimeFormat::utc($when);
|
||||
} else {
|
||||
$when = Temporal::utcNow();
|
||||
$when = DateTimeFormat::utcNow();
|
||||
}
|
||||
|
||||
if (!$uri || !$importer["id"]) {
|
||||
|
@ -2836,7 +2836,7 @@ class DFRN
|
|||
`body` = '', `title` = ''
|
||||
WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
|
||||
dbesc($when),
|
||||
dbesc(Temporal::utcNow()),
|
||||
dbesc(DateTimeFormat::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::utcNow()),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
dbesc($uri),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
|
@ -3157,8 +3157,8 @@ class DFRN
|
|||
return false;
|
||||
}
|
||||
|
||||
$existing_edited = Temporal::utc($existing['edited']);
|
||||
$update_edited = Temporal::utc($update['edited']);
|
||||
$existing_edited = DateTimeFormat::utc($existing['edited']);
|
||||
$update_edited = DateTimeFormat::utc($update['edited']);
|
||||
|
||||
return (strcmp($existing_edited, $update_edited) < 0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue