MediaWiki  1.23.13
ApiQueryBase.php
Go to the documentation of this file.
1 <?php
34 abstract class ApiQueryBase extends ApiBase {
35 
37 
43  public function __construct( ApiBase $query, $moduleName, $paramPrefix = '' ) {
44  parent::__construct( $query->getMain(), $moduleName, $paramPrefix );
45  $this->mQueryModule = $query;
46  $this->mDb = null;
47  $this->resetQueryParams();
48  }
49 
61  public function getCacheMode( $params ) {
62  return 'private';
63  }
64 
68  protected function resetQueryParams() {
69  $this->tables = array();
70  $this->where = array();
71  $this->fields = array();
72  $this->options = array();
73  $this->join_conds = array();
74  }
75 
82  protected function addTables( $tables, $alias = null ) {
83  if ( is_array( $tables ) ) {
84  if ( !is_null( $alias ) ) {
85  ApiBase::dieDebug( __METHOD__, 'Multiple table aliases not supported' );
86  }
87  $this->tables = array_merge( $this->tables, $tables );
88  } else {
89  if ( !is_null( $alias ) ) {
90  $this->tables[$alias] = $tables;
91  } else {
92  $this->tables[] = $tables;
93  }
94  }
95  }
96 
106  protected function addJoinConds( $join_conds ) {
107  if ( !is_array( $join_conds ) ) {
108  ApiBase::dieDebug( __METHOD__, 'Join conditions have to be arrays' );
109  }
110  $this->join_conds = array_merge( $this->join_conds, $join_conds );
111  }
112 
117  protected function addFields( $value ) {
118  if ( is_array( $value ) ) {
119  $this->fields = array_merge( $this->fields, $value );
120  } else {
121  $this->fields[] = $value;
122  }
123  }
124 
131  protected function addFieldsIf( $value, $condition ) {
132  if ( $condition ) {
133  $this->addFields( $value );
134 
135  return true;
136  }
137 
138  return false;
139  }
140 
152  protected function addWhere( $value ) {
153  if ( is_array( $value ) ) {
154  // Sanity check: don't insert empty arrays,
155  // Database::makeList() chokes on them
156  if ( count( $value ) ) {
157  $this->where = array_merge( $this->where, $value );
158  }
159  } else {
160  $this->where[] = $value;
161  }
162  }
163 
170  protected function addWhereIf( $value, $condition ) {
171  if ( $condition ) {
172  $this->addWhere( $value );
173 
174  return true;
175  }
176 
177  return false;
178  }
179 
185  protected function addWhereFld( $field, $value ) {
186  // Use count() to its full documented capabilities to simultaneously
187  // test for null, empty array or empty countable object
188  if ( count( $value ) ) {
189  $this->where[$field] = $value;
190  }
191  }
192 
205  protected function addWhereRange( $field, $dir, $start, $end, $sort = true ) {
206  $isDirNewer = ( $dir === 'newer' );
207  $after = ( $isDirNewer ? '>=' : '<=' );
208  $before = ( $isDirNewer ? '<=' : '>=' );
209  $db = $this->getDB();
210 
211  if ( !is_null( $start ) ) {
212  $this->addWhere( $field . $after . $db->addQuotes( $start ) );
213  }
214 
215  if ( !is_null( $end ) ) {
216  $this->addWhere( $field . $before . $db->addQuotes( $end ) );
217  }
218 
219  if ( $sort ) {
220  $order = $field . ( $isDirNewer ? '' : ' DESC' );
221  // Append ORDER BY
222  $optionOrderBy = isset( $this->options['ORDER BY'] )
223  ? (array)$this->options['ORDER BY']
224  : array();
225  $optionOrderBy[] = $order;
226  $this->addOption( 'ORDER BY', $optionOrderBy );
227  }
228  }
229 
240  protected function addTimestampWhereRange( $field, $dir, $start, $end, $sort = true ) {
241  $db = $this->getDb();
242  $this->addWhereRange( $field, $dir,
243  $db->timestampOrNull( $start ), $db->timestampOrNull( $end ), $sort );
244  }
245 
252  protected function addOption( $name, $value = null ) {
253  if ( is_null( $value ) ) {
254  $this->options[] = $name;
255  } else {
256  $this->options[$name] = $value;
257  }
258  }
259 
274  protected function select( $method, $extraQuery = array() ) {
275 
276  $tables = array_merge(
277  $this->tables,
278  isset( $extraQuery['tables'] ) ? (array)$extraQuery['tables'] : array()
279  );
280  $fields = array_merge(
281  $this->fields,
282  isset( $extraQuery['fields'] ) ? (array)$extraQuery['fields'] : array()
283  );
284  $where = array_merge(
285  $this->where,
286  isset( $extraQuery['where'] ) ? (array)$extraQuery['where'] : array()
287  );
288  $options = array_merge(
289  $this->options,
290  isset( $extraQuery['options'] ) ? (array)$extraQuery['options'] : array()
291  );
292  $join_conds = array_merge(
293  $this->join_conds,
294  isset( $extraQuery['join_conds'] ) ? (array)$extraQuery['join_conds'] : array()
295  );
296 
297  // getDB has its own profileDBIn/Out calls
298  $db = $this->getDB();
299 
300  $this->profileDBIn();
301  $res = $db->select( $tables, $fields, $where, $method, $options, $join_conds );
302  $this->profileDBOut();
303 
304  return $res;
305  }
306 
312  protected function checkRowCount() {
313  $db = $this->getDB();
314  $this->profileDBIn();
315  $rowcount = $db->estimateRowCount(
316  $this->tables,
317  $this->fields,
318  $this->where,
319  __METHOD__,
320  $this->options
321  );
322  $this->profileDBOut();
323 
324  global $wgAPIMaxDBRows;
325  if ( $rowcount > $wgAPIMaxDBRows ) {
326  return false;
327  }
328 
329  return true;
330  }
331 
339  public static function addTitleInfo( &$arr, $title, $prefix = '' ) {
340  $arr[$prefix . 'ns'] = intval( $title->getNamespace() );
341  $arr[$prefix . 'title'] = $title->getPrefixedText();
342  }
343 
349  public function requestExtraData( $pageSet ) {
350  }
351 
356  public function getQuery() {
357  return $this->mQueryModule;
358  }
359 
366  protected function addPageSubItems( $pageId, $data ) {
367  $result = $this->getResult();
368  $result->setIndexedTagName( $data, $this->getModulePrefix() );
369 
370  return $result->addValue( array( 'query', 'pages', intval( $pageId ) ),
371  $this->getModuleName(),
372  $data );
373  }
374 
383  protected function addPageSubItem( $pageId, $item, $elemname = null ) {
384  if ( is_null( $elemname ) ) {
385  $elemname = $this->getModulePrefix();
386  }
387  $result = $this->getResult();
388  $fit = $result->addValue( array( 'query', 'pages', $pageId,
389  $this->getModuleName() ), null, $item );
390  if ( !$fit ) {
391  return false;
392  }
393  $result->setIndexedTagName_internal( array( 'query', 'pages', $pageId,
394  $this->getModuleName() ), $elemname );
395 
396  return true;
397  }
398 
404  protected function setContinueEnumParameter( $paramName, $paramValue ) {
405  $paramName = $this->encodeParamName( $paramName );
406  $msg = array( $paramName => $paramValue );
407  $result = $this->getResult();
408  $result->disableSizeCheck();
409  $result->addValue( 'query-continue', $this->getModuleName(), $msg, ApiResult::ADD_ON_TOP );
410  $result->enableSizeCheck();
411  }
412 
417  protected function getDB() {
418  if ( is_null( $this->mDb ) ) {
419  $this->mDb = $this->getQuery()->getDB();
420  }
421 
422  return $this->mDb;
423  }
424 
433  public function selectNamedDB( $name, $db, $groups ) {
434  $this->mDb = $this->getQuery()->getNamedDB( $name, $db, $groups );
435  }
436 
441  protected function getPageSet() {
442  return $this->getQuery()->getPageSet();
443  }
444 
450  public function titleToKey( $title ) {
451  // Don't throw an error if we got an empty string
452  if ( trim( $title ) == '' ) {
453  return '';
454  }
456  if ( !$t ) {
457  $this->dieUsageMsg( array( 'invalidtitle', $title ) );
458  }
459 
460  return $t->getPrefixedDBkey();
461  }
462 
468  public function keyToTitle( $key ) {
469  // Don't throw an error if we got an empty string
470  if ( trim( $key ) == '' ) {
471  return '';
472  }
473  $t = Title::newFromDBkey( $key );
474  // This really shouldn't happen but we gotta check anyway
475  if ( !$t ) {
476  $this->dieUsageMsg( array( 'invalidtitle', $key ) );
477  }
478 
479  return $t->getPrefixedText();
480  }
481 
491  public function titlePartToKey( $titlePart, $defaultNamespace = NS_MAIN ) {
492  $t = Title::makeTitleSafe( $defaultNamespace, $titlePart . 'x' );
493  if ( !$t ) {
494  $this->dieUsageMsg( array( 'invalidtitle', $titlePart ) );
495  }
496  if ( $defaultNamespace != $t->getNamespace() || $t->isExternal() ) {
497  // This can happen in two cases. First, if you call titlePartToKey with a title part
498  // that looks like a namespace, but with $defaultNamespace = NS_MAIN. It would be very
499  // difficult to handle such a case. Such cases cannot exist and are therefore treated
500  // as invalid user input. The second case is when somebody specifies a title interwiki
501  // prefix.
502  $this->dieUsageMsg( array( 'invalidtitle', $titlePart ) );
503  }
504 
505  return substr( $t->getDbKey(), 0, -1 );
506  }
507 
513  public function keyPartToTitle( $keyPart ) {
514  return substr( $this->keyToTitle( $keyPart . 'x' ), 0, -1 );
515  }
516 
524  public function getDirectionDescription( $p = '', $extraDirText = '' ) {
525  return array(
526  "In which direction to enumerate{$extraDirText}",
527  " newer - List oldest first. Note: {$p}start has to be before {$p}end.",
528  " older - List newest first (default). Note: {$p}start has to be later than {$p}end.",
529  );
530  }
531 
537  public function prepareUrlQuerySearchString( $query = null, $protocol = null ) {
538  $db = $this->getDb();
539  if ( !is_null( $query ) || $query != '' ) {
540  if ( is_null( $protocol ) ) {
541  $protocol = 'http://';
542  }
543 
544  $likeQuery = LinkFilter::makeLikeArray( $query, $protocol );
545  if ( !$likeQuery ) {
546  $this->dieUsage( 'Invalid query', 'bad_query' );
547  }
548 
549  $likeQuery = LinkFilter::keepOneWildcard( $likeQuery );
550 
551  return 'el_index ' . $db->buildLike( $likeQuery );
552  } elseif ( !is_null( $protocol ) ) {
553  return 'el_index ' . $db->buildLike( "$protocol", $db->anyString() );
554  }
555 
556  return null;
557  }
558 
566  public function showHiddenUsersAddBlockInfo( $showBlockInfo ) {
567  $this->addTables( 'ipblocks' );
568  $this->addJoinConds( array(
569  'ipblocks' => array( 'LEFT JOIN', 'ipb_user=user_id' ),
570  ) );
571 
572  $this->addFields( 'ipb_deleted' );
573 
574  if ( $showBlockInfo ) {
575  $this->addFields( array( 'ipb_id', 'ipb_by', 'ipb_by_text', 'ipb_reason', 'ipb_expiry' ) );
576  }
577 
578  // Don't show hidden names
579  if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
580  $this->addWhere( 'ipb_deleted = 0 OR ipb_deleted IS NULL' );
581  }
582  }
583 
588  public function validateSha1Hash( $hash ) {
589  return preg_match( '/^[a-f0-9]{40}$/', $hash );
590  }
591 
596  public function validateSha1Base36Hash( $hash ) {
597  return preg_match( '/^[a-z0-9]{31}$/', $hash );
598  }
599 
603  public function getPossibleErrors() {
604  $errors = parent::getPossibleErrors();
605  $errors = array_merge( $errors, array(
606  array( 'invalidtitle', 'title' ),
607  array( 'invalidtitle', 'key' ),
608  ) );
609 
610  return $errors;
611  }
612 
618  public function userCanSeeRevDel() {
619  return $this->getUser()->isAllowedAny( 'deletedhistory', 'deletedtext', 'suppressrevision' );
620  }
621 }
622 
626 abstract class ApiQueryGeneratorBase extends ApiQueryBase {
627 
628  private $mGeneratorPageSet = null;
629 
637  public function setGeneratorMode( ApiPageSet $generatorPageSet ) {
638  if ( $generatorPageSet === null ) {
639  ApiBase::dieDebug( __METHOD__, 'Required parameter missing - $generatorPageSet' );
640  }
641  $this->mGeneratorPageSet = $generatorPageSet;
642  }
643 
649  protected function getPageSet() {
650  if ( $this->mGeneratorPageSet !== null ) {
652  }
653 
654  return parent::getPageSet();
655  }
656 
662  public function encodeParamName( $paramName ) {
663  if ( $this->mGeneratorPageSet !== null ) {
664  return 'g' . parent::encodeParamName( $paramName );
665  } else {
666  return parent::encodeParamName( $paramName );
667  }
668  }
669 
676  protected function setContinueEnumParameter( $paramName, $paramValue ) {
677  // If this is a generator and query->setGeneratorContinue() returns false, treat as before
678  if ( $this->mGeneratorPageSet === null
679  || !$this->getQuery()->setGeneratorContinue( $this, $paramName, $paramValue )
680  ) {
681  parent::setContinueEnumParameter( $paramName, $paramValue );
682  }
683  }
684 
690  abstract public function executeGenerator( $resultPageSet );
691 }
ApiQueryBase\validateSha1Base36Hash
validateSha1Base36Hash( $hash)
Definition: ApiQueryBase.php:596
ApiQueryBase\showHiddenUsersAddBlockInfo
showHiddenUsersAddBlockInfo( $showBlockInfo)
Filters hidden users (where the user doesn't have the right to view them) Also adds relevant block in...
Definition: ApiQueryBase.php:566
ApiQueryBase\addPageSubItems
addPageSubItems( $pageId, $data)
Add a sub-element under the page element with the given page ID.
Definition: ApiQueryBase.php:366
$result
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message. Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item. $reader:XMLReader object $logInfo:Array of information Return false to stop further processing of the tag 'ImportHandlePageXMLTag':When parsing a XML tag in a page. $reader:XMLReader object $pageInfo:Array of information Return false to stop further processing of the tag 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision. $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information Return false to stop further processing of the tag 'ImportHandleToplevelXMLTag':When parsing a top level XML tag. $reader:XMLReader object Return false to stop further processing of the tag 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload. $reader:XMLReader object $revisionInfo:Array of information Return false to stop further processing of the tag 'InfoAction':When building information to display on the action=info page. $context:IContextSource object & $pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect. $title:Title object for the current page $request:WebRequest $ignoreRedirect:boolean to skip redirect check $target:Title/string of redirect target $article:Article object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not. Return true without providing an interwiki to continue interwiki search. $prefix:interwiki prefix we are looking for. & $iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InternalParseBeforeSanitize':during Parser 's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings. Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InternalParseBeforeLinks':during Parser 's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings. & $parser:Parser object & $text:string containing partially parsed text & $stripState:Parser 's internal StripState object 'InvalidateEmailComplete':Called after a user 's email has been invalidated successfully. $user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification. Callee may modify $url and $query, URL will be constructed as $url . $query & $url:URL to index.php & $query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) $article:article(object) being checked 'IsTrustedProxy':Override the result of wfIsTrustedProxy() $ip:IP being check $result:Change this value to override the result of wfIsTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from & $allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of User::isValidEmailAddr(), for instance to return false if the domain name doesn 't match your organization. $addr:The e-mail address entered by the user & $result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user & $result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we 're looking for a messages file for & $file:The messages file path, you can override this to change the location. 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces. Do not use this hook to add namespaces. Use CanonicalNamespaces for that. & $namespaces:Array of namespaces indexed by their numbers 'LanguageGetMagic':DEPRECATED, use $magicWords in a file listed in $wgExtensionMessagesFiles instead. Use this to define synonyms of magic words depending of the language $magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetSpecialPageAliases':DEPRECATED, use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead. Use to define aliases of special pages names depending of the language $specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names. & $names:array of language code=> language name $code language of the preferred translations 'LanguageLinks':Manipulate a page 's language links. This is called in various places to allow extensions to define the effective language links for a page. $title:The page 's Title. & $links:Associative array mapping language codes to prefixed links of the form "language:title". & $linkFlags:Associative array mapping prefixed links to arrays of flags. Currently unused, but planned to provide support for marking individual language links in the UI, e.g. for featured articles. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts. Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters. $skin:the Skin object $target:the Title that the link is pointing to & $html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1528
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:189
ApiQueryBase\addFields
addFields( $value)
Add a set of fields to select to the internal array.
Definition: ApiQueryBase.php:117
ApiQueryGeneratorBase\encodeParamName
encodeParamName( $paramName)
Overrides base class to prepend 'g' to every generator parameter.
Definition: ApiQueryBase.php:662
php
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
Definition: skin.txt:62
ApiQueryBase\resetQueryParams
resetQueryParams()
Blank the internal arrays with query parameters.
Definition: ApiQueryBase.php:68
ApiQueryGeneratorBase\$mGeneratorPageSet
$mGeneratorPageSet
Definition: ApiQueryBase.php:628
ApiQueryGeneratorBase\executeGenerator
executeGenerator( $resultPageSet)
Execute this module as a generator.
ApiQueryBase\keyToTitle
keyToTitle( $key)
The inverse of titleToKey()
Definition: ApiQueryBase.php:468
ApiQueryBase\addTimestampWhereRange
addTimestampWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, similar to addWhereRange, but converts $start and $end t...
Definition: ApiQueryBase.php:240
ApiBase\dieUsageMsg
dieUsageMsg( $error)
Output the error message related to a certain array.
Definition: ApiBase.php:1933
LinkFilter\keepOneWildcard
static keepOneWildcard( $arr)
Filters an array returned by makeLikeArray(), removing everything past first pattern placeholder.
Definition: LinkFilter.php:177
ApiBase\profileDBIn
profileDBIn()
Start module profiling.
Definition: ApiBase.php:2266
ApiBase\getResult
getResult()
Get the result object.
Definition: ApiBase.php:205
ApiQueryBase\getQuery
getQuery()
Get the main Query module.
Definition: ApiQueryBase.php:356
ApiQueryBase\select
select( $method, $extraQuery=array())
Execute a SELECT query based on the values in the internal arrays.
Definition: ApiQueryBase.php:274
ApiQueryBase\$fields
$fields
Definition: ApiQueryBase.php:36
ApiBase\profileDBOut
profileDBOut()
End database profiling.
Definition: ApiBase.php:2283
ApiQueryBase\getDirectionDescription
getDirectionDescription( $p='', $extraDirText='')
Gets the personalised direction parameter description.
Definition: ApiQueryBase.php:524
ApiQueryGeneratorBase\setGeneratorMode
setGeneratorMode(ApiPageSet $generatorPageSet)
Switch this module to generator mode.
Definition: ApiQueryBase.php:637
$params
$params
Definition: styleTest.css.php:40
ApiQueryBase\addOption
addOption( $name, $value=null)
Add an option such as LIMIT or USE INDEX.
Definition: ApiQueryBase.php:252
ContextSource\getUser
getUser()
Get the User object.
Definition: ContextSource.php:132
ApiQueryBase\$options
$options
Definition: ApiQueryBase.php:36
ApiQueryBase\addFieldsIf
addFieldsIf( $value, $condition)
Same as addFields(), but add the fields only if a condition is met.
Definition: ApiQueryBase.php:131
ApiPageSet
This class contains a list of pages that the client has requested.
Definition: ApiPageSet.php:41
ApiBase
This abstract class implements many basic API functions, and is the base of all API classes.
Definition: ApiBase.php:42
NS_MAIN
const NS_MAIN
Definition: Defines.php:79
ApiQueryBase\__construct
__construct(ApiBase $query, $moduleName, $paramPrefix='')
Definition: ApiQueryBase.php:43
ApiQueryGeneratorBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Overrides base in case of generator & smart continue to notify ApiQueryMain instead of adding them to...
Definition: ApiQueryBase.php:676
ApiQueryGeneratorBase\getPageSet
getPageSet()
Get the PageSet object to work on.
Definition: ApiQueryBase.php:649
ApiQueryBase
This is a base class for all Query modules.
Definition: ApiQueryBase.php:34
ApiQueryBase\getDB
getDB()
Get the Query database connection (read-only)
Definition: ApiQueryBase.php:417
LinkFilter\makeLikeArray
static makeLikeArray( $filterEntry, $protocol='http://')
Make an array to be used for calls to DatabaseBase::buildLike(), which will match the specified strin...
Definition: LinkFilter.php:94
ApiQueryBase\addTables
addTables( $tables, $alias=null)
Add a set of tables to the internal array.
Definition: ApiQueryBase.php:82
array
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
global
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:93
ApiQueryBase\titleToKey
titleToKey( $title)
Convert a title to a DB key.
Definition: ApiQueryBase.php:450
ApiQueryBase\$mDb
$mDb
Definition: ApiQueryBase.php:36
$sort
$sort
Definition: profileinfo.php:301
ApiQueryBase\$where
$where
Definition: ApiQueryBase.php:36
ApiBase\getModulePrefix
getModulePrefix()
Get parameter prefix (usually two letters or an empty string).
Definition: ApiBase.php:165
ApiQueryBase\addWhereRange
addWhereRange( $field, $dir, $start, $end, $sort=true)
Add a WHERE clause corresponding to a range, and an ORDER BY clause to sort in the right direction.
Definition: ApiQueryBase.php:205
ApiQueryBase\checkRowCount
checkRowCount()
Estimate the row count for the SELECT query that would be run if we called select() right now,...
Definition: ApiQueryBase.php:312
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:422
$title
presenting them properly to the user as errors is done by the caller $title
Definition: hooks.txt:1324
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:336
$value
$value
Definition: styleTest.css.php:45
ApiBase\encodeParamName
encodeParamName( $paramName)
This method mangles parameter name based on the prefix supplied to the constructor.
Definition: ApiBase.php:674
ApiBase\dieUsage
dieUsage( $description, $errorCode, $httpRespCode=0, $extradata=null)
Throw a UsageException, which will (if uncaught) call the main module's error handler and die with an...
Definition: ApiBase.php:1363
options
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing options(say) and put it in one place. Instead of having little title-reversing if-blocks spread all over the codebase in showAnArticle
Title\newFromDBkey
static newFromDBkey( $key)
Create a new Title from a prefixed DB key.
Definition: Title.php:152
ApiQueryBase\requestExtraData
requestExtraData( $pageSet)
Override this method to request extra fields from the pageSet using $pageSet->requestField('fieldName...
Definition: ApiQueryBase.php:349
ApiQueryBase\addJoinConds
addJoinConds( $join_conds)
Add a set of JOIN conditions to the internal array.
Definition: ApiQueryBase.php:106
ApiQueryBase\titlePartToKey
titlePartToKey( $titlePart, $defaultNamespace=NS_MAIN)
An alternative to titleToKey() that doesn't trim trailing spaces, and does not mangle the input if st...
Definition: ApiQueryBase.php:491
ApiQueryBase\addWhereFld
addWhereFld( $field, $value)
Equivalent to addWhere(array($field => $value))
Definition: ApiQueryBase.php:185
ApiQueryBase\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.
Definition: ApiQueryBase.php:61
ApiQueryBase\getPageSet
getPageSet()
Get the PageSet object to work on.
Definition: ApiQueryBase.php:441
$hash
return false to override stock group addition can be modified try getUserPermissionsErrors userCan checks are continued by internal code can override on output return false to not delete it return false to override the default password checks & $hash
Definition: hooks.txt:2702
ApiQueryGeneratorBase
Definition: ApiQueryBase.php:626
ApiResult\ADD_ON_TOP
const ADD_ON_TOP
For addValue() and setElement(), if the value does not exist, add it as the first element.
Definition: ApiResult.php:57
ApiQueryBase\selectNamedDB
selectNamedDB( $name, $db, $groups)
Selects the query database connection with the given name.
Definition: ApiQueryBase.php:433
ApiQueryBase\$join_conds
$join_conds
Definition: ApiQueryBase.php:36
$dir
if(count( $args)==0) $dir
Definition: importImages.php:49
ApiQueryBase\$tables
$tables
Definition: ApiQueryBase.php:36
ApiBase\getModuleName
getModuleName()
Get the name of the module being executed by this instance.
Definition: ApiBase.php:148
ApiQueryBase\$mQueryModule
$mQueryModule
Definition: ApiQueryBase.php:36
ApiQueryBase\addWhere
addWhere( $value)
Add a set of WHERE clauses to the internal array.
Definition: ApiQueryBase.php:152
$t
$t
Definition: testCompression.php:65
ApiQueryBase\setContinueEnumParameter
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
Definition: ApiQueryBase.php:404
$query
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1105
ApiQueryBase\prepareUrlQuerySearchString
prepareUrlQuerySearchString( $query=null, $protocol=null)
Definition: ApiQueryBase.php:537
ApiQueryBase\keyPartToTitle
keyPartToTitle( $keyPart)
An alternative to keyToTitle() that doesn't trim trailing spaces.
Definition: ApiQueryBase.php:513
ApiQueryBase\userCanSeeRevDel
userCanSeeRevDel()
Check whether the current user has permission to view revision-deleted fields.
Definition: ApiQueryBase.php:618
$res
$res
Definition: database.txt:21
ApiQueryBase\addPageSubItem
addPageSubItem( $pageId, $item, $elemname=null)
Same as addPageSubItems(), but one element of $data at a time.
Definition: ApiQueryBase.php:383
ApiBase\dieDebug
static dieDebug( $method, $message)
Internal code errors should be reported with this method.
Definition: ApiBase.php:2010
ApiQueryBase\getPossibleErrors
getPossibleErrors()
Definition: ApiQueryBase.php:603
ApiQueryBase\addWhereIf
addWhereIf( $value, $condition)
Same as addWhere(), but add the WHERE clauses only if a condition is met.
Definition: ApiQueryBase.php:170
ApiQueryBase\addTitleInfo
static addTitleInfo(&$arr, $title, $prefix='')
Add information (title and namespace) about a Title object to a result array.
Definition: ApiQueryBase.php:339
ApiQueryBase\validateSha1Hash
validateSha1Hash( $hash)
Definition: ApiQueryBase.php:588