method poll documentation in bbn\Cron\Runner
Returns the $data property.
function(bbn\Appui\Observer $observer = NULL)
{
if ($this->check()) {
$this->timer->start('timeout');
$this->timer->start('users');
$this->timer->start('cron_check');
$obs = $observer ?? new bbn\Appui\Observer($this->db);
//$this->output(X::_('Starting poll'), Date('Y-m-d H:i:s'));
/*
foreach ( $admin->get_old_tokens() as $t ){
$id_user = $admin->get_user_from_token($t['id']);
@bbn\File\Dir::delete(BBN_DATA_PATH."users/$id_user/tmp/tokens/$t[id]", true);
if ( $this->db->delete('bbn_users_tokens', ['id' => $t['id']]) ){
echo '-';
}
}
*/
while ($this->isPollActive()) {
// The only centralized action are the observers
$res = $obs->observe();
if (\is_array($res)) {
$time = time();
foreach ($res as $id_user => $o) {
$user = bbn\User::getInstance();
$ucfg = $user->getClassCfg();
$sessions = $this->db->selectAll($ucfg['tables']['sessions'], [
$ucfg['arch']['sessions']['id'],
$ucfg['arch']['sessions']['sess_id']
], [
$ucfg['arch']['sessions']['id_user'] => $id_user,
$ucfg['arch']['sessions']['opened'] => 1
]);
foreach ($sessions as $sess) {
$file = $this->controller->userDataPath($id_user, 'appui-core')."poller/queue/{$sess->id}/observer-$time.json";
if (bbn\File\Dir::createPath(X::dirname($file))) {
file_put_contents($file, Json_encode(['observers' => $o]));
}
}
}
}
sleep(1);
if ($this->timer->measure('users') > self::$user_timeout) {
echo '?';
//$admin->clean_tokens();
$this->timer->stop('users');
$this->timer->start('users');
}
if ($this->timer->measure('timeout') > self::$poll_timeout) {
//$this->output(X::_('Timeout'), Date('Y-m-d H:i:s'));
echo '.';
}
if ($this->timer->measure('cron_check') > self::$cron_check_timeout) {
$this->cron->getManager()->notifyFailed();
$this->timer->stop('cron_check');
$this->timer->start('cron_check');
}
}
$this->output(X::_('Ending poll process'), date('Y-m-d H:i:s'));
}
}
Returns the $data property. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions