当前位置: 首页>>代码示例>>PHP>>正文


PHP Queue::seek方法代码示例

本文整理汇总了PHP中Queue::seek方法的典型用法代码示例。如果您正苦于以下问题:PHP Queue::seek方法的具体用法?PHP Queue::seek怎么用?PHP Queue::seek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Queue的用法示例。


在下文中一共展示了Queue::seek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: work

 public static function work(&$controllerContext, &$viewContext)
 {
     $queue = new Queue(Config::$userQueuePath);
     $queueItem = new QueueItem(strtolower($controllerContext->userName));
     $j['user'] = $controllerContext->userName;
     $j['pos'] = $queue->seek($queueItem);
     $viewContext->layoutName = 'layout-json';
     $viewContext->json = $j;
 }
开发者ID:Lucas8x,项目名称:graph,代码行数:9,代码来源:UserControllerQueuePositionModule.php

示例2: preWork

 public static function preWork(&$controllerContext, &$viewContext)
 {
     $controllerContext->cache->setPrefix($controllerContext->userName);
     if (BanHelper::getUserBanState($controllerContext->userName) == BanHelper::USER_BAN_TOTAL) {
         $controllerContext->cache->bypass(true);
         $viewContext->userName = $controllerContext->userName;
         $viewContext->viewName = 'error-user-blocked';
         $viewContext->meta->title = 'User blocked — ' . Config::$title;
         return;
     }
     $module = $controllerContext->module;
     HttpHeadersHelper::setCurrentHeader('Content-Type', $module::getContentType());
     $viewContext->media = $controllerContext->media;
     $viewContext->module = $controllerContext->module;
     $viewContext->meta->noIndex = true;
     $viewContext->contentType = $module::getContentType();
     if ($viewContext->contentType != 'text/html') {
         $viewContext->layoutName = 'layout-raw';
     }
     Database::selectUser($controllerContext->userName);
     $user = R::findOne('user', 'LOWER(name) = LOWER(?)', [$controllerContext->userName]);
     if (empty($user)) {
         if (!isset($_GET['referral']) || $_GET['referral'] !== 'search') {
             $controllerContext->cache->bypass(true);
             $viewContext->userName = $controllerContext->userName;
             $viewContext->viewName = 'error-user-not-found';
             $viewContext->meta->title = 'User not found — ' . Config::$title;
             return;
         }
         $queue = new Queue(Config::$userQueuePath);
         $queueItem = new QueueItem(strtolower($controllerContext->userName));
         $queue->enqueue($queueItem);
         $viewContext->queuePosition = $queue->seek($queueItem);
         $controllerContext->cache->bypass(true);
         //try to load cache, if it exists
         $url = $controllerContext->url;
         if ($controllerContext->cache->exists($url)) {
             $controllerContext->cache->load($url);
             flush();
             $viewContext->layoutName = null;
             $viewContext->viewName = null;
             return;
         }
         $viewContext->userName = $controllerContext->userName;
         $viewContext->viewName = 'error-user-enqueued';
         $viewContext->meta->title = 'User enqueued — ' . Config::$title;
         return;
     }
     $viewContext->user = $user;
     $viewContext->meta->styles[] = '/media/css/menu.css';
     $viewContext->updateWait = Config::$userQueueMinWait;
     $module = $controllerContext->module;
     $module::preWork($controllerContext, $viewContext);
 }
开发者ID:Lucas8x,项目名称:graph,代码行数:54,代码来源:UserController.php

示例3: work

 public static function work(&$controllerContext, &$viewContext)
 {
     $queue = new Queue(Config::$userQueuePath);
     $queueItem = new QueueItem(strtolower($controllerContext->userName));
     $user = R::findOne('user', 'LOWER(name) = LOWER(?)', [$controllerContext->userName]);
     $profileAge = time() - strtotime($user->processed);
     $banned = BanHelper::getUserBanState($controllerContext->userName) != BanHelper::USER_BAN_NONE;
     if ($profileAge > Config::$userQueueMinWait and !$banned && Config::$enqueueEnabled) {
         $queue->enqueue($queueItem);
     }
     $j['user'] = $controllerContext->userName;
     $j['pos'] = $queue->seek($queueItem);
     $viewContext->layoutName = 'layout-json';
     $viewContext->json = $j;
 }
开发者ID:asmdz,项目名称:malgraph,代码行数:15,代码来源:UserControllerQueueAddModule.php


注:本文中的Queue::seek方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。