Browse Source

Add Temporal::utcNow()

pull/4327/head
Hypolite Petovan 4 years ago
parent
commit
8aff8a76eb
51 changed files with 191 additions and 180 deletions
  1. +3
    -3
      include/api.php
  2. +2
    -2
      include/dba.php
  3. +1
    -1
      include/enotify.php
  4. +2
    -2
      include/event.php
  5. +2
    -2
      include/security.php
  6. +2
    -2
      include/text.php
  7. +1
    -1
      mod/admin.php
  8. +1
    -1
      mod/contacts.php
  9. +6
    -6
      mod/dfrn_confirm.php
  10. +3
    -3
      mod/dfrn_request.php
  11. +1
    -1
      mod/fsuggest.php
  12. +1
    -1
      mod/invite.php
  13. +7
    -7
      mod/item.php
  14. +1
    -1
      mod/lostpass.php
  15. +3
    -3
      mod/network.php
  16. +6
    -6
      mod/photos.php
  17. +1
    -1
      mod/ping.php
  18. +2
    -2
      mod/profile_photo.php
  19. +1
    -1
      mod/profiles.php
  20. +1
    -1
      mod/proxy.php
  21. +1
    -1
      mod/pubsubhubbub.php
  22. +1
    -1
      mod/register.php
  23. +1
    -1
      mod/settings.php
  24. +2
    -2
      mod/videos.php
  25. +1
    -1
      mod/wall_attach.php
  26. +1
    -1
      src/Content/OEmbed.php
  27. +1
    -1
      src/Core/Cache.php
  28. +7
    -7
      src/Core/Worker.php
  29. +1
    -1
      src/Database/DBM.php
  30. +18
    -18
      src/Model/Contact.php
  31. +5
    -5
      src/Model/GContact.php
  32. +1
    -1
      src/Model/Item.php
  33. +4
    -4
      src/Model/Mail.php
  34. +2
    -2
      src/Model/Photo.php
  35. +1
    -1
      src/Model/Process.php
  36. +1
    -1
      src/Model/Profile.php
  37. +2
    -2
      src/Model/Queue.php
  38. +2
    -2
      src/Model/User.php
  39. +3
    -3
      src/Module/Login.php
  40. +1
    -1
      src/Network/FKOAuth1.php
  41. +6
    -6
      src/Protocol/DFRN.php
  42. +17
    -17
      src/Protocol/Diaspora.php
  43. +3
    -3
      src/Protocol/OStatus.php
  44. +17
    -17
      src/Protocol/PortableContact.php
  45. +1
    -1
      src/Util/ParseUrl.php
  46. +11
    -0
      src/Util/Temporal.php
  47. +8
    -8
      src/Worker/Cron.php
  48. +1
    -1
      src/Worker/CronHooks.php
  49. +1
    -1
      src/Worker/DiscoverPoCo.php
  50. +22
    -22
      src/Worker/OnePoll.php
  51. +1
    -1
      src/Worker/UpdateGContact.php

+ 3
- 3
include/api.php View File

