MediaWiki  REL1_31
FakeResultWrapper.php
Go to the documentation of this file.
1 <?php
2 
3 namespace Wikimedia\Rdbms;
4 
5 use stdClass;
6 
17  function __construct( array $rows ) {
18  parent::__construct( null, $rows );
19  }
20 
21  function numRows() {
22  return count( $this->result );
23  }
24 
25  function fetchRow() {
26  if ( $this->pos < count( $this->result ) ) {
27  $this->currentRow = $this->result[$this->pos];
28  } else {
29  $this->currentRow = false;
30  }
31  $this->pos++;
32  if ( is_object( $this->currentRow ) ) {
33  return get_object_vars( $this->currentRow );
34  } else {
35  return $this->currentRow;
36  }
37  }
38 
39  function seek( $row ) {
40  $this->pos = $row;
41  }
42 
43  function free() {
44  }
45 
46  function fetchObject() {
47  $this->fetchRow();
48  if ( $this->currentRow ) {
49  return (object)$this->currentRow;
50  } else {
51  return false;
52  }
53  }
54 
55  function rewind() {
56  $this->pos = 0;
57  $this->currentRow = null;
58  }
59 
60  function next() {
61  return $this->fetchObject();
62  }
63 }
64 
65 class_alias( FakeResultWrapper::class, 'FakeResultWrapper' );
Wikimedia\Rdbms\FakeResultWrapper\seek
seek( $row)
Change the position of the cursor in a result object.
Definition: FakeResultWrapper.php:39
use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Definition: APACHE-LICENSE-2.0.txt:10
$rows
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
Definition: hooks.txt:2783
array
the array() calling protocol came about after MediaWiki 1.4rc1.
Wikimedia\Rdbms
Definition: ChronologyProtector.php:24
Wikimedia\Rdbms\ResultWrapper\$currentRow
stdClass null $currentRow
Definition: ResultWrapper.php:34
Wikimedia\Rdbms\ResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: ResultWrapper.php:24
Wikimedia\Rdbms\FakeResultWrapper\rewind
rewind()
Definition: FakeResultWrapper.php:55
Wikimedia\Rdbms\FakeResultWrapper
Overloads the relevant methods of the real ResultsWrapper so it doesn't go anywhere near an actual da...
Definition: FakeResultWrapper.php:11
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
Wikimedia\Rdbms\FakeResultWrapper\free
free()
Free a result object.
Definition: FakeResultWrapper.php:43
Wikimedia\Rdbms\FakeResultWrapper\__construct
__construct(array $rows)
Definition: FakeResultWrapper.php:17
Wikimedia\Rdbms\ResultWrapper\$pos
int $pos
Definition: ResultWrapper.php:32
Wikimedia\Rdbms\FakeResultWrapper\fetchRow
fetchRow()
Fetch the next row from the given result object, in associative array form.
Definition: FakeResultWrapper.php:25
Wikimedia\Rdbms\FakeResultWrapper\numRows
numRows()
Get the number of rows in a result object.
Definition: FakeResultWrapper.php:21
class
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:56
Wikimedia\Rdbms\FakeResultWrapper\fetchObject
fetchObject()
Fetch the next row from the given result object, in object form.
Definition: FakeResultWrapper.php:46
Wikimedia\Rdbms\FakeResultWrapper\next
next()
Definition: FakeResultWrapper.php:60