43 $ret = mysql_query( $sql, $conn );
45 $ret = mysql_unbuffered_query( $sql, $conn );
57 # Avoid a suppressed fatal error, which is very hard to track down
58 if ( !extension_loaded(
'mysql' ) ) {
61 "MySQL functions missing, have you compiled PHP with the --with-mysql option?\n"
66 if ( $this->mFlags & self::DBO_SSL ) {
67 $connFlags |= MYSQL_CLIENT_SSL;
69 if ( $this->mFlags & self::DBO_COMPRESS ) {
70 $connFlags |= MYSQL_CLIENT_COMPRESS;
73 if ( ini_get(
'mysql.connect_timeout' ) <= 3 ) {
81 # The kernel's default SYN retransmission period is far too slow for us,
82 # so we use a short timeout plus a manual retry. Retrying means that a small
83 # but finite rate of SYN packet loss won't cause user-visible errors.
84 for ( $i = 0; $i < $numAttempts && !$conn; $i++ ) {
88 if ( $this->mFlags & self::DBO_PERSISTENT ) {
89 $conn = mysql_pconnect( $realServer, $this->mUser, $this->mPassword, $connFlags );
91 # Create a new connection...
92 $conn = mysql_connect( $realServer, $this->mUser, $this->mPassword,
true, $connFlags );
106 if ( function_exists(
'mysql_set_charset' ) ) {
107 return mysql_set_charset( $charset, $conn );
109 return $this->
query(
'SET NAMES ' . $charset, __METHOD__ );
119 return mysql_close( $conn );
128 return mysql_insert_id( $conn );
135 if ( $this->mConn ) {
136 return mysql_errno( $this->mConn );
138 return mysql_errno();
148 return mysql_affected_rows( $conn );
158 $this->mDBname = $db;
160 return mysql_select_db( $db, $conn );
164 return mysql_free_result(
$res );
168 return mysql_fetch_object(
$res );
172 return mysql_fetch_array(
$res );
176 return mysql_num_rows(
$res );
180 return mysql_num_fields(
$res );
184 return mysql_fetch_field(
$res, $n );
188 return mysql_field_name(
$res, $n );
192 return mysql_field_type(
$res, $n );
196 return mysql_data_seek(
$res, $row );
200 return ( $conn !==
null ) ? mysql_error( $conn ) : mysql_error();
206 return mysql_real_escape_string( (
string)
$s, $conn );
210class_alias( DatabaseMysql::class,
'DatabaseMysql' );
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