Esempio n. 1
0
 public function models_json()
 {
     usleep(500000);
     $object_list = C(ChatMessage)->find_all(Q::gt('id', $this->inVars('since_id', 0)), Q::order('-id'));
     echo self::models_to_jsonp(array_reverse($object_list), $this->inVars('callback', 'callback'));
     exit;
 }
Esempio n. 2
0
 public function current()
 {
     $this->vars('times', (int) C(BibitterCounter)->find_sum('times', Q::gt('updated', time() - 1800)));
     $this->vars('interval', def('update_span', 180) * 1000);
     return $this;
 }
Esempio n. 3
0
<?php

declare (ticks=1);
require dirname(__FILE__) . '/__settings__.php';
import('core.Log');
import('core.Request');
Log::disable_display();
import('Chat.ChatServer');
header('application/x-javascript');
$req = new Request();
$object_list = C(ChatMessage)->find_all(Q::gt('id', $req->inVars('since_id', 0)), Q::order('-id'));
if (count($object_list) > 0) {
    echo ChatServer::models_to_jsonp(array_reverse($object_list), $req->inVars('callback', 'callback'));
    exit;
}
$server = new ChatServer();
pcntl_signal(SIGTERM, array(&$server, 'models_json'));
pcntl_signal(SIGHUP, array(&$server, 'models_json'));
pcntl_signal(SIGUSR1, array(&$server, 'models_json'));
sleep(def('chat@timeout'));
Esempio n. 4
0
 private function get_current()
 {
     return (int) C(BibitterCounter)->find_sum('times', Q::gt('updated', time() - 1800));
 }