MediaWiki REL1_27
DatabaseUpdaterTest.php
Go to the documentation of this file.
1<?php
2
4
5 public function testSetAppliedUpdates() {
6 $db = new FakeDatabase();
7 $dbu = new FakeDatabaseUpdater( $db );
8 $dbu->setAppliedUpdates( "test", [] );
9 $actual = $db->lastInsertData['ul_key'];
10 $this->assertStringMatchesFormat( 'updatelist-test-%d.%d0',
11 $actual, var_export( $db->lastInsertData, true ) );
12 $dbu->setAppliedUpdates( "test", [] );
13 $actual = $db->lastInsertData['ul_key'];
14 $this->assertStringMatchesFormat( 'updatelist-test-%d.%d1',
15 $actual, var_export( $db->lastInsertData, true ) );
16 }
17}
18
22
23 function __construct() {
24 }
25
26 function clearFlag( $arg ) {
27 }
28
29 function setFlag( $arg ) {
30 }
31
32 public function insert( $table, $a, $fname = __METHOD__, $options = [] ) {
33 $this->lastInsertTable = $table;
34 $this->lastInsertData = $a;
35 }
36
42 function getType() {
43 // TODO: Implement getType() method.
44 }
45
56 function open( $server, $user, $password, $dbName ) {
57 // TODO: Implement open() method.
58 }
59
70 function fetchObject( $res ) {
71 // TODO: Implement fetchObject() method.
72 }
73
83 function fetchRow( $res ) {
84 // TODO: Implement fetchRow() method.
85 }
86
93 function numRows( $res ) {
94 // TODO: Implement numRows() method.
95 }
96
104 function numFields( $res ) {
105 // TODO: Implement numFields() method.
106 }
107
116 function fieldName( $res, $n ) {
117 // TODO: Implement fieldName() method.
118 }
119
132 function insertId() {
133 // TODO: Implement insertId() method.
134 }
135
143 function dataSeek( $res, $row ) {
144 // TODO: Implement dataSeek() method.
145 }
146
153 function lastErrno() {
154 // TODO: Implement lastErrno() method.
155 }
156
163 function lastError() {
164 // TODO: Implement lastError() method.
165 }
166
176 function fieldInfo( $table, $field ) {
177 // TODO: Implement fieldInfo() method.
178 }
179
187 function indexInfo( $table, $index, $fname = __METHOD__ ) {
188 // TODO: Implement indexInfo() method.
189 }
190
197 function affectedRows() {
198 // TODO: Implement affectedRows() method.
199 }
200
207 function strencode( $s ) {
208 // TODO: Implement strencode() method.
209 }
210
219 function getSoftwareLink() {
220 // TODO: Implement getSoftwareLink() method.
221 }
222
229 function getServerVersion() {
230 // TODO: Implement getServerVersion() method.
231 }
232
238 protected function closeConnection() {
239 // TODO: Implement closeConnection() method.
240 }
241
249 protected function doQuery( $sql ) {
250 // TODO: Implement doQuery() method.
251 }
252}
253
255 function __construct( $db ) {
256 $this->db = $db;
257 self::$updateCounter = 0;
258 }
259
268 protected function getCoreUpdateList() {
269 return [];
270 }
271
272 public function canUseNewUpdatelog() {
273 return true;
274 }
275
276 public function setAppliedUpdates( $version, $updates = [] ) {
277 parent::setAppliedUpdates( $version, $updates );
278 }
279}
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
Definition Setup.php:35
Database abstraction object.
Definition Database.php:32
Class for handling database updates.
array $updates
Array of updates to perform on the database.
DatabaseBase $db
Handle to the database subclass.
getCoreUpdateList()
Get an array of updates to perform on the database.
canUseNewUpdatelog()
Updatelog was changed in 1.17 to have a ul_value column so we can record more information about what ...
setAppliedUpdates( $version, $updates=[])
strencode( $s)
Wrapper for addslashes()
indexInfo( $table, $index, $fname=__METHOD__)
Get information about an index into an object.
fetchObject( $res)
Fetch the next row from the given result object, in object form.
doQuery( $sql)
The DBMS-dependent part of query()
affectedRows()
Get the number of rows affected by the last write query.
clearFlag( $arg)
Clear a flag for this connection.
lastError()
Get a description of the last error.
numFields( $res)
Get the number of fields in a result object.
insertId()
Get the inserted value of an auto-increment row.
fieldInfo( $table, $field)
mysql_fetch_field() wrapper Returns false if the field doesn't exist
getType()
Get the type of the DBMS, as it appears in $wgDBtype.
open( $server, $user, $password, $dbName)
Open a connection to the database.
closeConnection()
Closes underlying database connection.
setFlag( $arg)
Set a flag for this connection.
fieldName( $res, $n)
Get a field name in a result object.
dataSeek( $res, $row)
Change the position of the cursor in a result object.
fetchRow( $res)
Fetch the next row from the given result object, in associative array form.
getSoftwareLink()
Returns a wikitext link to the DB's website, e.g., return "[http://www.mysql.com/ MySQL]"; Should at ...
getServerVersion()
A string describing the current software version, like from mysql_get_server_info().
numRows( $res)
Get the number of rows in a result object.
lastErrno()
Get the last error number.
insert( $table, $a, $fname=__METHOD__, $options=[])
INSERT wrapper, inserts an array into a table.
DatabaseBase $db
Primary database.
$res
Definition database.txt:21
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition hooks.txt:1042
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
$version