if ( in_array( $format, $allowed ) ) {
return $this->getMain()->createPrinterByName( $format );
}
+
return $this->getMain()->createPrinterByName( $allowed[0] );
}
if ( isset( $this->mParams['revids'] ) ) {
return 'revids';
}
+
return null;
}
$this->mRequestedPageFields = array_diff_key( $this->mRequestedPageFields, $pageFlds );
$pageFlds = array_merge( $pageFlds, $this->mRequestedPageFields );
+
return array_keys( $pageFlds );
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'r' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'n' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'c' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'i' );
}
+
return $values;
}
if ( !empty( $values ) && $result ) {
$result->setIndexedTagName( $values, 'rev' );
}
+
return $values;
}
// Get pageIDs data from the `page` table
$this->profileDBIn();
$res = $db->select( 'page', $this->getPageTableFields(), $set,
- __METHOD__ );
+ __METHOD__ );
$this->profileDBOut();
// Hack: get the ns:titles stored in array(ns => array(titles)) format
// Get pageIDs data from the `page` table
$this->profileDBIn();
$res = $db->select( 'page', $this->getPageTableFields(), $set,
- __METHOD__ );
+ __METHOD__ );
$this->profileDBOut();
}
unset( $this->mPendingRedirectIDs[$id] );
}
}
+
return $lb;
}
// Variants checking
global $wgContLang;
if ( $this->mConvertTitles &&
- count( $wgContLang->getVariants() ) > 1 &&
- !$titleObj->exists() ) {
+ count( $wgContLang->getVariants() ) > 1 &&
+ !$titleObj->exists()
+ ) {
// Language::findVariantLink will modify titleText and titleObj into
// the canonical variant if possible
$titleText = is_string( $title ) ? $title : $titleObj->getPrefixedText();
$result['generator'] = null;
}
}
+
return $result;
}
sort( $gens );
self::$generators = $gens;
}
+
return self::$generators;
}
sort( $querymodules );
$formatmodules = $this->getMain()->getModuleManager()->getNames( 'format' );
sort( $formatmodules );
+
return array(
'modules' => array(
ApiBase::PARAM_ISMULTI => true,
'action' => 'query',
'redirects' => '',
);
- if ( !is_null ( $pageid ) ) {
+ if ( !is_null( $pageid ) ) {
$reqParams['pageids'] = $pageid;
} else { // $page
$reqParams['titles'] = $page;
ApiResult::setContent( $result_array['wikitext'], $this->content->serialize( $format ) );
}
$result->addValue( null, $this->getModuleName(), $result_array );
+
return;
}
if ( isset( $prop['displaytitle'] ) ) {
$result_array['displaytitle'] = $p_result->getDisplayTitle() ?
- $p_result->getDisplayTitle() :
- $titleObj->getPrefixedText();
+ $p_result->getDisplayTitle() :
+ $titleObj->getPrefixedText();
}
if ( isset( $prop['headitems'] ) || isset( $prop['headhtml'] ) ) {
$popts->setIsSectionPreview( $params['sectionpreview'] );
wfProfileOut( __METHOD__ );
+
return $popts;
}
if ( $getWikitext ) {
$this->content = $page->getContent( Revision::RAW );
}
+
return $pout;
}
}
$this->dieUsage( "Sections are not supported by " . $what, 'nosuchsection' );
$section = false;
}
+
return $section;
}
ApiResult::setContent( $entry, $bits[1] );
$result[] = $entry;
}
+
return $result;
}
private function categoriesHtml( $categories ) {
$context = $this->getContext();
$context->getOutput()->addCategoryLinks( $categories );
+
return $context->getSkin()->getCategories();
}
$result[] = $entry;
}
}
+
return $result;
}
$result[] = $entry;
}
}
+
return $result;
}
ApiResult::setContent( $entry, $content );
$result[] = $entry;
}
+
return $result;
}
ApiResult::setContent( $entry, $value );
$result[] = $entry;
}
+
return $result;
}
ApiResult::setContent( $entry, $link );
$result[] = $entry;
}
+
return $result;
}
public function getParamDescription() {
$p = $this->getModulePrefix();
$wikitext = CONTENT_MODEL_WIKITEXT;
+
return array(
'text' => "Text to parse. Use {$p}title or {$p}contentmodel to control the content model",
'summary' => 'Summary to parse',
public function getDescription() {
$p = $this->getModulePrefix();
+
return array(
'Parses content and returns parser output',
'See the various prop-Modules of action=query to get information from the current version of a page',
'code' => 'notpatrollable',
'info' => "The revision can't be patrolled as it's too old"
)
- ) );
+ )
+ );
}
public function needsToken() {
$expiryarray[$p[0]] = $exp;
}
$resultProtections[] = array( $p[0] => $protections[$p[0]],
- 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() ?
- 'infinite' :
- wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) );
+ 'expiry' => ( $expiryarray[$p[0]] == $db->getInfinity() ?
+ 'infinite' :
+ wfTimestamp( TS_ISO_8601, $expiryarray[$p[0]] ) ) );
}
$cascade = $params['cascade'];
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'title' => "Title of the page you want to (un)protect. Cannot be used together with {$p}pageid",
'pageid' => "ID of the page you want to (un)protect. Cannot be used together with {$p}title",
'token' => 'A protect token previously retrieved through prop=info',
'protections' => 'List of protection levels, formatted action=group (e.g. edit=sysop)',
'expiry' => array( 'Expiry timestamps. If only one timestamp is set, it\'ll be used for all protections.',
- 'Use \'infinite\', \'indefinite\' or \'never\', for a never-expiring protection.' ),
+ 'Use \'infinite\', \'indefinite\' or \'never\', for a never-expiring protection.' ),
'reason' => 'Reason for (un)protecting',
'cascade' => array( 'Enable cascading protection (i.e. protect pages included in this page)',
- 'Ignored if not all protection levels are \'sysop\' or \'protect\'' ),
+ 'Ignored if not all protection levels are \'sysop\' or \'protect\'' ),
'watch' => 'If set, add the page being (un)protected to your watchlist',
'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
);
if ( !isset( $this->mPageSet ) ) {
$this->mPageSet = new ApiPageSet( $this );
}
+
return $this->mPageSet;
}
if ( $flags ) {
$result += $this->getPageSet()->getFinalParams( $flags );
}
+
return $result;
}
$this->mNamedDB[$name] = wfGetDB( $db, $groups );
$this->profileDBOut();
}
+
return $this->mNamedDB[$name];
}
*/
public function getModules() {
wfDeprecated( __METHOD__, '1.21' );
+
return $this->getModuleManager()->getNamesWithClasses();
}
$gens[$name] = $class;
}
}
+
return $gens;
}
public function getCustomPrinter() {
// If &exportnowrap is set, use the raw formatter
if ( $this->getParameter( 'export' ) &&
- $this->getParameter( 'exportnowrap' ) )
- {
+ $this->getParameter( 'exportnowrap' )
+ ) {
return new ApiFormatRaw( $this->getMain(),
$this->getMain()->createPrinterByName( 'xml' ) );
} else {
}
}
$this->dieContinueUsageIf( $completeModules !== null && count( $tmp ) !== 0 );
+
return $modules;
}
} else { // private
$cacheMode = 'private';
}
+
return $cacheMode;
}
ApiQueryBase::addTitleInfo( $vals, $title );
$vals['special'] = '';
if ( $title->isSpecialPage() &&
- !SpecialPageFactory::exists( $title->getDBkey() ) ) {
+ !SpecialPageFactory::exists( $title->getDBkey() )
+ ) {
$vals['missing'] = '';
} elseif ( $title->getNamespace() == NS_MEDIA &&
- !wfFindFile( $title ) ) {
+ !wfFindFile( $title )
+ ) {
$vals['missing'] = '';
}
$pages[$fakeId] = $vals;
$this->mGeneratorContinue = array();
}
$this->mGeneratorContinue[$paramName] = $paramValue;
+
return true;
}
if ( $flags ) {
$result += $this->getPageSet()->getFinalParams( $flags );
}
+
return $result;
}
$result = $this->getResult();
$count = 0;
foreach ( $res as $row ) {
- if ( ++ $count > $params['limit'] ) {
+ if ( ++$count > $params['limit'] ) {
// We've reached the one extra which shows that there are additional cats to be had. Stop here...
$this->setContinueEnumParameter( 'continue', $row->cat_title );
break;
}
}
if ( $params['filterbots'] != 'all' ) {
- $this->dieUsage( "Parameter '{$prefix}filterbots' can only be used with {$prefix}sort=timestamp", 'badparams' );
+ $this->dieUsage( "Parameter '{$prefix}filterbots' can only be used with {$prefix}sort=timestamp", 'badparams' );
}
// Pagination
'ug_user = img_user'
)
) ) );
- $groupCond = ( $params['filterbots'] == 'nobots' ? 'NULL': 'NOT NULL' );
+ $groupCond = ( $params['filterbots'] == 'nobots' ? 'NULL' : 'NOT NULL' );
$this->addWhere( "ug_group IS $groupCond" );
}
}
$count = 0;
$result = $this->getResult();
foreach ( $res as $row ) {
- if ( ++ $count > $limit ) {
+ if ( ++$count > $limit ) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
if ( $params['sort'] == 'name' ) {
$this->setContinueEnumParameter( 'continue', $row->img_name );
public function getParamDescription() {
$p = $this->getModulePrefix();
+
return array(
'sort' => 'Property to sort by',
'dir' => 'The direction in which to list',
public function getPossibleErrors() {
$p = $this->getModulePrefix();
+
return array_merge( parent::getPossibleErrors(), array(
array( 'code' => 'params', 'info' => 'Use "gaifilterredir=nonredirects" option instead of "redirects" when using allimages as a generator' ),
array( 'code' => 'badparams', 'info' => "Parameter'{$p}start' can only be used with {$p}sort=timestamp" ),