@ -460,7 +460,7 @@ function api_rss_extra(App $a, $arr, $user_info)
'self' => System::baseUrl() . "/" . $a->query_string,
'base' => System::baseUrl(),
'updated' => api_date(null),
'atom_updated' => Temporal::convert('now', 'UTC', 'UTC', Temporal::ATOM),
'atom_updated' => Temporal::utcNow(Temporal::ATOM),
'language' => $user_info['language'],
'logo' => System::baseUrl() . "/images/friendica-32.png",
];
@ -4216,7 +4216,7 @@ function api_fr_photo_create_update($type)
$result = q(
"UPDATE `photo` SET %s, `edited`='%s' WHERE `uid` = %d AND `resource-id` = '%s' AND `album` = '%s'",
$sql_extra,
Temporal::convert(), // update edited timestamp
Temporal::utcNow(), // update edited timestamp
intval(api_user()),
dbesc($photo_id),
dbesc($album)
@ -4420,7 +4420,7 @@ function api_account_update_profile_image($type)
q(
"UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);


+ 2
- 2
include/dba.php View File

@ -190,7 +190,7 @@ class dba {
if ($log) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($a->config["system"]["db_log_index"], Temporal::convert()."\t".
@file_put_contents($a->config["system"]["db_log_index"], Temporal::utcNow()."\t".
$row['key']."\t".$row['rows']."\t".$row['Extra']."\t".
basename($backtrace[1]["file"])."\t".
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
@ -495,7 +495,7 @@ class dba {
$duration = round($duration, 3);
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
@file_put_contents($a->config["system"]["db_log"], Temporal::convert()."\t".$duration."\t".
@file_put_contents($a->config["system"]["db_log"], Temporal::utcNow()."\t".$duration."\t".
basename($backtrace[1]["file"])."\t".
$backtrace[1]["line"]."\t".$backtrace[2]["function"]."\t".
substr(self::replace_parameters($sql, $args), 0, 2000)."\n", FILE_APPEND);


+ 1
- 1
include/enotify.php View File

@ -451,7 +451,7 @@ function notification($params)
$datarray['name_cache'] = strip_tags(bbcode($params['source_name']));
$datarray['url'] = $params['source_link'];
$datarray['photo'] = $params['source_photo'];
$datarray['date'] = Temporal::convert();
$datarray['date'] = Temporal::utcNow();
$datarray['uid'] = $params['uid'];
$datarray['link'] = $itemlink;
$datarray['iid'] = $item_id;


+ 2
- 2
include/event.php View File

@ -240,8 +240,8 @@ function event_store($arr) {
$a = get_app();
$arr['created'] = (($arr['created']) ? $arr['created'] : Temporal::convert());
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : Temporal::convert());
$arr['created'] = (($arr['created']) ? $arr['created'] : Temporal::utcNow());
$arr['edited'] = (($arr['edited']) ? $arr['edited'] : Temporal::utcNow());
$arr['type'] = (($arr['type']) ? $arr['type'] : 'event' );
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
$arr['uri'] = (x($arr, 'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(), $arr['uid']));


+ 2
- 2
include/security.php View File

@ -142,10 +142,10 @@ function authenticate_success($user_record, $login_initial = false, $interactive
header('X-Account-Management-Status: active; name="' . $a->user['username'] . '"; id="' . $a->user['nickname'] . '"');
if ($login_initial || $login_refresh) {
dba::update('user', ['login_date' => Temporal::convert()], ['uid' => $_SESSION['uid']]);
dba::update('user', ['login_date' => Temporal::utcNow()], ['uid' => $_SESSION['uid']]);
// Set the login date for all identities of the user
dba::update('user', ['login_date' => Temporal::convert()],
dba::update('user', ['login_date' => Temporal::utcNow()],
['password' => $master_record['password'], 'email' => $master_record['email'], 'account_removed' => false]);
}


+ 2
- 2
include/text.php View File

@ -723,7 +723,7 @@ function logger($msg, $level = 0) {
$callers = debug_backtrace();
$logline = sprintf("%s@%s\t[%s]:%s:%s:%s\t%s\n",
Temporal::convert('now', 'UTC', 'UTC', Temporal::ATOM),
Temporal::utcNow(Temporal::ATOM),
$process_id,
$LOGGER_LEVELS[$level],
basename($callers[0]['file']),
@ -789,7 +789,7 @@ function dlogger($msg, $level = 0) {
$callers = debug_backtrace();
$logline = sprintf("%s@\t%s:\t%s:\t%s\t%s\t%s\n",
Temporal::convert(),
Temporal::utcNow(),
$process_id,
basename($callers[0]['file']),
$callers[0]['line'],


+ 1
- 1
mod/admin.php View File

@ -740,7 +740,7 @@ function admin_page_summary(App $a)
if (!$last_worker_call) {
$showwarning = true;
$warningtext[] = L10n::t('The worker was never executed. Please check your database structure!');
} elseif ((strtotime(Temporal::convert()) - strtotime($last_worker_call)) > 60 * 60) {
} elseif ((strtotime(Temporal::utcNow()) - strtotime($last_worker_call)) > 60 * 60) {
$showwarning = true;
$warningtext[] = L10n::t('The last worker execution was on %s UTC. This is older than one hour. Please check your crontab settings.', $last_worker_call);
}


+ 1
- 1
mod/contacts.php View File

@ -554,7 +554,7 @@ function contacts_content(App $a)
// tabs
$tab_str = contacts_tab($a, $contact_id, 2);
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < datetime_convert('', '', 'now')) ? L10n::t('Communications lost with this contact!') : '');
$lost_contact = (($contact['archive'] && $contact['term-date'] > NULL_DATE && $contact['term-date'] < Temporal::utcNow()) ? L10n::t('Communications lost with this contact!') : '');
$fetch_further_information = null;
if ($contact['network'] == NETWORK_FEED) {


+ 6
- 6
mod/dfrn_confirm.php View File

@ -327,8 +327,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
`network` = '%s' WHERE `id` = %d
",
intval($new_relation),
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
intval($duplex),
intval($hidden),
dbesc(NETWORK_DFRN),
@ -378,8 +378,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
`rel` = %d
WHERE `id` = %d
",
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc($addr),
dbesc($notify),
dbesc($poll),
@ -619,8 +619,8 @@ function dfrn_confirm_post(App $a, $handsfree = null)
`network` = '%s' WHERE `id` = %d
",
intval($new_relation),
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
intval($duplex),
intval($forum),
intval($prv),


+ 3
- 3
mod/dfrn_request.php View File

@ -137,7 +137,7 @@ function dfrn_request_post(App $a)
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`, `hidden`, `blocked`, `pending`)
VALUES ( %d, '%s', '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d)",
intval(local_user()),
Temporal::convert(),
Temporal::utcNow(),
dbesc($dfrn_url),
dbesc(normalise_link($dfrn_url)),
$parms['addr'],
@ -382,7 +382,7 @@ function dfrn_request_post(App $a)
`request`, `confirm`, `notify`, `poll`, `poco`, `network`, `blocked`, `pending` )
VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )",
intval($uid),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
$parms['url'],
dbesc(normalise_link($url)),
$parms['addr'],
@ -430,7 +430,7 @@ function dfrn_request_post(App $a)
((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
dbesc(notags(trim($_POST['dfrn-request-message']))),
dbesc($hash),
dbesc(Temporal::convert())
dbesc(Temporal::utcNow())
);
}


+ 1
- 1
mod/fsuggest.php View File

@ -52,7 +52,7 @@ function fsuggest_post(App $a)
dbesc($r[0]['request']),
dbesc($r[0]['photo']),
dbesc($hash),
dbesc(Temporal::convert())
dbesc(Temporal::utcNow())
);
$r = q("SELECT `id` FROM `fsuggest` WHERE `note` = '%s' AND `uid` = %d LIMIT 1",
dbesc($hash),


+ 1
- 1
mod/invite.php View File

@ -62,7 +62,7 @@ function invite_post(App $a)
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
dbesc($code),
dbesc(Temporal::convert())
dbesc(Temporal::utcNow())
);
if (! is_site_admin()) {


+ 7
- 7
mod/item.php View File

@ -601,11 +601,11 @@ function item_post(App $a) {
$datarray['author-link'] = $author['url'];
$datarray['author-avatar'] = $author['thumb'];
$datarray['author-id'] = Contact::getIdForURL($datarray['author-link'], 0);
$datarray['created'] = Temporal::convert();
$datarray['edited'] = Temporal::convert();
$datarray['commented'] = Temporal::convert();
$datarray['received'] = Temporal::convert();
$datarray['changed'] = Temporal::convert();
$datarray['created'] = Temporal::utcNow();
$datarray['edited'] = Temporal::utcNow();
$datarray['commented'] = Temporal::utcNow();
$datarray['received'] = Temporal::utcNow();
$datarray['changed'] = Temporal::utcNow();
$datarray['extid'] = $extid;
$datarray['guid'] = $guid;
$datarray['uri'] = $uri;
@ -709,8 +709,8 @@ function item_post(App $a) {
'file' => $datarray['file'],
'rendered-html' => $datarray['rendered-html'],
'rendered-hash' => $datarray['rendered-hash'],
'edited' => Temporal::convert(),
'changed' => Temporal::convert()];
'edited' => Temporal::utcNow(),
'changed' => Temporal::utcNow()];
Item::update($fields, ['id' => $post_id]);


+ 1
- 1
mod/lostpass.php View File

@ -33,7 +33,7 @@ function lostpass_post(App $a)
$fields = [
'pwdreset' => $pwdreset_token,
'pwdreset_time' => Temporal::convert()
'pwdreset_time' => Temporal::utcNow()
];
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {


+ 3
- 3
mod/network.php View File

@ -790,8 +790,8 @@ function networkThreadedView(App $a, $update = 0)
$top_limit = current($r)['order_date'];
$bottom_limit = end($r)['order_date'];
} else {
$top_limit = Temporal::convert();
$bottom_limit = Temporal::convert();
$top_limit = Temporal::utcNow();
$bottom_limit = Temporal::utcNow();
}
// When checking for updates we need to fetch from the newest date to the newest date before
@ -804,7 +804,7 @@ function networkThreadedView(App $a, $update = 0)
$top_limit = $last_date;
} elseif ($a->pager['page'] == 1) {
// Highest possible top limit when we are on the first page
$top_limit = Temporal::convert();
$top_limit = Temporal::utcNow();
}
$items = dba::p("SELECT `item`.`id` AS `item_id`, `item`.`network` AS `item_network`, `contact`.`uid` AS `contact_uid` FROM `item`


+ 6
- 6
mod/photos.php View File

@ -291,7 +291,7 @@ function photos_post(App $a)
if (DBM::is_result($r)) {
foreach ($r as $rr) {
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc($rr['parent-uri']),
intval($page_owner_uid)
);
@ -364,8 +364,8 @@ function photos_post(App $a)
);
if (DBM::is_result($i)) {
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc($i[0]['uri']),
intval($page_owner_uid)
);
@ -649,8 +649,8 @@ function photos_post(App $a)
$r = q("UPDATE `item` SET `tag` = '%s', `inform` = '%s', `edited` = '%s', `changed` = '%s' WHERE `id` = %d AND `uid` = %d",
dbesc($newtag),
dbesc($newinform),
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
intval($item_id),
intval($page_owner_uid)
);
@ -1361,7 +1361,7 @@ function photos_content(App $a)
$photo = [
'href' => 'photo/' . $hires['resource-id'] . '-' . $hires['scale'] . '.' . $phototypes[$hires['type']],
'title'=> L10n::t('View Full Size'),
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . Temporal::convert('now', 'UTC', 'UTC', 'ymdhis'),
'src' => 'photo/' . $lores['resource-id'] . '-' . $lores['scale'] . '.' . $phototypes[$lores['type']] . '?f=&_u=' . Temporal::utcNow('ymdhis'),
'height' => $hires['height'],
'width' => $hires['width'],
'album' => $hires['album'],


+ 1
- 1
mod/ping.php View File

@ -226,7 +226,7 @@ function ping_init(App $a)
ORDER BY `start` ASC ",
intval(local_user()),
dbesc(Temporal::convert('now + 7 days')),
dbesc(Temporal::convert('now'))
dbesc(Temporal::utcNow())
);
if (DBM::is_result($ev)) {
Cache::set($cachekey, $ev, CACHE_HOUR);


+ 2
- 2
mod/profile_photo.php View File

@ -130,7 +130,7 @@ function profile_photo_post(App $a) {
// so that browsers will do a cache update unconditionally
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);
@ -230,7 +230,7 @@ function profile_photo_content(App $a) {
);
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);


+ 1
- 1
mod/profiles.php View File

@ -487,7 +487,7 @@ function profiles_post(App $a) {
if ($namechanged && $is_default) {
$r = q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
dbesc($name),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);
$r = q("UPDATE `user` set `username` = '%s' where `uid` = %d",


+ 1
- 1
mod/proxy.php View File

@ -188,7 +188,7 @@ function proxy_init(App $a) {
die();
}
$fields = ['uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => Temporal::convert(), 'edited' => Temporal::convert(),
$fields = ['uid' => 0, 'contact-id' => 0, 'guid' => get_guid(), 'resource-id' => $urlhash, 'created' => Temporal::utcNow(), 'edited' => Temporal::utcNow(),
'filename' => basename($_REQUEST['url']), 'type' => '', 'album' => '', 'height' => imagesy($image), 'width' => imagesx($image),
'datasize' => 0, 'data' => $img_str, 'scale' => 100, 'profile' => 0,
'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '', 'desc' => $mime];


+ 1
- 1
mod/pubsubhubbub.php View File

@ -139,7 +139,7 @@ function pubsubhubbub_init(App $a) {
dbesc($hub_callback));
if ($subscribe) {
$last_update = Temporal::convert();
$last_update = Temporal::utcNow();
$push_flag = 0;
// if we are just updating an old subscription, keep the


+ 1
- 1
mod/register.php View File

@ -118,7 +118,7 @@ function register_post(App $a)
$hash = random_string();
$r = q("INSERT INTO `register` ( `hash`, `created`, `uid`, `password`, `language`, `note` ) VALUES ( '%s', '%s', %d, '%s', '%s', '%s' ) ",
dbesc($hash),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval($user['uid']),
dbesc($result['password']),
dbesc($lang),


+ 1
- 1
mod/settings.php View File

@ -631,7 +631,7 @@ function settings_post(App $a)
if ($name_change) {
q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
dbesc($username),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval(local_user())
);
}


+ 2
- 2
mod/videos.php View File

@ -170,8 +170,8 @@ function videos_post(App $a) {
//echo "<pre>"; var_dump($i); killme();
if (DBM::is_result($i)) {
q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc($i[0]['uri']),
intval(local_user())
);


+ 1
- 1
mod/wall_attach.php View File

@ -124,7 +124,7 @@ function wall_attach_post(App $a) {
$filedata = @file_get_contents($src);
$mimetype = Mimetype::getContentType($filename);
$hash = get_guid(64);
$created = Temporal::convert();
$created = Temporal::utcNow();
$fields = ['uid' => $page_owner_uid, 'hash' => $hash, 'filename' => $filename, 'filetype' => $mimetype,
'filesize' => $filesize, 'data' => $filedata, 'created' => $created, 'edited' => $created,


+ 1
- 1
src/Content/OEmbed.php View File

@ -113,7 +113,7 @@ class OEmbed
'url' => normalise_link($embedurl),
'maxwidth' => $a->videowidth,
'content' => $txt,
'created' => Temporal::convert()
'created' => Temporal::utcNow()
], true);
}


+ 1
- 1
src/Core/Cache.php View File

@ -147,7 +147,7 @@ class Cache
$memcache->set(get_app()->get_hostname().":".$key, serialize($value), MEMCACHE_COMPRESSED, self::duration($duration));
return;
}
$fields = ['v' => serialize($value), 'expire_mode' => $duration, 'updated' => Temporal::convert()];
$fields = ['v' => serialize($value), 'expire_mode' => $duration, 'updated' => Temporal::utcNow()];
$condition = ['k' => $key];
dba::update('cache', $fields, $condition, true);
}


+ 7
- 7
src/Core/Worker.php View File

@ -235,7 +235,7 @@ class Worker
if ($age > 1) {
$stamp = (float)microtime(true);
dba::update('workerqueue', ['executed' => Temporal::convert()], ['pid' => $mypid, 'done' => false]);
dba::update('workerqueue', ['executed' => Temporal::utcNow()], ['pid' => $mypid, 'done' => false]);
self::$db_duration += (microtime(true) - $stamp);
}
@ -245,7 +245,7 @@ class Worker
$stamp = (float)microtime(true);
if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
Config::set('system', 'last_poller_execution', Temporal::convert());
Config::set('system', 'last_poller_execution', Temporal::utcNow());
}
self::$db_duration = (microtime(true) - $stamp);
@ -278,7 +278,7 @@ class Worker
if ($age > 1) {
$stamp = (float)microtime(true);
dba::update('workerqueue', ['executed' => Temporal::convert()], ['pid' => $mypid, 'done' => false]);
dba::update('workerqueue', ['executed' => Temporal::utcNow()], ['pid' => $mypid, 'done' => false]);
self::$db_duration += (microtime(true) - $stamp);
}
@ -286,7 +286,7 @@ class Worker
$stamp = (float)microtime(true);
if (dba::update('workerqueue', ['done' => true], ['id' => $queue["id"]])) {
Config::set('system', 'last_poller_execution', Temporal::convert());
Config::set('system', 'last_poller_execution', Temporal::utcNow());
}
self::$db_duration = (microtime(true) - $stamp);
} else {
@ -574,7 +574,7 @@ class Worker
}
dba::update(
'workerqueue',
['executed' => NULL_DATE, 'created' => Temporal::convert(), 'priority' => $new_priority, 'pid' => 0],
['executed' => NULL_DATE, 'created' => Temporal::utcNow(), 'priority' => $new_priority, 'pid' => 0],
['id' => $entry["id"]]
);
} else {
@ -825,7 +825,7 @@ class Worker
if ($found) {
$condition = "`id` IN (".substr(str_repeat("?, ", count($ids)), 0, -2).") AND `pid` = 0 AND NOT `done`";
array_unshift($ids, $condition);
dba::update('workerqueue', ['executed' => Temporal::convert(), 'pid' => $mypid], $ids);
dba::update('workerqueue', ['executed' => Temporal::utcNow(), 'pid' => $mypid], $ids);
}
return $found;
@ -1040,7 +1040,7 @@ class Worker
$priority = PRIORITY_MEDIUM;
$dont_fork = Config::get("system", "worker_dont_fork");
$created = Temporal::convert();
$created = Temporal::utcNow();
if (is_int($run_parameter)) {
$priority = $run_parameter;


+ 1
- 1
src/Database/DBM.php View File

@ -126,6 +126,6 @@ class DBM
$timestamp = -62135596800;
}
return date('Y-m-d H:i:s', (int)$timestamp);
return date(Temporal::MYSQL, (int)$timestamp);
}
}

+ 18
- 18
src/Model/Contact.php View File

@ -112,7 +112,7 @@ class Contact extends BaseObject
$return = dba::insert('contact', [
'uid' => $user['uid'],
'created' => Temporal::convert(),
'created' => Temporal::utcNow(),
'self' => 1,
'name' => $user['username'],
'nick' => $user['nickname'],
@ -129,9 +129,9 @@ class Contact extends BaseObject
'poll' => System::baseUrl() . '/dfrn_poll/' . $user['nickname'],
'confirm' => System::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
'poco' => System::baseUrl() . '/poco/' . $user['nickname'],
'name-date' => Temporal::convert(),
'uri-date' => Temporal::convert(),
'avatar-date' => Temporal::convert(),
'name-date' => Temporal::utcNow(),
'uri-date' => Temporal::utcNow(),
'avatar-date' => Temporal::utcNow(),
'closeness' => 0
]);
@ -210,10 +210,10 @@ class Contact extends BaseObject
}
if ($contact['term-date'] <= NULL_DATE) {
dba::update('contact', ['term-date' => Temporal::convert()], ['id' => $contact['id']]);
dba::update('contact', ['term-date' => Temporal::utcNow()], ['id' => $contact['id']]);
if ($contact['url'] != '') {
dba::update('contact', ['term-date' => Temporal::convert()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
dba::update('contact', ['term-date' => Temporal::utcNow()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
}
} else {
/* @todo
@ -224,7 +224,7 @@ class Contact extends BaseObject
/// @todo Check for contact vitality via probing
$expiry = $contact['term-date'] . ' + 32 days ';
if (Temporal::convert() > Temporal::convert($expiry)) {
if (Temporal::utcNow() > Temporal::convert($expiry)) {
/* Relationship is really truly dead. archive them rather than
* delete, though if the owner tries to unarchive them we'll start
* the whole process over again.
@ -728,7 +728,7 @@ class Contact extends BaseObject
if (!$contact_id) {
dba::insert('contact', [
'uid' => $uid,
'created' => Temporal::convert(),
'created' => Temporal::utcNow(),
'url' => $data["url"],
'nurl' => normalise_link($data["url"]),
'addr' => $data["addr"],
@ -749,9 +749,9 @@ class Contact extends BaseObject
'request' => $data["request"],
'confirm' => $data["confirm"],
'poco' => $data["poco"],
'name-date' => Temporal::convert(),
'uri-date' => Temporal::convert(),
'avatar-date' => Temporal::convert(),
'name-date' => Temporal::utcNow(),
'uri-date' => Temporal::utcNow(),
'avatar-date' => Temporal::utcNow(),
'writable' => 1,
'blocked' => 0,
'readonly' => 0,
@ -823,13 +823,13 @@ class Contact extends BaseObject
}
if (($data["addr"] != $contact["addr"]) || ($data["alias"] != $contact["alias"])) {
$updated['uri-date'] = Temporal::convert();
$updated['uri-date'] = Temporal::utcNow();
}
if (($data["name"] != $contact["name"]) || ($data["nick"] != $contact["nick"])) {
$updated['name-date'] = Temporal::convert();
$updated['name-date'] = Temporal::utcNow();
}
$updated['avatar-date'] = Temporal::convert();
$updated['avatar-date'] = Temporal::utcNow();
dba::update('contact', $updated, ['id' => $contact_id], $contact);
@ -1026,7 +1026,7 @@ class Contact extends BaseObject
if ($photos) {
dba::update(
'contact',
['avatar' => $avatar, 'photo' => $photos[0], 'thumb' => $photos[1], 'micro' => $photos[2], 'avatar-date' => Temporal::convert()],
['avatar' => $avatar, 'photo' => $photos[0], 'thumb' => $photos[1], 'micro' => $photos[2], 'avatar-date' => Temporal::utcNow()],
['id' => $cid]
);
@ -1261,7 +1261,7 @@ class Contact extends BaseObject
// create contact record
dba::insert('contact', [
'uid' => $uid,
'created' => Temporal::convert(),
'created' => Temporal::utcNow(),
'url' => $ret['url'],
'nurl' => normalise_link($ret['url']),
'addr' => $ret['addr'],
@ -1485,7 +1485,7 @@ class Contact extends BaseObject
foreach ($r as $rr) {
logger('update_contact_birthday: ' . $rr['bd']);
$nextbd = Temporal::convert('now', 'UTC', 'UTC', 'Y') . substr($rr['bd'], 4);
$nextbd = Temporal::convert('Y') . substr($rr['bd'], 4);
/*
* Add new birthday event for this person
@ -1508,7 +1508,7 @@ class Contact extends BaseObject
q("INSERT INTO `event` (`uid`,`cid`,`created`,`edited`,`start`,`finish`,`summary`,`desc`,`type`,`adjust`)
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%d' ) ", intval($rr['uid']), intval($rr['id']),
dbesc(Temporal::convert()), dbesc(Temporal::convert()), dbesc(Temporal::convert($nextbd)),
dbesc(Temporal::utcNow()), dbesc(Temporal::utcNow()), dbesc(Temporal::convert($nextbd)),
dbesc(Temporal::convert($nextbd . ' + 1 day ')), dbesc($bdtext), dbesc($bdtext2), dbesc('birthday'),
intval(0)
);


+ 5
- 5
src/Model/GContact.php View File

@ -120,12 +120,12 @@ class GContact
intval($uid),
intval($gcid),
intval($zcid),
dbesc(Temporal::convert())
dbesc(Temporal::utcNow())
);
} else {
q(
"UPDATE `glink` SET `updated` = '%s' WHERE `cid` = %d AND `uid` = %d AND `gcid` = %d AND `zcid` = %d",
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
intval($cid),
intval($uid),
intval($gcid),
@ -717,8 +717,8 @@ class GContact
dbesc($contact["url"]),
dbesc(normalise_link($contact["url"])),
dbesc($contact["photo"]),
dbesc(Temporal::convert()),
dbesc(Temporal::convert()),
dbesc(Temporal::utcNow()),
dbesc(Temporal::utcNow()),
dbesc($contact["location"]),
dbesc($contact["about"]),
intval($contact["hide"]),
@ -1050,7 +1050,7 @@ class GContact
foreach ($r as $server) {
self::fetchGsUsers($server["url"]);
q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(Temporal::convert()), dbesc($server["nurl"]));
q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(Temporal::utcNow()), dbesc($server["nurl"]));
}
}


+ 1
- 1
src/Model/Item.php View File

@ -149,7 +149,7 @@ class Item extends BaseObject
// Set the item to "deleted"
dba::update('item', ['deleted' => true, 'title' => '', 'body' => '',
'edited' => Temporal::convert(), 'changed' => Temporal::convert()],
'edited' => Temporal::utcNow(), 'changed' => Temporal::utcNow()],
['id' => $item['id']]);
create_tags_from_item($item['id']);


+ 4
- 4
src/Model/Mail.php View File

@ -82,7 +82,7 @@ class Mail
$handles = $recip_handle . ';' . $sender_handle;
$fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $sender_handle,
'created' => Temporal::convert(), 'updated' => Temporal::convert(),
'created' => Temporal::utcNow(), 'updated' => Temporal::utcNow(),
'subject' => $subject, 'recips' => $handles];
if (dba::insert('conv', $fields)) {
$convid = dba::lastInsertId();
@ -116,7 +116,7 @@ class Mail
'replied' => 0,
'uri' => $uri,
'parent-uri' => $replyto,
'created' => Temporal::convert()
'created' => Temporal::utcNow()
]
);
@ -196,7 +196,7 @@ class Mail
$convid = null;
$fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle,
'created' => Temporal::convert(), 'updated' => Temporal::convert(),
'created' => Temporal::utcNow(), 'updated' => Temporal::utcNow(),
'subject' => $subject, 'recips' => $handles];
if (dba::insert('conv', $fields)) {
$convid = dba::lastInsertId();
@ -224,7 +224,7 @@ class Mail
'replied' => 0,
'uri' => $uri,
'parent-uri' => $replyto,
'created' => Temporal::convert(),
'created' => Temporal::utcNow(),
'unknown' => 1
]
);


+ 2
- 2
src/Model/Photo.php View File

@ -55,8 +55,8 @@ class Photo
'contact-id' => $cid,
'guid' => $guid,
'resource-id' => $rid,
'created' => Temporal::convert(),
'edited' => Temporal::convert(),
'created' => Temporal::utcNow(),
'edited' => Temporal::utcNow(),
'filename' => basename($filename),
'type' => $Image->getType(),
'album' => $album,


+ 1
- 1
src/Model/Process.php View File

@ -34,7 +34,7 @@ class Process extends BaseObject
dba::transaction();
if (!dba::exists('process', ['pid' => $pid])) {
$return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => Temporal::convert()]);
$return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => Temporal::utcNow()]);
}
dba::commit();


+ 1
- 1
src/Model/Profile.php View File

@ -557,7 +557,7 @@ class Profile
ORDER BY `start` ASC ",
local_user(),
Temporal::convert('now + 6 days'),
Temporal::convert('now')
Temporal::utcNow()
);
if (DBM::is_result($s)) {
$r = dba::inArray($s);


+ 2
- 2
src/Model/Queue.php View File

@ -20,7 +20,7 @@ class Queue
public static function updateTime($id)
{
logger('queue: requeue item ' . $id);
dba::update('queue', ['last' => Temporal::convert()], ['id' => $id]);
dba::update('queue', ['last' => Temporal::utcNow()], ['id' => $id]);
}
/**
@ -95,6 +95,6 @@ class Queue
}
}
dba::insert('queue', ['cid' => $cid, 'network' => $network, 'created' => Temporal::convert(), 'last' => Temporal::convert(), 'content' => $msg, 'batch' =>($batch) ? 1 : 0]);
dba::insert('queue', ['cid' => $cid, 'network' => $network, 'created' => Temporal::utcNow(), 'last' => Temporal::utcNow(), 'content' => $msg, 'batch' =>($batch) ? 1 : 0]);
}
}

+ 2
- 2
src/Model/User.php View File

@ -396,7 +396,7 @@ class User
'verified' => $verified,
'blocked' => $blocked,
'timezone' => 'UTC',
'register_date' => Temporal::convert(),
'register_date' => Temporal::utcNow(),
'default-location' => ''
]);
@ -613,7 +613,7 @@ class User
dba::insert('userd', ['username' => $user['nickname']]);
// The user and related data will be deleted in "cron_expire_and_remove_users" (cronjobs.php)
dba::update('user', ['account_removed' => true, 'account_expires_on' => Temporal::convert()], ['uid' => $uid]);
dba::update('user', ['account_removed' => true, 'account_expires_on' => Temporal::utcNow()], ['uid' => $uid]);
Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
// Send an update to the directory


+ 3
- 3
src/Module/Login.php View File

@ -121,7 +121,7 @@ class Login extends BaseModule
// if we haven't failed up this point, log them in.
$_SESSION['remember'] = $_POST['remember'];
$_SESSION['last_login_date'] = Temporal::convert();
$_SESSION['last_login_date'] = Temporal::utcNow();
authenticate_success($record, true, true);
if (x($_SESSION, 'return_url')) {
@ -220,10 +220,10 @@ class Login extends BaseModule
// stays logged in for a long time, e.g. with "Remember Me"
$login_refresh = false;
if (!x($_SESSION['last_login_date'])) {
$_SESSION['last_login_date'] = Temporal::convert();
$_SESSION['last_login_date'] = Temporal::utcNow();
}
if (strcmp(Temporal::convert('now - 12 hours'), $_SESSION['last_login_date']) > 0) {
$_SESSION['last_login_date'] = Temporal::convert();
$_SESSION['last_login_date'] = Temporal::utcNow();
$login_refresh = true;
}
authenticate_success($user, false, false, $login_refresh);


+ 1
- 1
src/Network/FKOAuth1.php View File

@ -68,7 +68,7 @@ class FKOAuth1 extends OAuthServer
$_SESSION['cid'] = $a->cid;
}
dba::update('user', ['login_date' => Temporal::convert()], ['uid' => $_SESSION['uid']]);
dba::update('user', ['login_date' => Temporal::utcNow()], ['uid' => $_SESSION['uid']]);
Addon::callHooks('logged_in', $a->user);
}


+ 6
- 6
src/Protocol/DFRN.php View File

@ -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"])
);


+ 17
- 17
src/Protocol/Diaspora.php View File

@ -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"]]
);


+ 3
- 3
src/Protocol/OStatus.php View File

@ -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"]]
);


+ 17
- 17
src/Protocol/PortableContact.php View File

@ -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;
}
<