public function club() { $users = DB::select('select users.*,count(posts.id) as p_count, ' . '(select count(id) from subs where subs.sub_fp = users.user_fp) as s_count ' . 'from posts left join users on posts.user_fp = users.user_fp ' . 'where posts.parent_id = 0 and users.id != 1 group by posts.user_fp order by p_count desc'); $groups = DB::select('select groups.*,count(posts.id) as p_count, ' . '(select count(id) from gsubs where gsubs.group_name = groups.group_name) as s_count ' . 'from posts left join groups on posts.group_name = groups.group_name ' . 'where posts.parent_id = 0 and posts.group_name != "" and groups.is_featured = 1 ' . 'group by posts.group_name order by p_count desc'); $chans = Chan::all(); return View::make('meta.club', ['users' => $users, 'chans' => $chans, 'groups' => $groups]); }
/** * worker master - Chan */ function workerChan() { $start = microtime(true); echo "\nworkerChan start at {$start}"; $jobs = array('0' => array('1', '2', '3'), '1' => array('1', '2', '3'), '2' => array('1', '2', '3')); if ($jobs) { $chanCnt = count($jobs); if ($chanCnt && $jobs) { $jobCnt = count($jobs, COUNT_RECURSIVE); $chan = new Chan("demoWorker", $jobs); $chan->waiting(); $stop = microtime(true); $cost = $stop - $start; echo "\nworkerChan {$jobCnt} jobs done at {$stop}"; echo "\nworkerChan {$jobCnt} cost time = {$cost}"; } } else { //for daemon mode echo "\nworkerChan no job and sleep 5s"; sleep(5); } $end = microtime(true); echo "\nworkerChan end at {$end}"; }
<?php require 'config.php'; require 'Chan.php'; $mongo = new Mongo('mongodb://' . DB_USER . ':' . DB_PASS . '@localhost/' . DB_NAME); $db = $mongo->selectDB(DB_NAME); $chan = new Chan($db, SITE_PATH, SITE_FS_PATH, $_GET, $_POST, $_FILES); $chan->out();
public function chansStat() { return Response::json(Chan::getChans()); }