本文整理汇总了PHP中DatabaseBase::strencode方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseBase::strencode方法的具体用法?PHP DatabaseBase::strencode怎么用?PHP DatabaseBase::strencode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseBase
的用法示例。
在下文中一共展示了DatabaseBase::strencode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConflicts
/**
* Find pages in mainspace that have a prefix of the new namespace
* so we know titles that will need migrating
* @param $ns int Namespace id (id for new namespace?)
* @param $name String Prefix that is being made a namespace
*/
private function getConflicts( $ns, $name ) {
$page = 'page';
$table = $this->db->tableName( $page );
$prefix = $this->db->strencode( $name );
$encNamespace = $this->db->addQuotes( $ns );
$titleSql = "TRIM(LEADING '$prefix:' FROM {$page}_title)";
if( $ns == 0 ) {
// An interwiki; try an alternate encoding with '-' for ':'
$titleSql = $this->db->buildConcat( array( "'$prefix-'", $titleSql ) );
}
$sql = "SELECT {$page}_id AS id,
{$page}_title AS oldtitle,
$encNamespace + {$page}_namespace AS namespace,
$titleSql AS title,
{$page}_namespace AS oldnamespace
FROM {$table}
WHERE ( {$page}_namespace=0 OR {$page}_namespace=1 )
AND {$page}_title " . $this->db->buildLike( $name . ':', $this->db->anyString() );
$result = $this->db->query( $sql, __METHOD__ );
$set = array();
foreach( $result as $row ) {
$set[] = $row;
}
return $set;
}
示例2: getWamIndexConditions
/**
* @param Array $options
* @param DatabaseBase $db
* @return array
*/
protected function getWamIndexConditions($options, $db)
{
$conds = array('fw1.time_id = FROM_UNIXTIME(' . $options['currentTimestamp'] . ')');
if ($options['wikiId']) {
$conds['fw1.wiki_id'] = $options['wikiId'];
}
if (!is_null($options['wikiWord'])) {
$conds[] = "dw.url like '%" . $db->strencode($options['wikiWord']) . "%' " . "OR dw.title like '%" . $db->strencode($options['wikiWord']) . "%'";
}
if ($options['verticalId']) {
$verticals = $options['verticalId'];
} else {
$verticals = $this->verticalIds;
}
$conds['fw1.vertical_id'] = $verticals;
if (!is_null($options['wikiLang'])) {
$conds['dw.lang'] = $db->strencode($options['wikiLang']);
}
if (!empty($options['excludeBlacklist']) || !empty($options['excludeNonCommercial'])) {
$bannedIds = !empty($options['excludeBlacklist']) ? $this->getIdsBlacklistedWikis() : [];
$nonCommercialIds = !empty($options['excludeNonCommercial']) ? $this->getNonCommercialWikis() : [];
$blacklistIds = array_merge($bannedIds, $nonCommercialIds);
if (!empty($blacklistIds)) {
$conds[] = 'fw1.wiki_id NOT IN (' . $db->makeList($blacklistIds) . ')';
}
}
return $conds;
}
示例3: getConditionsForStaffTool
protected function getConditionsForStaffTool($options, DatabaseBase $db)
{
$sqlOptions = array();
if (isset($options->lang)) {
$sqlOptions[self::CITY_VISUALIZATION_TABLE_NAME . '.city_lang_code'] = $options->lang;
}
if (!empty($options->wikiHeadline)) {
$sqlOptions[] = 'city_list.city_title like "%' . $db->strencode($options->wikiHeadline) . '%"';
}
if (!empty($options->verticalId)) {
$sqlOptions[self::CITY_VISUALIZATION_TABLE_NAME . '.city_vertical'] = $options->verticalId;
}
if (!empty($options->collectionId)) {
$sqlOptions[WikiaCollectionsModel::COLLECTIONS_CV_TABLE . '.collection_id'] = $options->collectionId;
}
if (!empty($options->blockedFlag)) {
$sqlOptions[] = self::CITY_VISUALIZATION_TABLE_NAME . '.city_flags & ' . WikisModel::FLAG_BLOCKED . ' > 0';
}
if (!empty($options->officialFlag)) {
$sqlOptions[] = self::CITY_VISUALIZATION_TABLE_NAME . '.city_flags & ' . WikisModel::FLAG_OFFICIAL . ' > 0';
}
if (!empty($options->promotedFlag)) {
$sqlOptions[] = self::CITY_VISUALIZATION_TABLE_NAME . '.city_flags & ' . WikisModel::FLAG_PROMOTED . ' > 0';
}
return $sqlOptions;
}