'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",
];
$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)
q(
"UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
intval(local_user())
);
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".
$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);
$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;
$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']));
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]);
}
$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']),
$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'],
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);
}
// 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) {
`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),
`rel` = %d
WHERE `id` = %d
",
- dbesc(Temporal::convert()),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
+ dbesc(Temporal::utcNow()),
dbesc($addr),
dbesc($notify),
dbesc($poll),
`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),
`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'],
`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'],
((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
dbesc(notags(trim($_POST['dfrn-request-message']))),
dbesc($hash),
- dbesc(Temporal::convert())
+ dbesc(Temporal::utcNow())
);
}
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),
$r = q("INSERT INTO `register` (`hash`,`created`) VALUES ('%s', '%s') ",
dbesc($code),
- dbesc(Temporal::convert())
+ dbesc(Temporal::utcNow())
);
if (! is_site_admin()) {
$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;
'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]);
$fields = [
'pwdreset' => $pwdreset_token,
- 'pwdreset_time' => Temporal::convert()
+ 'pwdreset_time' => Temporal::utcNow()
];
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {
$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
$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`
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)
);
);
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)
);
$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)
);
$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'],
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);
// 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())
);
);
$r = q("UPDATE `contact` SET `avatar-date` = '%s' WHERE `self` = 1 AND `uid` = %d",
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
intval(local_user())
);
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",
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];
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
$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),
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())
);
}
//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())
);
$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,
'url' => normalise_link($embedurl),
'maxwidth' => $a->videowidth,
'content' => $txt,
- 'created' => Temporal::convert()
+ 'created' => Temporal::utcNow()
], true);
}
$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);
}
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);
}
$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);
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);
}
$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 {
}
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 {
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;
$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;
$timestamp = -62135596800;
}
- return date('Y-m-d H:i:s', (int)$timestamp);
+ return date(Temporal::MYSQL, (int)$timestamp);
}
}
$return = dba::insert('contact', [
'uid' => $user['uid'],
- 'created' => Temporal::convert(),
+ 'created' => Temporal::utcNow(),
'self' => 1,
'name' => $user['username'],
'nick' => $user['nickname'],
'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
]);
}
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
/// @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.
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"],
'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,
}
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);
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]
);
// 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'],
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
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)
);
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),
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"]),
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"]));
}
}
// 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']);
$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();
'replied' => 0,
'uri' => $uri,
'parent-uri' => $replyto,
- 'created' => Temporal::convert()
+ 'created' => Temporal::utcNow()
]
);
$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();
'replied' => 0,
'uri' => $uri,
'parent-uri' => $replyto,
- 'created' => Temporal::convert(),
+ 'created' => Temporal::utcNow(),
'unknown' => 1
]
);
'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,
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();
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);
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]);
}
/**
}
}
- 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]);
}
}
'verified' => $verified,
'blocked' => $blocked,
'timezone' => 'UTC',
- 'register_date' => Temporal::convert(),
+ 'register_date' => Temporal::utcNow(),
'default-location' => ''
]);
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
// 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')) {
// 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);
$_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);
}
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),
intval($suggest["cid"]),
dbesc($suggest["body"]),
dbesc($hash),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
intval(0)
);
}
$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"]];
`body` = '', `title` = ''
WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
dbesc($when),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
dbesc($uri),
intval($importer["uid"])
);
`body` = '', `title` = ''
WHERE `uri` = '%s' AND `uid` IN (0, %d)",
dbesc($when),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
dbesc($uri),
intval($importer["uid"])
);
$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),
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));
dbesc($arr["confirm"]),
dbesc($arr["alias"]),
dbesc($arr["pubkey"]),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
dbesc($arr["url"]),
dbesc($arr["network"])
);
dbesc($arr["network"]),
dbesc($arr["alias"]),
dbesc($arr["pubkey"]),
- dbesc(Temporal::convert())
+ dbesc(Temporal::utcNow())
);
}
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)) {
dba::unlock();
- dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
+ dba::update('conv', ['updated' => Temporal::utcNow()], ['id' => $conversation["id"]]);
notification(
[
dbesc($guid),
dbesc($author),
dbesc($created_at),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
dbesc($subject),
dbesc($participants)
);
dba::unlock();
- dba::update('conv', ['updated' => Temporal::convert()], ['id' => $conversation["id"]]);
+ dba::update('conv', ['updated' => Temporal::utcNow()], ['id' => $conversation["id"]]);
return true;
}
dbesc($name),
dbesc($nick),
dbesc($author),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
dbesc($birthday),
dbesc($location),
dbesc($about),
intval($importer["uid"]),
dbesc($ret["network"]),
dbesc($ret["addr"]),
- Temporal::convert(),
+ Temporal::utcNow(),
dbesc($ret["url"]),
dbesc(normalise_link($ret["url"])),
dbesc($batch),
0,
dbesc(L10n::t("Sharing notification from Diaspora network")),
dbesc($hash),
- dbesc(Temporal::convert())
+ dbesc(Temporal::utcNow())
);
} else {
// automatic friend approval
WHERE `id` = %d
",
intval($new_relation),
- dbesc(Temporal::convert()),
- dbesc(Temporal::convert()),
+ dbesc(Temporal::utcNow()),
+ dbesc(Temporal::utcNow()),
intval($contact_record["id"])
);
'deleted' => true,
'title' => '',
'body' => '',
- 'edited' => Temporal::convert(),
- 'changed' => Temporal::convert()],
+ 'edited' => Temporal::utcNow(),
+ 'changed' => Temporal::utcNow()],
['id' => $item["id"]]
);
$contact["location"] = $value;
}
- $contact['name-date'] = Temporal::convert();
+ $contact['name-date'] = Temporal::utcNow();
dba::update('contact', $contact, ['id' => $contact["id"]], $current);
'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);
dba::update(
'item',
['deleted' => true, 'title' => '', 'body' => '',
- 'edited' => Temporal::convert(), 'changed' => Temporal::convert()],
+ 'edited' => Temporal::utcNow(), 'changed' => Temporal::utcNow()],
['id' => $deleted["id"]]
);
$contact = ["url" => $profile];
if ($gcontacts[0]["created"] <= NULL_DATE) {
- $contact['created'] = Temporal::convert();
+ $contact['created'] = Temporal::utcNow();
}
if ($force) {
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)]);
}
// 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);
}
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);
$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);
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);
$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);
}
// 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;
}
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;
}
// 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;
}
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;
}
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);
}
}
- $fields = ['last_poco_query' => Temporal::convert()];
+ $fields = ['last_poco_query' => Temporal::utcNow()];
dba::update('gserver', $fields, ['nurl' => $server["nurl"]]);
return true;
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;
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;
}
[
'url' => normalise_link($url), 'guessing' => !$no_guessing,
'oembed' => $do_oembed, 'content' => serialize($data),
- 'created' => Temporal::convert()
+ 'created' => Temporal::utcNow()
],
true
);
]);
}
+ /**
+ * convert() shorthand for UTC now.
+ *
+ * @param string $format DateTime format string or Temporal constant
+ * @return string
+ */
+ public static function utcNow($format = self::MYSQL)
+ {
+ return self::convert('now', 'UTC', 'UTC', $format);
+ }
+
/**
* @brief General purpose date parse/convert/format function.
*
// once daily run birthday_updates and then expire in background
$d1 = Config::get('system', 'last_expire_day');
- $d2 = intval(Temporal::convert('now', 'UTC', 'UTC', 'd'));
+ $d2 = intval(Temporal::utcNow('d'));
if ($d2 != intval($d1)) {
Addon::reload();
- $d = Temporal::convert();
+ $d = Temporal::utcNow();
// Only poll from those with suitable relationships,
// and which have a polling address and ignore Diaspora since
*/
switch ($contact['priority']) {
case 5:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 month")) {
+ if (Temporal::utcNow() > Temporal::convert($t . " + 1 month")) {
$update = true;
}
break;
case 4:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 week")) {
+ if (Temporal::utcNow() > Temporal::convert($t . " + 1 week")) {
$update = true;
}
break;
case 3:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 day")) {
+ if (Temporal::utcNow() > Temporal::convert($t . " + 1 day")) {
$update = true;
}
break;
case 2:
- if (Temporal::convert('now') > Temporal::convert($t . " + 12 hour")) {
+ if (Temporal::utcNow() > Temporal::convert($t . " + 12 hour")) {
$update = true;
}
break;
case 1:
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 hour")) {
+ if (Temporal::utcNow() > Temporal::convert($t . " + 1 hour")) {
$update = true;
}
break;
case 0:
default:
- if (Temporal::convert('now') > Temporal::convert($t . " + ".$min_poll_interval." minute")) {
+ if (Temporal::utcNow() > Temporal::convert($t . " + ".$min_poll_interval." minute")) {
$update = true;
}
break;
logger('cronhooks: start');
- $d = Temporal::convert();
+ $d = Temporal::utcNow();
if (is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
foreach ($a->hooks["cron"] as $hook) {
}
} else {
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
- dbesc(Temporal::convert()), dbesc(normalise_link($user["url"])));
+ dbesc(Temporal::utcNow()), dbesc(normalise_link($user["url"])));
}
// Quit the loop after 3 minutes
return;
}
- $d = Temporal::convert();
+ $d = Temporal::utcNow();
$contact = dba::selectFirst('contact', [], ['id' => $contact_id]);
if (!DBM::is_result($contact)) {
// Diaspora users, archived users and followers are only checked if they still exist.
if ($contact['archive'] || ($contact["network"] == NETWORK_DIASPORA) || ($contact["rel"] == CONTACT_IS_FOLLOWER)) {
$last_updated = PortableContact::lastUpdated($contact["url"], true);
- $updated = Temporal::convert();
+ $updated = Temporal::utcNow();
if ($last_updated) {
logger('Contact '.$contact['id'].' had last update on '.$last_updated, LOGGER_DEBUG);
$contact['priority'] = intval($poll_interval);
$hub_update = false;
- if (Temporal::convert('now') > Temporal::convert($t . " + 1 day")) {
+ if (Temporal::utcNow() > Temporal::convert($t . " + 1 day")) {
$hub_update = true;
}
} else {
logger("Skipping probably dead contact ".$contact['url']);
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
return;
}
logger('Contact is marked dead');
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
return;
} else {
Contact::unmarkForArchival($contact);
logger('Ignore public contacts');
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
return;
}
logger('No self contact for user '.$importer_uid);
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
return;
}
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
Contact::markForArchival($contact);
return;
}
Contact::markForArchival($contact);
// set the last-update so we don't keep polling
- $fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
+ $fields = ['last-update' => Temporal::utcNow(), 'failure_update' => Temporal::utcNow()];
self::updateContact($contact, $fields);
return;
}
Contact::markForArchival($contact);
- $fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
+ $fields = ['last-update' => Temporal::utcNow(), 'failure_update' => Temporal::utcNow()];
self::updateContact($contact, $fields);
return;
}
// we may not be friends anymore. Will keep trying for one month.
// set the last-update so we don't keep polling
- $fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
+ $fields = ['last-update' => Temporal::utcNow(), 'failure_update' => Temporal::utcNow()];
self::updateContact($contact, $fields);
Contact::markForArchival($contact);
if ((intval($res->status) != 0) || !strlen($res->challenge) || !strlen($res->dfrn_id)) {
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
return;
}
logger('ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
Contact::markForArchival($contact);
return;
}
if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) {
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
return;
}
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
Contact::markForArchival($contact);
return;
}
$mail_disabled = ((function_exists('imap_open') && (! Config::get('system', 'imap_disabled'))) ? 0 : 1);
if ($mail_disabled) {
// set the last-update so we don't keep polling
- dba::update('contact', ['last-update' => Temporal::convert()], ['id' => $contact['id']]);
+ dba::update('contact', ['last-update' => Temporal::utcNow()], ['id' => $contact['id']]);
Contact::markForArchival($contact);
return;
}
unset($password);
logger("Mail: Connect to " . $mailconf['user']);
if ($mbox) {
- $fields = ['last_check' => Temporal::convert()];
+ $fields = ['last_check' => Temporal::utcNow()];
dba::update('mailacct', $fields, ['id' => $mailconf['id']]);
logger("Mail: Connected to " . $mailconf['user']);
} else {
// Only delete when mails aren't automatically moved or deleted
if (($mailconf['action'] != 1) && ($mailconf['action'] != 3))
if ($meta->deleted && ! $item['deleted']) {
- $fields = ['deleted' => true, 'changed' => Temporal::convert()];
+ $fields = ['deleted' => true, 'changed' => Temporal::utcNow()];
dba::update('item', $fields, ['id' => $item['id']]);
}
if (!strstr($xml, '<')) {
logger('post_handshake: response from ' . $url . ' did not contain XML.');
- $fields = ['last-update' => Temporal::convert(), 'failure_update' => Temporal::convert()];
+ $fields = ['last-update' => Temporal::utcNow(), 'failure_update' => Temporal::utcNow()];
self::updateContact($contact, $fields);
Contact::markForArchival($contact);
return;
}
}
- $updated = Temporal::convert();
+ $updated = Temporal::utcNow();
self::updateContact($contact, ['last-update' => $updated, 'success_update' => $updated]);
dba::update('gcontact', ['last_contact' => $updated], ['nurl' => $contact['nurl']]);
Contact::unmarkForArchival($contact);
} elseif (in_array($contact["network"], [NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS, NETWORK_FEED])) {
- $updated = Temporal::convert();
+ $updated = Temporal::utcNow();
self::updateContact($contact, ['last-update' => $updated, 'failure_update' => $updated]);
dba::update('gcontact', ['last_failure' => $updated], ['nurl' => $contact['nurl']]);
Contact::markForArchival($contact);
} else {
- $updated = Temporal::convert();
+ $updated = Temporal::utcNow();
dba::update('contact', ['last-update' => $updated], ['id' => $contact['id']]);
}
}
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `id` = %d",
- dbesc(Temporal::convert()), intval($contact_id));
+ dbesc(Temporal::utcNow()), intval($contact_id));
return;
}