本文整理汇总了PHP中DatabaseBase::anyString方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseBase::anyString方法的具体用法?PHP DatabaseBase::anyString怎么用?PHP DatabaseBase::anyString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseBase
的用法示例。
在下文中一共展示了DatabaseBase::anyString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: getTargetList
/**
* Find pages in main and talk namespaces that have a prefix of the new
* namespace so we know titles that will need migrating
*
* @param int $ns Destination namespace id
* @param string $name Prefix that is being made a namespace
* @param array $options Associative array of validated command-line options
*
* @return ResultWrapper
*/
private function getTargetList($ns, $name, $options)
{
if ($options['move-talk'] && MWNamespace::isSubject($ns)) {
$checkNamespaces = array(NS_MAIN, NS_TALK);
} else {
$checkNamespaces = NS_MAIN;
}
return $this->db->select('page', array('page_id', 'page_title', 'page_namespace'), array('page_namespace' => $checkNamespaces, 'page_title' . $this->db->buildLike("{$name}:", $this->db->anyString())), __METHOD__);
}
示例3: getConflicts
/**
* Find pages in mainspace that have a prefix of the new namespace
* so we know titles that will need migrating
*
* @param int $ns Namespace id (id for new namespace?)
* @param string $name Prefix that is being made a namespace
*
* @return array
*/
private function getConflicts($ns, $name)
{
$titleSql = "TRIM(LEADING {$this->db->addQuotes("{$name}:")} FROM page_title)";
if ($ns == 0) {
// An interwiki; try an alternate encoding with '-' for ':'
$titleSql = $this->db->buildConcat(array($this->db->addQuotes("{$name}-"), $titleSql));
}
return iterator_to_array($this->db->select('page', array('id' => 'page_id', 'oldtitle' => 'page_title', 'namespace' => $this->db->addQuotes($ns) . ' + page_namespace', 'title' => $titleSql, 'oldnamespace' => 'page_namespace'), array('page_namespace' => array(0, 1), 'page_title' . $this->db->buildLike("{$name}:", $this->db->anyString())), __METHOD__));
}
示例4: getAccountsToRemove
/**
* Get temp user accounts
*
* - check if these accounts are really temp ones
* - do not remove accounts with password set (122 of them)
*
* @param DatabaseBase $db
* @return int[]
*/
protected function getAccountsToRemove(DatabaseBase $db)
{
$res = $db->select(self::USER_TABLE, ['user_id', 'user_name'], ['user_name ' . $db->buildLike(self::TEMPUSER_PREFIX, $db->anyString()), 'user_password' => ''], __METHOD__);
$users = [];
while ($user = $res->fetchObject()) {
// check if this is really a temp user: "TempUser" + <user ID>
if ($user->user_name === self::TEMPUSER_PREFIX . $user->user_id) {
$users[] = intval($user->user_id);
} else {
$this->output(sprintf(" > skipped %s (#%d)\n", $user->user_name, $user->user_id));
}
}
return $users;
}
示例5: getAccountsToRemove
/**
* RenameUser process marks fake user accounts in user_properties table:
*
* select up_user, up_value from user_properties where up_property = 'renameData' and up_value LIKE 'renamed_to=W-%' limit 15;
*
* @see https://github.com/Wikia/app/commit/14238c4bdace691da929b46a55012f152ac815fa
*
* @param DatabaseBase $db
* @return int[]
*/
protected function getAccountsToRemove(DatabaseBase $db)
{
$users = $db->selectFieldValues(self::USER_PROPERTIES_TABLE, 'up_user', ['up_property' => 'renameData', 'up_value ' . $db->buildLike(self::RENAMEDUSER_PROPERTY_PREFIX, $db->anyString())], __METHOD__);
return $users;
}
示例6: getConditions
/**
* @param DatabaseBase $dbw
* @return array
*/
function getConditions($dbw)
{
$conds = [];
$end = $this->getOption('end', false);
$mime = $this->getOption('mime', false);
$mediatype = $this->getOption('mediatype', false);
$like = $this->getOption('metadata-contains', false);
if ($end !== false) {
$conds[] = 'img_name <= ' . $dbw->addQuotes($end);
}
if ($mime !== false) {
list($major, $minor) = File::splitMime($mime);
$conds['img_major_mime'] = $major;
if ($minor !== '*') {
$conds['img_minor_mime'] = $minor;
}
}
if ($mediatype !== false) {
$conds['img_media_type'] = $mediatype;
}
if ($like) {
$conds[] = 'img_metadata ' . $dbw->buildLike($dbw->anyString(), $like, $dbw->anyString());
}
return $conds;
}