108 $this->assertEquals( $expected, $quoted );
134 [
"`'`",
"'" ], # single quote
135 [
'`"`',
'"' ], #
double quote
136 [
'````',
'`' ], # backtick
137 [
'`’`',
'’' ], # apostrophe (look at your encyclopedia)
141 [
'`xyzzy`',
"\0x\0y\0z\0z\0y\0" ],
145 self::createUnicodeString(
'`\u0001a\uFFFFb`' ),
146 self::createUnicodeString(
'\u0001a\uFFFFb' )
149 self::createUnicodeString(
'`\u0001\uFFFF`' ),
150 self::createUnicodeString(
'\u0001\u0000\uFFFF\u0000' )
153 [
'`メインページ`',
'メインページ' ],
154 [
'`Басты_бет`',
'Басты_бет' ],
157 [
'`Alix`',
'Alix' ], #
while( ! $recovered ) { sleep(); }
158 [
'`Backtick: ```',
'Backtick: `' ],
159 [
'`This is a test`',
'This is a test' ],
164 return json_decode(
'"' . $str .
'"' );
168 $db = $this->getMockBuilder(
'DatabaseMysql' )
169 ->disableOriginalConstructor()
170 ->setMethods( [
'fetchRow',
'query' ] )
173 $db->expects( $this->any() )
177 $this->returnValue( null )
180 $db->expects( $this->any() )
181 ->method(
'fetchRow' )
183 ->will( $this->onConsecutiveCalls(
184 [
'Tables_in_' =>
'view1' ],
185 [
'Tables_in_' =>
'view2' ],
186 [
'Tables_in_' =>
'myview' ],
198 $this->assertEquals( [
'view1',
'view2',
'myview' ],
200 $this->assertEquals( [
'view1',
'view2',
'myview' ],
204 $this->assertEquals( [
'view1',
'view2' ],
206 $this->assertEquals( [
'myview' ],
208 $this->assertEquals( [],
210 $this->assertEquals( [
'view1',
'view2',
'myview' ],
223 $this->assertTrue(
$db->
isView( $viewName ),
224 "$viewName should be considered a view" );
228 $this->assertFalse(
$db->
isView( $viewName ),
229 "$viewName has not been defined as a view" );
246 [
false,
'OH_MY_GOD' ], # they killed kenny!
254 $this->assertTrue( $higherPos->
hasReached( $lowerPos ) );
255 $this->assertTrue( $higherPos->
hasReached( $higherPos ) );
256 $this->assertTrue( $lowerPos->
hasReached( $lowerPos ) );
257 $this->assertFalse( $lowerPos->
hasReached( $higherPos ) );
314 $db = $this->getMockBuilder(
'DatabaseMysql' )
315 ->disableOriginalConstructor()
317 'getLagDetectionMethod',
'getHeartbeatData',
'getMasterServerInfo' ] )
320 $db->expects( $this->any() )
321 ->method(
'getLagDetectionMethod' )
322 ->will( $this->returnValue(
'pt-heartbeat' ) );
324 $db->expects( $this->any() )
325 ->method(
'getMasterServerInfo' )
326 ->will( $this->returnValue( [
'serverId' => 172,
'asOf' => time() ] ) );
329 list( $nowSecFrac, $nowSec ) = explode(
' ', microtime() );
330 $now = (float)$nowSec + (
float)$nowSecFrac;
333 $ptTime = $now - $lag;
334 $ptSec = (int)$ptTime;
335 $ptSecFrac = ( $ptTime - $ptSec );
336 $ptDateTime =
new DateTime(
"@$ptSec" );
337 $ptTimeISO = $ptDateTime->format(
'Y-m-d\TH:i:s' );
338 $ptTimeISO .= ltrim( number_format( $ptSecFrac, 6 ),
'0' );
340 $db->expects( $this->any() )
341 ->method(
'getHeartbeatData' )
342 ->with( [
'server_id' => 172 ] )
343 ->will( $this->returnValue( [ $ptTimeISO, $now ] ) );
348 $this->assertGreaterThan( $lag - .010, $lagEst,
"Correct heatbeat lag" );
349 $this->assertLessThan( $lag + .010, $lagEst,
"Correct heatbeat lag" );
testListviews()
DatabaseMysqlBase::listViews.
provideComparePositions()
setLBInfo($name, $value=null)
Set the LB info array, or a member of it.
lastErrno()
Get the last error number.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
provideViewExistanceChecks()
processing should stop and the error should be shown to the user * false
listViews($prefix=null, $fname=__METHOD__)
Lists all the VIEWs in the database.
testAddIdentifierQuotes($expected, $in)
provideDiapers DatabaseMysqlBase::addIdentifierQuotes
testPtHeartbeat($lag)
provideLagAmounts
testHasReached(MySQLMasterPos $lowerPos, MySQLMasterPos $higherPos)
provideComparePositions
testChannelsMatch(MySQLMasterPos $pos1, MySQLMasterPos $pos2, $matches)
provideChannelPositions
mysqlSetCharset($charset)
channelsMatch(DBMasterPos $pos)
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such and we might be restricted by PHP settings such as safe mode or open_basedir We cannot assume that the software even has read access anywhere useful Many shared hosts run all users web applications under the same so they can t rely on Unix and must forbid reads to even standard directories like tmp lest users read each others files We cannot assume that the user has the ability to install or run any programs not written as web accessible PHP scripts Since anything that works on cheap shared hosting will work if you have shell or root access MediaWiki s design is based around catering to the lowest common denominator Although we support higher end setups as the way many things work by default is tailored toward shared hosting These defaults are unconventional from the point of view of and they certainly aren t ideal for someone who s installing MediaWiki as MediaWiki does not conform to normal Unix filesystem layout Hopefully we ll offer direct support for standard layouts in the but for now *any change to the location of files is unsupported *Moving things and leaving symlinks will *probably *not break anything
hasReached(DBMasterPos $pos)
mysqlRealEscapeString($s)
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
provideDiapers()
Feeds testAddIdentifierQuotes.
mysqlConnect($realServer)
insertId()
Get the inserted value of an auto-increment row.
Fake class around abstract class so we can call concrete methods.
getServerVersion()
A string describing the current software version, like from mysql_get_server_info().
addIdentifierQuotes($s)
Quotes an identifier using backticks or "double quotes" depending on the database type...
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
Database abstraction object for MySQL.
provideChannelPositions()
static createUnicodeString($str)
testIsView($isView, $viewName)
DatabaseMysqlBase::isView provideViewExistanceChecks.
mysqlDataSeek($res, $row)
isView($name)
Differentiates between a TABLE and a VIEW.
affectedRows()
Get the number of rows affected by the last write query.
mysqlFetchField($res, $n)