[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/api/ -> ApiQueryBase.php (summary)

Created on Sep 7, 2006 Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"

File Size: 719 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 38 functions

  __construct()
  getCacheMode()
  requestExtraData()
  getQuery()
  getDB()
  selectNamedDB()
  getPageSet()
  resetQueryParams()
  addTables()
  addJoinConds()
  addFields()
  addFieldsIf()
  addWhere()
  addWhereIf()
  addWhereFld()
  addWhereRange()
  addTimestampWhereRange()
  addOption()
  select()
  prepareUrlQuerySearchString()
  showHiddenUsersAddBlockInfo()
  addTitleInfo()
  addPageSubItems()
  addPageSubItem()
  setContinueEnumParameter()
  titlePartToKey()
  getDirectionDescription()
  validateSha1Hash()
  validateSha1Base36Hash()
  userCanSeeRevDel()
  checkRowCount()
  titleToKey()
  keyToTitle()
  keyPartToTitle()
  setGeneratorMode()
  getPageSet()
  encodeParamName()
  setContinueEnumParameter()

Functions
Functions that are not part of a class:

__construct( ApiQuery $queryModule, $moduleName, $paramPrefix = '' )   X-Ref

param: ApiQuery $queryModule
param: string $moduleName
param: string $paramPrefix

getCacheMode( $params )   X-Ref
Get the cache mode for the data generated by this module. Override
this in the module subclass. For possible return values and other
details about cache modes, see ApiMain::setCacheMode()

Public caching will only be allowed if *all* the modules that supply
data for a given request return a cache mode of public.

param: array $params
return: string

requestExtraData( $pageSet )   X-Ref
Override this method to request extra fields from the pageSet
using $pageSet->requestField('fieldName')

param: ApiPageSet $pageSet

getQuery()   X-Ref
Get the main Query module

return: ApiQuery

getDB()   X-Ref
Get the Query database connection (read-only)

return: DatabaseBase

selectNamedDB( $name, $db, $groups )   X-Ref
Selects the query database connection with the given name.
See ApiQuery::getNamedDB() for more information

param: string $name Name to assign to the database connection
param: int $db One of the DB_* constants
param: array $groups Query groups
return: DatabaseBase

getPageSet()   X-Ref
Get the PageSet object to work on

return: ApiPageSet

resetQueryParams()   X-Ref
Blank the internal arrays with query parameters


addTables( $tables, $alias = null )   X-Ref
Add a set of tables to the internal array

param: string|string[] $tables Table name or array of table names
param: string|null $alias Table alias, or null for no alias. Cannot be

addJoinConds( $join_conds )   X-Ref
Add a set of JOIN conditions to the internal array

JOIN conditions are formatted as array( tablename => array(jointype,
conditions) e.g. array('page' => array('LEFT JOIN',
'page_id=rev_page')) . conditions may be a string or an
addWhere()-style array
param: array $join_conds JOIN conditions

addFields( $value )   X-Ref
Add a set of fields to select to the internal array

param: array|string $value Field name or array of field names

addFieldsIf( $value, $condition )   X-Ref
Same as addFields(), but add the fields only if a condition is met

param: array|string $value See addFields()
param: bool $condition If false, do nothing
return: bool $condition

addWhere( $value )   X-Ref
Add a set of WHERE clauses to the internal array.
Clauses can be formatted as 'foo=bar' or array('foo' => 'bar'),
the latter only works if the value is a constant (i.e. not another field)

If $value is an empty array, this function does nothing.

For example, array('foo=bar', 'baz' => 3, 'bla' => 'foo') translates
to "foo=bar AND baz='3' AND bla='foo'"
param: string|array $value

addWhereIf( $value, $condition )   X-Ref
Same as addWhere(), but add the WHERE clauses only if a condition is met

param: string|array $value
param: bool $condition If false, do nothing
return: bool $condition

addWhereFld( $field, $value )   X-Ref
Equivalent to addWhere(array($field => $value))

param: string $field Field name
param: string $value Value; ignored if null or empty array;

addWhereRange( $field, $dir, $start, $end, $sort = true )   X-Ref
Add a WHERE clause corresponding to a range, and an ORDER BY
clause to sort in the right direction

param: string $field Field name
param: string $dir If 'newer', sort in ascending order, otherwise
param: string $start Value to start the list at. If $dir == 'newer'
param: string $end Value to end the list at. If $dir == 'newer' this
param: bool $sort If false, don't add an ORDER BY clause

addTimestampWhereRange( $field, $dir, $start, $end, $sort = true )   X-Ref
Add a WHERE clause corresponding to a range, similar to addWhereRange,
but converts $start and $end to database timestamps.

param: string $field
param: string $dir
param: string $start
param: string $end
param: bool $sort

addOption( $name, $value = null )   X-Ref
Add an option such as LIMIT or USE INDEX. If an option was set
before, the old value will be overwritten

param: string $name Option name
param: string $value Option value

select( $method, $extraQuery = array()   X-Ref
Execute a SELECT query based on the values in the internal arrays

param: string $method Function the query should be attributed to.
param: array $extraQuery Query data to add but not store in the object
return: ResultWrapper

prepareUrlQuerySearchString( $query = null, $protocol = null )   X-Ref

param: string $query
param: string $protocol
return: null|string

showHiddenUsersAddBlockInfo( $showBlockInfo )   X-Ref
Filters hidden users (where the user doesn't have the right to view them)
Also adds relevant block information

param: bool $showBlockInfo
return: void

addTitleInfo( &$arr, $title, $prefix = '' )   X-Ref
Add information (title and namespace) about a Title object to a
result array

param: array $arr Result array à la ApiResult
param: Title $title
param: string $prefix Module prefix

addPageSubItems( $pageId, $data )   X-Ref
Add a sub-element under the page element with the given page ID

param: int $pageId Page ID
param: array $data Data array à la ApiResult
return: bool Whether the element fit in the result

addPageSubItem( $pageId, $item, $elemname = null )   X-Ref
Same as addPageSubItems(), but one element of $data at a time

param: int $pageId Page ID
param: array $item Data array à la ApiResult
param: string $elemname XML element name. If null, getModuleName()
return: bool Whether the element fit in the result

setContinueEnumParameter( $paramName, $paramValue )   X-Ref
Set a query-continue value

param: string $paramName Parameter name
param: string|array $paramValue Parameter value

titlePartToKey( $titlePart, $namespace = NS_MAIN )   X-Ref
Convert an input title or title prefix into a dbkey.

$namespace should always be specified in order to handle per-namespace
capitalization settings.

param: string $titlePart Title part
param: int $defaultNamespace Namespace of the title
return: string DBkey (no namespace prefix)

getDirectionDescription( $p = '', $extraDirText = '' )   X-Ref
Gets the personalised direction parameter description

param: string $p ModulePrefix
param: string $extraDirText Any extra text to be appended on the description
return: array

validateSha1Hash( $hash )   X-Ref

param: string $hash
return: bool

validateSha1Base36Hash( $hash )   X-Ref

param: string $hash
return: bool

userCanSeeRevDel()   X-Ref
Check whether the current user has permission to view revision-deleted
fields.

return: bool

checkRowCount()   X-Ref
Estimate the row count for the SELECT query that would be run if we
called select() right now, and check if it's acceptable.

return: bool True if acceptable, false otherwise

titleToKey( $title )   X-Ref
Convert a title to a DB key

param: string $title Page title with spaces
return: string Page title with underscores

keyToTitle( $key )   X-Ref
The inverse of titleToKey()

param: string $key Page title with underscores
return: string Page title with spaces

keyPartToTitle( $keyPart )   X-Ref
Inverse of titlePartToKey()

param: string $keyPart DBkey, with prefix
return: string Key part with underscores

setGeneratorMode( ApiPageSet $generatorPageSet )   X-Ref
Switch this module to generator mode. By default, generator mode is
switched off and the module acts like a normal query module.

param: ApiPageSet $generatorPageSet ApiPageSet object that the module will get

getPageSet()   X-Ref
Get the PageSet object to work on.
If this module is generator, the pageSet object is different from other module's

return: ApiPageSet

encodeParamName( $paramName )   X-Ref
Overrides ApiBase to prepend 'g' to every generator parameter

param: string $paramName Parameter name
return: string Prefixed parameter name

setContinueEnumParameter( $paramName, $paramValue )   X-Ref
Overridden to set the generator param if in generator mode

param: string $paramName Parameter name
param: string|array $paramValue Parameter value



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1