本文整理汇总了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);
}
示例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;
}
示例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);
}