48 $ret =
$conn->query( $sql, MYSQLI_USE_RESULT );
60 # Avoid suppressed fatal error, which is very hard to track down
61 if ( !function_exists(
'mysqli_init' ) ) {
63 .
" have you compiled PHP with the --with-mysqli option?\n" );
73 $realServer = $hostAndPort[0];
74 if ( $hostAndPort[1] ) {
75 $port = $hostAndPort[1];
77 } elseif ( substr_count( $realServer,
':' ) == 1 ) {
80 $hostAndSocket = explode(
':', $realServer );
81 $realServer = $hostAndSocket[0];
82 $socket = $hostAndSocket[1];
85 $mysqli = mysqli_init();
88 if ( $this->
flags & self::DBO_SSL ) {
89 $connFlags |= MYSQLI_CLIENT_SSL;
98 if ( $this->
flags & self::DBO_COMPRESS ) {
99 $connFlags |= MYSQLI_CLIENT_COMPRESS;
101 if ( $this->
flags & self::DBO_PERSISTENT ) {
102 $realServer =
'p:' . $realServer;
105 if ( $this->utf8Mode ) {
108 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'utf8' );
110 $mysqli->options( MYSQLI_SET_CHARSET_NAME,
'binary' );
112 $mysqli->options( MYSQLI_OPT_CONNECT_TIMEOUT, 3 );
114 if ( $mysqli->real_connect( $realServer, $this->user,
115 $this->password, $this->dbName, $port, $socket, $connFlags )
135 if ( method_exists(
$conn,
'set_charset' ) ) {
136 return $conn->set_charset( $charset );
138 return $this->
query(
'SET NAMES ' . $charset, __METHOD__ );
148 return $conn->close();
157 return (
int)
$conn->insert_id;
164 if ( $this->conn instanceof mysqli ) {
165 return $this->conn->errno;
167 return mysqli_connect_errno();
177 return $conn->affected_rows;
189 return $conn->select_db( $db );
207 $object =
$res->fetch_object();
208 if ( $object ===
null ) {
220 $array =
$res->fetch_array();
221 if ( $array ===
null ) {
233 return $res->num_rows;
241 return $res->field_count;
250 $field =
$res->fetch_field_direct( $n );
254 $field->not_null = $field->flags & MYSQLI_NOT_NULL_FLAG;
255 $field->primary_key = $field->flags & MYSQLI_PRI_KEY_FLAG;
256 $field->unique_key = $field->flags & MYSQLI_UNIQUE_KEY_FLAG;
257 $field->multiple_key = $field->flags & MYSQLI_MULTIPLE_KEY_FLAG;
258 $field->binary = $field->flags & MYSQLI_BINARY_FLAG;
259 $field->numeric = $field->flags & MYSQLI_NUM_FLAG;
260 $field->blob = $field->flags & MYSQLI_BLOB_FLAG;
261 $field->unsigned = $field->flags & MYSQLI_UNSIGNED_FLAG;
262 $field->zerofill = $field->flags & MYSQLI_ZEROFILL_FLAG;
273 $field =
$res->fetch_field_direct( $n );
284 $field =
$res->fetch_field_direct( $n );
295 return $res->data_seek( $row );
303 if (
$conn ===
null ) {
304 return mysqli_connect_error();
318 return $conn->real_escape_string( (
string)
$s );
328 if ( $this->conn instanceof mysqli ) {
329 return (
string)$this->conn->thread_id;
340 return parent::getBindingHandle();
344class_alias( DatabaseMysqli::class,
'DatabaseMysqli' );
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
A collection of public static functions to play with IP address and IP ranges.
static splitHostAndPort( $both)
Given a host/port string, like one might find in the host part of a URL per RFC 2732,...
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain database etc For and for historical it also represents a few features of articles that don t involve their such as access rights See also title txt Article Encapsulates access to the page table of the database The object represents a an and maintains state such as flags
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 & $ret
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