mirror of
https://github.com/friendica/friendica
synced 2025-04-23 20:30:10 +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
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue