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


PHP DatabaseBase::buildLike方法代码示例

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


在下文中一共展示了DatabaseBase::buildLike方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:37,代码来源:namespaceDupesWT.php

示例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__);
 }
开发者ID:admonkey,项目名称:mediawiki,代码行数:19,代码来源:namespaceDupes.php

示例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__));
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:18,代码来源:namespaceDupes.php

示例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;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:removeTempUser.php

示例5: buildLike

 /**
  * @return string
  */
 function buildLike()
 {
     $params = func_get_args();
     if (count($params) > 0 && is_array($params[0])) {
         $params = $params[0];
     }
     return parent::buildLike($params) . "ESCAPE '\\' ";
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:11,代码来源:DatabaseSqlite.php

示例6: 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;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:removeRenamedUser.php

示例7: 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;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:29,代码来源:refreshImageMetadata.php


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