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


PHP IDatabase::makeList方法代码示例

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


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

示例1: getVisitingWatchersCondition

 /**
  * Generates condition for the query used in a batch count visiting watchers.
  *
  * @param IDatabase $db
  * @param array $targetsWithVisitThresholds array of pairs (LinkTarget, last visit threshold)
  * @return string
  */
 private function getVisitingWatchersCondition(IDatabase $db, array $targetsWithVisitThresholds)
 {
     $missingTargets = [];
     $namespaceConds = [];
     foreach ($targetsWithVisitThresholds as list($target, $threshold)) {
         if ($threshold === null) {
             $missingTargets[] = $target;
             continue;
         }
         /* @var LinkTarget $target */
         $namespaceConds[$target->getNamespace()][] = $db->makeList(['wl_title = ' . $db->addQuotes($target->getDBkey()), $db->makeList(['wl_notificationtimestamp >= ' . $db->addQuotes($db->timestamp($threshold)), 'wl_notificationtimestamp IS NULL'], LIST_OR)], LIST_AND);
     }
     $conds = [];
     foreach ($namespaceConds as $namespace => $pageConds) {
         $conds[] = $db->makeList(['wl_namespace = ' . $namespace, '(' . $db->makeList($pageConds, LIST_OR) . ')'], LIST_AND);
     }
     if ($missingTargets) {
         $lb = new LinkBatch($missingTargets);
         $conds[] = $lb->constructSet('wl', $db);
     }
     return $db->makeList($conds, LIST_OR);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:29,代码来源:WatchedItemStore.php

示例2: getExcludeClause

 /**
  * SQL clause to skip forbidden log types for this user
  *
  * @param IDatabase $db
  * @param string $audience Public/user
  * @param User $user User to check, or null to use $wgUser
  * @return string|bool String on success, false on failure.
  */
 public static function getExcludeClause($db, $audience = 'public', User $user = null)
 {
     global $wgLogRestrictions;
     if ($audience != 'public' && $user === null) {
         global $wgUser;
         $user = $wgUser;
     }
     // Reset the array, clears extra "where" clauses when $par is used
     $hiddenLogs = array();
     // Don't show private logs to unprivileged users
     foreach ($wgLogRestrictions as $logType => $right) {
         if ($audience == 'public' || !$user->isAllowed($right)) {
             $hiddenLogs[] = $logType;
         }
     }
     if (count($hiddenLogs) == 1) {
         return 'log_type != ' . $db->addQuotes($hiddenLogs[0]);
     } elseif ($hiddenLogs) {
         return 'log_type NOT IN (' . $db->makeList($hiddenLogs) . ')';
     }
     return false;
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:30,代码来源:LogEventsList.php

示例3: getFromUntilTargetConds

 /**
  * Creates a query condition part for getting only items before or after the given link target
  * (while ordering using $sort mode)
  *
  * @param IDatabase $db
  * @param LinkTarget $target
  * @param string $op comparison operator to use in the conditions
  * @return string
  */
 private function getFromUntilTargetConds(IDatabase $db, LinkTarget $target, $op)
 {
     return $db->makeList(["wl_namespace {$op} " . $target->getNamespace(), $db->makeList(['wl_namespace = ' . $target->getNamespace(), "wl_title {$op}= " . $db->addQuotes($target->getDBkey())], LIST_AND)], LIST_OR);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:13,代码来源:WatchedItemQueryService.php


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