r15822 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r15821‎ | r15822 | r15823 >
Date:07:11, 26 July 2006
Author:yurik
Status:old
Tags:
Comment:
* ADD: allpages - apfilterredir allows to only search for redirects or non-redirects
Modified paths:
  • /trunk/extensions/BotQuery/query.php (modified) (history)

Diff [purge]

Index: trunk/extensions/BotQuery/query.php
@@ -244,14 +244,18 @@
245245 'allpages' => array(
246246 GN_FUNC => 'genMetaAllPages',
247247 GN_ISMETA => true,
248 - GN_PARAMS => array( 'aplimit', 'apfrom', 'apnamespace' ),
249 - GN_DFLT => array( 50, '', 0 ),
 248+ GN_PARAMS => array( 'aplimit', 'apfrom', 'apnamespace', 'apfilterredir' ),
 249+ GN_DFLT => array( 50, '', 0,
 250+ array( GN_ENUM_DFLT => 'all',
 251+ GN_ENUM_ISMULTI => false,
 252+ GN_ENUM_CHOICES => array('all', 'redirects', 'nonredirects') )),
250253 GN_DESC => array(
251254 "Enumerates all available pages to the output list.",
252255 "Parameters supported:",
253256 "aplimit - How many total pages to return",
254257 "apfrom - The page title to start enumerating from.",
255258 "apnamespace - Limits which namespace to enumerate. Default 0 (Main)",
 259+ "apfilterredir- Which pages to list: 'all' (default), 'redirects', or 'nonredirects'",
256260 "Example: query.php?what=allpages&aplimit=50",
257261 )),
258262 'nolanglinks' => array(
@@ -908,6 +912,11 @@
909913 $where = array( 'page_namespace' => intval($apnamespace) );
910914 if( $apfrom !== '' ) $where[] = 'page_title>=' . $this->db->addQuotes($apfrom);
911915
 916+ if ($apfilterredir === 'redirects')
 917+ $where['page_is_redirect'] = 1;
 918+ else if ($apfilterredir === 'nonredirects')
 919+ $where['page_is_redirect'] = 0;
 920+
912921 $this->startDbProfiling();
913922 $res = $this->db->select(
914923 'page',