class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
// Data for the various modules implemented by this class
class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
// Data for the various modules implemented by this class
'code' => 'lh',
'prefix' => 'pl',
'linktable' => 'pagelinks',
'from_namespace' => true,
'showredirects' => true,
'code' => 'lh',
'prefix' => 'pl',
'linktable' => 'pagelinks',
'from_namespace' => true,
'showredirects' => true,
'code' => 'ti',
'prefix' => 'tl',
'linktable' => 'templatelinks',
'from_namespace' => true,
'showredirects' => true,
'code' => 'ti',
'prefix' => 'tl',
'linktable' => 'templatelinks',
'from_namespace' => true,
'showredirects' => true,
'to_namespace' => NS_FILE,
'exampletitle' => 'File:Example.jpg',
'showredirects' => true,
'to_namespace' => NS_FILE,
'exampletitle' => 'File:Example.jpg',
'showredirects' => true,
public function __construct( ApiQuery $query, $moduleName ) {
parent::__construct( $query, $moduleName, self::$settings[$moduleName]['code'] );
public function __construct( ApiQuery $query, $moduleName ) {
parent::__construct( $query, $moduleName, self::$settings[$moduleName]['code'] );
$titles = array_filter( $titles, function ( $t ) use ( $bl_namespace ) {
return $t->getNamespace() === $bl_namespace;
} );
$titles = array_filter( $titles, function ( $t ) use ( $bl_namespace ) {
return $t->getNamespace() === $bl_namespace;
} );
// Figure out what we're sorting by, and add associated WHERE clauses.
// MySQL's query planner screws up if we include a field in ORDER BY
// when it's constant in WHERE, so we have to test that for each field.
// Figure out what we're sorting by, and add associated WHERE clauses.
// MySQL's query planner screws up if we include a field in ORDER BY
// when it's constant in WHERE, so we have to test that for each field.
if ( is_null( $resultPageSet ) ) {
$fld_pageid = isset( $prop['pageid'] );
$fld_title = isset( $prop['title'] );
$fld_redirect = isset( $prop['redirect'] );
$this->addFieldsIf( 'page_id', $fld_pageid );
if ( is_null( $resultPageSet ) ) {
$fld_pageid = isset( $prop['pageid'] );
$fld_title = isset( $prop['title'] );
$fld_redirect = isset( $prop['redirect'] );
$this->addFieldsIf( 'page_id', $fld_pageid );
$lb = new LinkBatch( $titles );
$this->addWhere( $lb->constructSet( $p, $db ) );
} else {
$lb = new LinkBatch( $titles );
$this->addWhere( $lb->constructSet( $p, $db ) );
} else {
foreach ( $titles as $t ) {
if ( $t->getNamespace() == $bl_namespace ) {
$where[] = "$bl_title = " . $db->addQuotes( $t->getDBkey() );
foreach ( $titles as $t ) {
if ( $t->getNamespace() == $bl_namespace ) {
$where[] = "$bl_title = " . $db->addQuotes( $t->getDBkey() );
"rd_fragment = $emptyString OR rd_fragment IS NULL",
isset( $show['!fragment'] )
);
"rd_fragment = $emptyString OR rd_fragment IS NULL",
isset( $show['!fragment'] )
);
- $this->addWhereIf( array( 'page_is_redirect' => 1 ), isset( $show['redirect'] ) );
- $this->addWhereIf( array( 'page_is_redirect' => 0 ), isset( $show['!redirect'] ) );
+ $this->addWhereIf( [ 'page_is_redirect' => 1 ], isset( $show['redirect'] ) );
+ $this->addWhereIf( [ 'page_is_redirect' => 0 ], isset( $show['!redirect'] ) );
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_DFLT => 'pageid|title',
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_DFLT => 'pageid|title',
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => 'namespace',
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => 'namespace',
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
ApiBase::PARAM_DFLT => 10,
ApiBase::PARAM_TYPE => 'limit',
ApiBase::PARAM_MIN => 1,
ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1,
ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2
ApiBase::PARAM_TYPE => $show,
ApiBase::PARAM_ISMULTI => true,
ApiBase::PARAM_TYPE => $show,
ApiBase::PARAM_ISMULTI => true,
$title = isset( $settings['exampletitle'] ) ? $settings['exampletitle'] : 'Main Page';
$etitle = rawurlencode( $title );
$title = isset( $settings['exampletitle'] ) ? $settings['exampletitle'] : 'Main Page';
$etitle = rawurlencode( $title );
"action=query&prop={$name}&titles={$etitle}"
=> "apihelp-$path-example-simple",
"action=query&generator={$name}&titles={$etitle}&prop=info"
=> "apihelp-$path-example-generator",
"action=query&prop={$name}&titles={$etitle}"
=> "apihelp-$path-example-simple",
"action=query&generator={$name}&titles={$etitle}&prop=info"
=> "apihelp-$path-example-generator",