mirror of
https://github.com/friendica/friendica
synced 2025-04-27 18:30:12 +00:00
Refactor datetime_convert into Temporal::convert
- Changed parameter order to save space - Refactor select_timezone into Temporal::getTimezoneSelect - Refactor field_timezone into Temporal::getTimezoneField
This commit is contained in:
parent
d478ef6c6d
commit
dc366bf1f7
62 changed files with 512 additions and 432 deletions
|
@ -112,7 +112,7 @@ class Contact extends BaseObject
|
|||
|
||||
$return = dba::insert('contact', [
|
||||
'uid' => $user['uid'],
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'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' => datetime_convert(),
|
||||
'uri-date' => datetime_convert(),
|
||||
'avatar-date' => datetime_convert(),
|
||||
'name-date' => Temporal::convert(),
|
||||
'uri-date' => Temporal::convert(),
|
||||
'avatar-date' => Temporal::convert(),
|
||||
'closeness' => 0
|
||||
]);
|
||||
|
||||
|
@ -210,10 +210,10 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
if ($contact['term-date'] <= NULL_DATE) {
|
||||
dba::update('contact', ['term-date' => datetime_convert()], ['id' => $contact['id']]);
|
||||
dba::update('contact', ['term-date' => Temporal::convert()], ['id' => $contact['id']]);
|
||||
|
||||
if ($contact['url'] != '') {
|
||||
dba::update('contact', ['term-date' => datetime_convert()], ['`nurl` = ? AND `term-date` <= ? AND NOT `self`', normalise_link($contact['url']), NULL_DATE]);
|
||||
dba::update('contact', ['term-date' => Temporal::convert()], ['`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 (datetime_convert() > datetime_convert('UTC', 'UTC', $expiry)) {
|
||||
if (Temporal::convert() > 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.
|
||||
|
@ -688,7 +688,7 @@ class Contact extends BaseObject
|
|||
$contact_id = $contact["id"];
|
||||
|
||||
// Update the contact every 7 days
|
||||
$update_contact = ($contact['avatar-date'] < datetime_convert('', '', 'now -7 days'));
|
||||
$update_contact = ($contact['avatar-date'] < Temporal::convert('now -7 days'));
|
||||
|
||||
// We force the update if the avatar is empty
|
||||
if (!x($contact, 'avatar')) {
|
||||
|
@ -728,7 +728,7 @@ class Contact extends BaseObject
|
|||
if (!$contact_id) {
|
||||
dba::insert('contact', [
|
||||
'uid' => $uid,
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'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' => datetime_convert(),
|
||||
'uri-date' => datetime_convert(),
|
||||
'avatar-date' => datetime_convert(),
|
||||
'name-date' => Temporal::convert(),
|
||||
'uri-date' => Temporal::convert(),
|
||||
'avatar-date' => Temporal::convert(),
|
||||
'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'] = datetime_convert();
|
||||
$updated['uri-date'] = Temporal::convert();
|
||||
}
|
||||
if (($data["name"] != $contact["name"]) || ($data["nick"] != $contact["nick"])) {
|
||||
$updated['name-date'] = datetime_convert();
|
||||
$updated['name-date'] = Temporal::convert();
|
||||
}
|
||||
|
||||
$updated['avatar-date'] = datetime_convert();
|
||||
$updated['avatar-date'] = Temporal::convert();
|
||||
|
||||
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' => datetime_convert()],
|
||||
['avatar' => $avatar, 'photo' => $photos[0], 'thumb' => $photos[1], 'micro' => $photos[2], 'avatar-date' => Temporal::convert()],
|
||||
['id' => $cid]
|
||||
);
|
||||
|
||||
|
@ -1261,7 +1261,7 @@ class Contact extends BaseObject
|
|||
// create contact record
|
||||
dba::insert('contact', [
|
||||
'uid' => $uid,
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'url' => $ret['url'],
|
||||
'nurl' => normalise_link($ret['url']),
|
||||
'addr' => $ret['addr'],
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/GlobalContact.php
|
||||
* @brief This file includes the GlobalContact class with directory related functions
|
||||
|
@ -14,6 +15,7 @@ use Friendica\Model\Profile;
|
|||
use Friendica\Network\Probe;
|
||||
use Friendica\Protocol\PortableContact;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Exception;
|
||||
|
||||
|
@ -118,12 +120,12 @@ class GContact
|
|||
intval($uid),
|
||||
intval($gcid),
|
||||
intval($zcid),
|
||||
dbesc(datetime_convert())
|
||||
dbesc(Temporal::convert())
|
||||
);
|
||||
} else {
|
||||
q(
|
||||
"UPDATE `glink` SET `updated` = '%s' WHERE `cid` = %d AND `uid` = %d AND `gcid` = %d AND `zcid` = %d",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
intval($cid),
|
||||
intval($uid),
|
||||
intval($gcid),
|
||||
|
@ -715,8 +717,8 @@ class GContact
|
|||
dbesc($contact["url"]),
|
||||
dbesc(normalise_link($contact["url"])),
|
||||
dbesc($contact["photo"]),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc(Temporal::convert()),
|
||||
dbesc($contact["location"]),
|
||||
dbesc($contact["about"]),
|
||||
intval($contact["hide"]),
|
||||
|
@ -1048,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(datetime_convert()), dbesc($server["nurl"]));
|
||||
q("UPDATE `gserver` SET `last_poco_query` = '%s' WHERE `nurl` = '%s'", dbesc(Temporal::convert()), dbesc($server["nurl"]));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ use Friendica\Model\Term;
|
|||
use Friendica\Object\Image;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Protocol\OStatus;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Text_LanguageDetect;
|
||||
|
||||
|
@ -148,7 +149,7 @@ class Item extends BaseObject
|
|||
|
||||
// Set the item to "deleted"
|
||||
dba::update('item', ['deleted' => true, 'title' => '', 'body' => '',
|
||||
'edited' => datetime_convert(), 'changed' => datetime_convert()],
|
||||
'edited' => Temporal::convert(), 'changed' => Temporal::convert()],
|
||||
['id' => $item['id']]);
|
||||
|
||||
create_tags_from_item($item['id']);
|
||||
|
@ -300,11 +301,11 @@ class Item extends BaseObject
|
|||
$arr['owner-name'] = trim(defaults($arr, 'owner-name', ''));
|
||||
$arr['owner-link'] = trim(defaults($arr, 'owner-link', ''));
|
||||
$arr['owner-avatar'] = trim(defaults($arr, 'owner-avatar', ''));
|
||||
$arr['received'] = ((x($arr, 'received') !== false) ? datetime_convert('UTC','UTC', $arr['received']) : datetime_convert());
|
||||
$arr['created'] = ((x($arr, 'created') !== false) ? datetime_convert('UTC','UTC', $arr['created']) : $arr['received']);
|
||||
$arr['edited'] = ((x($arr, 'edited') !== false) ? datetime_convert('UTC','UTC', $arr['edited']) : $arr['created']);
|
||||
$arr['changed'] = ((x($arr, 'changed') !== false) ? datetime_convert('UTC','UTC', $arr['changed']) : $arr['created']);
|
||||
$arr['commented'] = ((x($arr, 'commented') !== false) ? datetime_convert('UTC','UTC', $arr['commented']) : $arr['created']);
|
||||
$arr['received'] = ((x($arr, 'received') !== false) ? Temporal::convert($arr['received']) : Temporal::convert());
|
||||
$arr['created'] = ((x($arr, 'created') !== false) ? Temporal::convert($arr['created']) : $arr['received']);
|
||||
$arr['edited'] = ((x($arr, 'edited') !== false) ? Temporal::convert($arr['edited']) : $arr['created']);
|
||||
$arr['changed'] = ((x($arr, 'changed') !== false) ? Temporal::convert($arr['changed']) : $arr['created']);
|
||||
$arr['commented'] = ((x($arr, 'commented') !== false) ? Temporal::convert($arr['commented']) : $arr['created']);
|
||||
$arr['title'] = trim(defaults($arr, 'title', ''));
|
||||
$arr['location'] = trim(defaults($arr, 'location', ''));
|
||||
$arr['coord'] = trim(defaults($arr, 'coord', ''));
|
||||
|
@ -340,13 +341,13 @@ class Item extends BaseObject
|
|||
}
|
||||
|
||||
// Items cannot be stored before they happen ...
|
||||
if ($arr['created'] > datetime_convert()) {
|
||||
$arr['created'] = datetime_convert();
|
||||
if ($arr['created'] > Temporal::convert()) {
|
||||
$arr['created'] = Temporal::convert();
|
||||
}
|
||||
|
||||
// We haven't invented time travel by now.
|
||||
if ($arr['edited'] > datetime_convert()) {
|
||||
$arr['edited'] = datetime_convert();
|
||||
if ($arr['edited'] > Temporal::convert()) {
|
||||
$arr['edited'] = Temporal::convert();
|
||||
}
|
||||
|
||||
if (($arr['author-link'] == "") && ($arr['owner-link'] == "")) {
|
||||
|
@ -740,9 +741,9 @@ class Item extends BaseObject
|
|||
// update the commented timestamp on the parent
|
||||
// Only update "commented" if it is really a comment
|
||||
if (($arr['verb'] == ACTIVITY_POST) || !Config::get("system", "like_no_comment")) {
|
||||
dba::update('item', ['commented' => datetime_convert(), 'changed' => datetime_convert()], ['id' => $parent_id]);
|
||||
dba::update('item', ['commented' => Temporal::convert(), 'changed' => Temporal::convert()], ['id' => $parent_id]);
|
||||
} else {
|
||||
dba::update('item', ['changed' => datetime_convert()], ['id' => $parent_id]);
|
||||
dba::update('item', ['changed' => Temporal::convert()], ['id' => $parent_id]);
|
||||
}
|
||||
|
||||
if ($dsprsig) {
|
||||
|
@ -1642,7 +1643,7 @@ class Item extends BaseObject
|
|||
intval($wall ? 1 : 0)
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
return substr(datetime_convert('',date_default_timezone_get(), $r[0]['created']),0,10);
|
||||
return substr(Temporal::convert($r[0]['created'], date_default_timezone_get()),0,10);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/Mail.php
|
||||
*/
|
||||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\App;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Network\Probe;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -80,7 +82,7 @@ class Mail
|
|||
$handles = $recip_handle . ';' . $sender_handle;
|
||||
|
||||
$fields = ['uid' => local_user(), 'guid' => $conv_guid, 'creator' => $sender_handle,
|
||||
'created' => datetime_convert(), 'updated' => datetime_convert(),
|
||||
'created' => Temporal::convert(), 'updated' => Temporal::convert(),
|
||||
'subject' => $subject, 'recips' => $handles];
|
||||
if (dba::insert('conv', $fields)) {
|
||||
$convid = dba::lastInsertId();
|
||||
|
@ -114,7 +116,7 @@ class Mail
|
|||
'replied' => 0,
|
||||
'uri' => $uri,
|
||||
'parent-uri' => $replyto,
|
||||
'created' => datetime_convert()
|
||||
'created' => Temporal::convert()
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -194,12 +196,12 @@ class Mail
|
|||
|
||||
$convid = null;
|
||||
$fields = ['uid' => $recipient['uid'], 'guid' => $conv_guid, 'creator' => $sender_handle,
|
||||
'created' => datetime_convert(), 'updated' => datetime_convert(),
|
||||
'created' => Temporal::convert(), 'updated' => Temporal::convert(),
|
||||
'subject' => $subject, 'recips' => $handles];
|
||||
if (dba::insert('conv', $fields)) {
|
||||
$convid = dba::lastInsertId();
|
||||
}
|
||||
|
||||
|
||||
if (!$convid) {
|
||||
logger('send message: conversation not found.');
|
||||
return -4;
|
||||
|
@ -222,7 +224,7 @@ class Mail
|
|||
'replied' => 0,
|
||||
'uri' => $uri,
|
||||
'parent-uri' => $replyto,
|
||||
'created' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'unknown' => 1
|
||||
]
|
||||
);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file src/Model/Photo.php
|
||||
* @brief This file contains the Photo class for database interface
|
||||
|
@ -8,11 +9,11 @@ namespace Friendica\Model;
|
|||
use Friendica\Core\Cache;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -54,8 +55,8 @@ class Photo
|
|||
'contact-id' => $cid,
|
||||
'guid' => $guid,
|
||||
'resource-id' => $rid,
|
||||
'created' => datetime_convert(),
|
||||
'edited' => datetime_convert(),
|
||||
'created' => Temporal::convert(),
|
||||
'edited' => Temporal::convert(),
|
||||
'filename' => basename($filename),
|
||||
'type' => $Image->getType(),
|
||||
'album' => $album,
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
namespace Friendica\Model;
|
||||
|
||||
use Friendica\BaseObject;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -33,7 +34,7 @@ class Process extends BaseObject
|
|||
dba::transaction();
|
||||
|
||||
if (!dba::exists('process', ['pid' => $pid])) {
|
||||
$return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => datetime_convert()]);
|
||||
$return = dba::insert('process', ['pid' => $pid, 'command' => $command, 'created' => Temporal::convert()]);
|
||||
}
|
||||
|
||||
dba::commit();
|
||||
|
|
|
@ -18,6 +18,7 @@ use Friendica\Database\DBM;
|
|||
use Friendica\Model\Contact;
|
||||
use Friendica\Protocol\Diaspora;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -555,8 +556,8 @@ class Profile
|
|||
WHERE `event`.`uid` = ? AND `type` = 'birthday' AND `start` < ? AND `finish` > ?
|
||||
ORDER BY `start` ASC ",
|
||||
local_user(),
|
||||
datetime_convert('UTC', 'UTC', 'now + 6 days'),
|
||||
datetime_convert('UTC', 'UTC', 'now')
|
||||
Temporal::convert('now + 6 days'),
|
||||
Temporal::convert('now')
|
||||
);
|
||||
if (DBM::is_result($s)) {
|
||||
$r = dba::inArray($s);
|
||||
|
@ -599,7 +600,7 @@ class Profile
|
|||
|
||||
$rr['link'] = $url;
|
||||
$rr['title'] = $rr['name'];
|
||||
$rr['date'] = day_translate(datetime_convert('UTC', $a->timezone, $rr['start'], $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['date'] = day_translate(Temporal::convert($rr['start'], $a->timezone, 'UTC', $rr['adjust'] ? $bd_format : $bd_short)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['startime'] = null;
|
||||
$rr['today'] = $today;
|
||||
}
|
||||
|
@ -643,8 +644,8 @@ class Profile
|
|||
WHERE `event`.`uid` = ? AND `type` != 'birthday' AND `start` < ? AND `start` >= ?
|
||||
ORDER BY `start` ASC ",
|
||||
local_user(),
|
||||
datetime_convert('UTC', 'UTC', 'now + 7 days'),
|
||||
datetime_convert('UTC', 'UTC', 'now - 1 days')
|
||||
Temporal::convert('now + 7 days'),
|
||||
Temporal::convert('now - 1 days')
|
||||
);
|
||||
|
||||
$r = [];
|
||||
|
@ -657,8 +658,8 @@ class Profile
|
|||
$total ++;
|
||||
}
|
||||
|
||||
$strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start'], 'Y-m-d');
|
||||
if ($strt === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) {
|
||||
$strt = Temporal::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC', 'UTC', 'Y-m-d');
|
||||
if ($strt === Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) {
|
||||
$istoday = true;
|
||||
}
|
||||
|
||||
|
@ -673,17 +674,17 @@ class Profile
|
|||
$description = L10n::t('[No description]');
|
||||
}
|
||||
|
||||
$strt = datetime_convert('UTC', $rr['convert'] ? $a->timezone : 'UTC', $rr['start']);
|
||||
$strt = Temporal::convert($rr['start'], $rr['convert'] ? $a->timezone : 'UTC');
|
||||
|
||||
if (substr($strt, 0, 10) < datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) {
|
||||
if (substr($strt, 0, 10) < Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$today = ((substr($strt, 0, 10) === datetime_convert('UTC', $a->timezone, 'now', 'Y-m-d')) ? true : false);
|
||||
$today = ((substr($strt, 0, 10) === Temporal::convert('now', $a->timezone, 'UTC', 'Y-m-d')) ? true : false);
|
||||
|
||||
$rr['title'] = $title;
|
||||
$rr['description'] = $description;
|
||||
$rr['date'] = day_translate(datetime_convert('UTC', $rr['adjust'] ? $a->timezone : 'UTC', $rr['start'], $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['date'] = day_translate(Temporal::convert($rr['start'], $rr['adjust'] ? $a->timezone : 'UTC', 'UTC', $bd_format)) . (($today) ? ' ' . L10n::t('[today]') : '');
|
||||
$rr['startime'] = $strt;
|
||||
$rr['today'] = $today;
|
||||
|
||||
|
@ -729,8 +730,8 @@ class Profile
|
|||
$short_bd_format = L10n::t('j F');
|
||||
|
||||
$val = intval($a->profile['dob']) ?
|
||||
day_translate(datetime_convert('UTC', 'UTC', $a->profile['dob'] . ' 00:00 +00:00', $year_bd_format))
|
||||
: day_translate(datetime_convert('UTC', 'UTC', '2001-' . substr($a->profile['dob'], 5) . ' 00:00 +00:00', $short_bd_format));
|
||||
day_translate(Temporal::convert($a->profile['dob'] . ' 00:00 +00:00', 'UTC', 'UTC', $year_bd_format))
|
||||
: day_translate(Temporal::convert('2001-' . substr($a->profile['dob'], 'UTC', 'UTC', 5) . ' 00:00 +00:00', $short_bd_format));
|
||||
|
||||
$profile['birthday'] = [L10n::t('Birthday:'), $val];
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Database\DBM;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
|
||||
require_once 'include/dba.php';
|
||||
|
@ -19,9 +20,9 @@ class Queue
|
|||
public static function updateTime($id)
|
||||
{
|
||||
logger('queue: requeue item ' . $id);
|
||||
dba::update('queue', ['last' => datetime_convert()], ['id' => $id]);
|
||||
dba::update('queue', ['last' => Temporal::convert()], ['id' => $id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $id id
|
||||
*/
|
||||
|
@ -30,7 +31,7 @@ class Queue
|
|||
logger('queue: remove queue item ' . $id);
|
||||
dba::delete('queue', ['id' => $id]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Checks if the communication with a given contact had problems recently
|
||||
*
|
||||
|
@ -45,9 +46,9 @@ class Queue
|
|||
AND `last` > UTC_TIMESTAMP() - INTERVAL 15 MINUTE LIMIT 1",
|
||||
intval($cid)
|
||||
);
|
||||
|
||||
|
||||
$was_delayed = DBM::is_result($r);
|
||||
|
||||
|
||||
// We set "term-date" to a current date if the communication has problems.
|
||||
// If the communication works again we reset this value.
|
||||
if ($was_delayed) {
|
||||
|
@ -56,10 +57,10 @@ class Queue
|
|||
);
|
||||
$was_delayed = !DBM::is_result($r);
|
||||
}
|
||||
|
||||
|
||||
return $was_delayed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $cid cid
|
||||
* @param string $network network
|
||||
|
@ -68,17 +69,17 @@ class Queue
|
|||
*/
|
||||
public static function add($cid, $network, $msg, $batch = false)
|
||||
{
|
||||
|
||||
|
||||
$max_queue = Config::get('system', 'max_contact_queue');
|
||||
if ($max_queue < 1) {
|
||||
$max_queue = 500;
|
||||
}
|
||||
|
||||
|
||||
$batch_queue = Config::get('system', 'max_batch_queue');
|
||||
if ($batch_queue < 1) {
|
||||
$batch_queue = 1000;
|
||||
}
|
||||
|
||||
|
||||
$r = q("SELECT COUNT(*) AS `total` FROM `queue` INNER JOIN `contact` ON `queue`.`cid` = `contact`.`id`
|
||||
WHERE `queue`.`cid` = %d AND `contact`.`self` = 0 ",
|
||||
intval($cid)
|
||||
|
@ -93,7 +94,7 @@ class Queue
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dba::insert('queue', ['cid' => $cid, 'network' => $network, 'created' => datetime_convert(), 'last' => datetime_convert(), 'content' => $msg, 'batch' =>($batch) ? 1 : 0]);
|
||||
|
||||
dba::insert('queue', ['cid' => $cid, 'network' => $network, 'created' => Temporal::convert(), 'last' => Temporal::convert(), 'content' => $msg, 'batch' =>($batch) ? 1 : 0]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,8 @@ namespace Friendica\Model;
|
|||
|
||||
use Friendica\Core\Addon;
|
||||
use Friendica\Core\Config;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\L10n;
|
||||
use Friendica\Core\PConfig;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Core\Worker;
|
||||
use Friendica\Database\DBM;
|
||||
|
@ -18,8 +18,10 @@ use Friendica\Model\Photo;
|
|||
use Friendica\Object\Image;
|
||||
use Friendica\Util\Crypto;
|
||||
use Friendica\Util\Network;
|
||||
use Friendica\Util\Temporal;
|
||||
use dba;
|
||||
use Exception;
|
||||
use LightOpenID;
|
||||
|
||||
require_once 'boot.php';
|
||||
require_once 'include/dba.php';
|
||||
|
@ -286,7 +288,7 @@ class User
|
|||
$_SESSION['register'] = 1;
|
||||
$_SESSION['openid'] = $openid_url;
|
||||
|
||||
$openid = new \LightOpenID;
|
||||
$openid = new LightOpenID;
|
||||
$openid->identity = $openid_url;
|
||||
$openid->returnUrl = System::baseUrl() . '/openid';
|
||||
$openid->required = ['namePerson/friendly', 'contact/email', 'namePerson'];
|
||||
|
@ -394,7 +396,7 @@ class User
|
|||
'verified' => $verified,
|
||||
'blocked' => $blocked,
|
||||
'timezone' => 'UTC',
|
||||
'register_date' => datetime_convert(),
|
||||
'register_date' => Temporal::convert(),
|
||||
'default-location' => ''
|
||||
]);
|
||||
|
||||
|
@ -611,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' => datetime_convert()], ['uid' => $uid]);
|
||||
dba::update('user', ['account_removed' => true, 'account_expires_on' => Temporal::convert()], ['uid' => $uid]);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "removeme", $uid);
|
||||
|
||||
// Send an update to the directory
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue