56 parent::__construct( $params );
58 $this->lagDetectionMethod = isset( $params[
'lagDetectionMethod'] )
59 ? $params[
'lagDetectionMethod']
60 :
'Seconds_Behind_Master';
61 $this->lagDetectionOptions = isset( $params[
'lagDetectionOptions'] )
62 ? $params[
'lagDetectionOptions']
81 function open( $server,
$user, $password, $dbName ) {
84 # Close/unset connection handle
87 # Debugging hack -- fake cluster
88 $realServer = $wgAllDBsAreLocalhost ?
'localhost' : $server;
89 $this->mServer = $server;
91 $this->mPassword = $password;
92 $this->mDBname = $dbName;
103 # Always log connection errors
104 if ( !$this->mConn ) {
109 "Error connecting to {db_server}: {error}",
111 'method' => __METHOD__,
115 wfDebug(
"DB connection error\n" .
116 "Server: $server, User: $user, Password: " .
117 substr( $password, 0, 3 ) .
"..., error: " . $error .
"\n" );
122 if ( $dbName !=
'' ) {
123 MediaWiki\suppressWarnings();
125 MediaWiki\restoreWarnings();
128 "Error selecting database {db_name} on server {db_server}",
130 'method' => __METHOD__,
133 wfDebug(
"Error selecting database $dbName on server {$this->mServer} " .
146 $set = [
'group_concat_max_len = 262144' ];
148 if ( is_string( $wgSQLMode ) ) {
149 $set[] =
'sql_mode = ' . $this->
addQuotes( $wgSQLMode );
153 foreach ( $this->mSessionVars
as $var => $val ) {
155 if ( !is_int( $val ) && !is_float( $val ) ) {
166 'Error setting MySQL variables on server {db_server} (check $wgSQLMode)',
168 'method' => __METHOD__,
172 'Error setting MySQL variables on server {db_server} (check $wgSQLMode)' );
176 $this->mOpened =
true;
204 abstract protected function mysqlConnect( $realServer );
222 MediaWiki\suppressWarnings();
224 MediaWiki\restoreWarnings();
247 MediaWiki\suppressWarnings();
249 MediaWiki\restoreWarnings();
256 if ( $errno == 2000 || $errno == 2013 ) {
259 'Error in fetchObject(): ' . htmlspecialchars( $this->
lastError() )
283 MediaWiki\suppressWarnings();
285 MediaWiki\restoreWarnings();
292 if ( $errno == 2000 || $errno == 2013 ) {
295 'Error in fetchRow(): ' . htmlspecialchars( $this->
lastError() )
319 MediaWiki\suppressWarnings();
321 MediaWiki\restoreWarnings();
430 if ( $this->mConn ) {
431 # Even if it's non-zero, it can still be invalid
432 MediaWiki\suppressWarnings();
437 MediaWiki\restoreWarnings();
442 $error .=
' (' . $this->mServer .
')';
454 abstract protected function mysqlError( $conn = null );
484 if (
$res ===
false ) {
492 foreach (
$res as $plan ) {
493 $rows *= $plan->rows > 0 ? $plan->rows : 1;
506 $res = $this->
query(
"SELECT * FROM $table LIMIT 1", __METHOD__,
true );
511 for ( $i = 0; $i < $n; $i++ ) {
513 if ( $field == $meta->name ) {
540 # SHOW INDEX works in MySQL 3.23.58, but SHOW INDEXES does not.
541 # SHOW INDEX should work for 3.x and up:
542 # http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html
546 $sql =
'SHOW INDEX FROM ' . $table;
555 foreach (
$res as $row ) {
556 if ( $row->Key_name == $index ) {
571 if ( $sQuoted ===
false ) {
594 return '`' . str_replace( [
"\0",
'`' ], [
'',
'``' ],
$s ) .
'`';
602 return strlen(
$name ) &&
$name[0] ==
'`' && substr(
$name, -1, 1 ) ==
'`';
618 $this->mOpened =
false;
619 $this->mConn =
false;
620 $this->
open( $this->mServer, $this->mUser, $this->mPassword, $this->mDBname );
651 $res = $this->
query(
'SHOW SLAVE STATUS', __METHOD__ );
652 $row =
$res ?
$res->fetchObject() :
false;
653 if ( $row && strval( $row->Seconds_Behind_Master ) !==
'' ) {
654 return intval( $row->Seconds_Behind_Master );
672 if ( !$masterInfo ) {
674 "Unable to query master of {db_server} for server ID",
676 'method' => __METHOD__
683 $conds = [
'server_id' => intval( $masterInfo[
'serverId'] ) ];
688 if (
$time !== null ) {
691 $timeUnix = (int)$dateTime->format(
'U' ) + $dateTime->format(
'u' ) / 1e6;
693 return max( $nowUnix - $timeUnix, 0.0 );
697 "Unable to find pt-heartbeat row for {db_server}",
699 'method' => __METHOD__
715 return $cache->getWithSetCallback(
717 $cache::TTL_INDEFINITE,
731 $res = $conn->query(
'SELECT @@server_id AS id', __METHOD__ );
732 $row =
$res ?
$res->fetchObject() :
false;
733 $id = $row ? (int)$row->id : 0;
739 return $id ? [
'serverId' => $id,
'asOf' => time() ] :
false;
755 "SELECT ts FROM heartbeat.heartbeat WHERE $whereSQL ORDER BY ts DESC LIMIT 1"
757 $row =
$res ?
$res->fetchObject() :
false;
759 return [ $row ? $row->ts : null, microtime(
true ) ];
767 return parent::getApproximateLagStatus();
770 $key = $this->srvCache->makeGlobalKey(
'mysql-lag', $this->
getServer() );
771 $approxLag = $this->srvCache->get(
$key );
773 $approxLag = parent::getApproximateLagStatus();
774 $this->srvCache->set(
$key, $approxLag, 1 );
785 if ( $this->lastKnownSlavePos && $this->lastKnownSlavePos->hasReached( $pos ) ) {
789 # Commit any open transactions
790 $this->
commit( __METHOD__,
'flush' );
792 # Call doQuery() directly, to avoid opening a transaction if DBO_TRX is set
793 $encFile = $this->
addQuotes( $pos->file );
794 $encPos = intval( $pos->pos );
795 $res = $this->
doQuery(
"SELECT MASTER_POS_WAIT($encFile, $encPos, $timeout)" );
799 throw new DBExpectedError( $this,
"Failed to query MASTER_POS_WAIT()" );
803 $status = ( $row[0] !== null ) ? intval( $row[0] ) : null;
810 if ( $slavePos && !$slavePos->channelsMatch( $pos ) ) {
811 $this->lastKnownSlavePos = $slavePos;
816 $this->lastKnownSlavePos = $pos;
828 $res = $this->
query(
'SHOW SLAVE STATUS',
'DatabaseBase::getSlavePos' );
832 $pos = isset( $row->Exec_master_log_pos )
833 ? $row->Exec_master_log_pos
834 : $row->Exec_Master_Log_Pos;
848 $res = $this->
query(
'SHOW MASTER STATUS',
'DatabaseBase::getMasterPos' );
863 return "FORCE INDEX (" . $this->
indexName( $index ) .
")";
870 return 'LOW_PRIORITY';
881 if ( strpos(
$version,
'MariaDB' ) !==
false || strpos(
$version,
'-maria-' ) !==
false ) {
882 return '[{{int:version-db-mariadb-url}} MariaDB]';
888 return '[{{int:version-db-mysql-url}} MySQL]';
898 if ( $this->serverVersion === null ) {
899 $this->serverVersion = $this->
selectField(
'',
'VERSION()',
'', __METHOD__ );
908 if ( isset( $options[
'connTimeout'] ) ) {
909 $timeout = (int)$options[
'connTimeout'];
910 $this->
query(
"SET net_read_timeout=$timeout" );
911 $this->
query(
"SET net_write_timeout=$timeout" );
921 if ( strtoupper( substr( $newLine, 0, 9 ) ) ==
'DELIMITER' ) {
922 preg_match(
'/^DELIMITER\s+(\S+)/', $newLine, $m );
923 $this->delimiter = $m[1];
927 return parent::streamStatementEnd( $sql, $newLine );
940 $result = $this->
query(
"SELECT IS_FREE_LOCK($lockName) AS lockstatus", $method );
943 return ( $row->lockstatus == 1 );
952 public function lock( $lockName, $method, $timeout = 5 ) {
954 $result = $this->
query(
"SELECT GET_LOCK($lockName, $timeout) AS lockstatus", $method );
957 if ( $row->lockstatus == 1 ) {
958 parent::lock( $lockName, $method, $timeout );
962 wfDebug( __METHOD__ .
" failed to acquire lock\n" );
974 public function unlock( $lockName, $method ) {
976 $result = $this->
query(
"SELECT RELEASE_LOCK($lockName) as lockstatus", $method );
979 if ( $row->lockstatus == 1 ) {
980 parent::unlock( $lockName, $method );
984 wfDebug( __METHOD__ .
" failed to release lock\n" );
992 return ( strlen( $lockName ) > 64 ) ? sha1( $lockName ) : $lockName;
1006 public function lockTables( $read, $write, $method, $lowPriority =
true ) {
1009 foreach ( $write
as $table ) {
1011 ( $lowPriority ?
' LOW_PRIORITY' :
'' ) .
1015 foreach ( $read
as $table ) {
1016 $items[] = $this->
tableName( $table ) .
' READ';
1018 $sql =
"LOCK TABLES " . implode(
',', $items );
1019 $this->
query( $sql, $method );
1029 $this->
query(
"UNLOCK TABLES", $method );
1041 return 'SearchMySQL';
1048 if (
$value ===
'default' ) {
1049 if ( $this->mDefaultBigSelects === null ) {
1050 # Function hasn't been called before so it must already be set to the default
1055 } elseif ( $this->mDefaultBigSelects === null ) {
1056 $this->mDefaultBigSelects =
1057 (bool)$this->
selectField(
false,
'@@sql_big_selects',
'', __METHOD__ );
1059 $encValue =
$value ?
'1' :
'0';
1060 $this->
query(
"SET sql_big_selects=$encValue", __METHOD__ );
1076 throw new DBUnexpectedError( $this,
'DatabaseBase::deleteJoin() called with empty $conds' );
1079 $delTable = $this->
tableName( $delTable );
1080 $joinTable = $this->
tableName( $joinTable );
1081 $sql =
"DELETE $delTable FROM $delTable, $joinTable WHERE $delVar=$joinVar ";
1083 if ( $conds !=
'*' ) {
1101 if ( !count( $rows ) ) {
1105 if ( !is_array( reset( $rows ) ) ) {
1110 $columns = array_keys( $rows[0] );
1112 $sql =
"INSERT INTO $table (" . implode(
',', $columns ) .
') VALUES ';
1114 foreach ( $rows
as $row ) {
1115 $rowTuples[] =
'(' . $this->
makeList( $row ) .
')';
1117 $sql .= implode(
',', $rowTuples );
1131 return (
int)
$vars[
'Uptime'];
1173 return $errno == 2013 || $errno == 2006;
1188 if ( !$this->mConn ) {
1191 'DB connection was already closed or the connection dropped.'
1206 $tmp = $temporary ?
'TEMPORARY ' :
'';
1209 $query =
"CREATE $tmp TABLE $newName (LIKE $oldName)";
1227 $vars = get_object_vars( $table );
1228 $table = array_pop(
$vars );
1230 if ( !$prefix || strpos( $table, $prefix ) === 0 ) {
1231 $endArray[] = $table;
1243 public function dropTable( $tableName, $fName = __METHOD__ ) {
1244 if ( !$this->
tableExists( $tableName, $fName ) ) {
1248 return $this->
query(
"DROP TABLE IF EXISTS " . $this->
tableName( $tableName ), $fName );
1255 $vars = parent::getDefaultSchemaVars();
1256 $vars[
'wgDBTableOptions'] = str_replace(
'TYPE',
'ENGINE',
$GLOBALS[
'wgDBTableOptions'] );
1257 $vars[
'wgDBTableOptions'] = str_replace(
1260 $vars[
'wgDBTableOptions']
1273 $res = $this->
query(
"SHOW STATUS LIKE '{$which}'" );
1276 foreach (
$res as $row ) {
1277 $status[$row->Variable_name] = $row->Value;
1294 if ( !isset( $this->allViews ) ) {
1300 $result = $this->
query(
'SHOW FULL TABLES WHERE TABLE_TYPE = "VIEW"' );
1301 $this->allViews = [];
1303 array_push( $this->allViews, $row[$propertyName] );
1307 if ( is_null( $prefix ) || $prefix ===
'' ) {
1311 $filteredViews = [];
1312 foreach ( $this->allViews
as $viewName ) {
1314 if ( strpos( $viewName, $prefix ) === 0 ) {
1315 array_push( $filteredViews, $viewName );
1319 return $filteredViews;
1345 $this->
name = $info->name;
1346 $this->tablename = $info->table;
1347 $this->
default = $info->def;
1348 $this->max_length = $info->max_length;
1349 $this->nullable = !$info->not_null;
1350 $this->is_pk = $info->primary_key;
1351 $this->is_unique = $info->unique_key;
1352 $this->is_multiple = $info->multiple_key;
1354 $this->
type = $info->type;
1355 $this->binary = isset( $info->binary ) ? $info->binary :
false;
1356 $this->is_numeric = isset( $info->numeric ) ? $info->numeric :
false;
1357 $this->is_blob = isset( $info->blob ) ? $info->blob :
false;
1358 $this->is_unsigned = isset( $info->unsigned ) ? $info->unsigned :
false;
1359 $this->is_zerofill = isset( $info->zerofill ) ? $info->zerofill :
false;
1455 $this->
asOfTime = microtime(
true );
1463 if ( !( $pos instanceof
self ) ) {
1468 $thatPos = $pos->getCoordinates();
1470 return ( $thisPos && $thatPos && $thisPos >= $thatPos );
1474 if ( !( $pos instanceof
self ) ) {
1479 $thatBinlog = $pos->getBinlogName();
1481 return ( $thisBinlog !==
false && $thisBinlog === $thatBinlog );
1486 return "{$this->file}/{$this->pos}";
1494 if ( preg_match(
'!^(.+)\.(\d+)/(\d+)$!', (
string)$this, $m ) ) {
1506 if ( preg_match(
'!\.(\d+)/(\d+)$!', (
string)$this, $m ) ) {
1507 return [ (int)$m[1], (
int)$m[2] ];
select($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
Execute a SELECT query constructed using the various parameters provided.
lockTables($read, $write, $method, $lowPriority=true)
indexName($index)
Get the name of an index in a given table.
mysqlFieldType($res, $n)
Get the type of the specified field in a result.
mysqlDataSeek($res, $row)
Move internal result pointer.
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
getServerUptime()
Determines how long the server has been up.
getMasterPos()
Get the position of the master from SHOW MASTER STATUS.
Database error base class.
the array() calling protocol came about after MediaWiki 1.4rc1.
namedLocksEnqueue()
Check to see if a named lock used by lock() use blocking queues.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
masterPosWait(DBMasterPos $pos, $timeout)
Wait for the slave to catch up to a given master position.
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
fieldType($res, $n)
mysql_field_type() wrapper
streamStatementEnd(&$sql, &$newLine)
mysqlConnect($realServer)
Open a connection to a MySQL server.
tableName($name, $format= 'quoted')
Format a table name ready for use in constructing an SQL query.
array $lagDetectionOptions
Method to detect slave lag.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
addIdentifierQuotes($s)
MySQL uses backticks for identifier quoting instead of the sql standard "double quotes".
wasLockTimeout()
Determines if the last failure was due to a lock timeout.
string $lagDetectionMethod
Method to detect slave lag.
wfHostname()
Fetch server name for use in error reporting etc.
processing should stop and the error should be shown to the user * false
resource $mConn
Database connection.
unlock($lockName, $method)
FROM MYSQL DOCS: http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#function_release...
wfLogDBError($text, array $context=[])
Log for database errors.
isView($name, $prefix=null)
Differentiates between a TABLE and a VIEW.
upsert($table, array $rows, array $uniqueIndexes, array $set, $fname=__METHOD__)
makeList($a, $mode=LIST_COMMA)
Makes an encoded list of strings from an array.
getMysqlStatus($which="%")
Get status information from SHOW STATUS in an associative array.
mysqlRealEscapeString($s)
Base for all database-specific classes representing information about database fields.
connectInitCharset()
Set the character set information right after connection.
mysqlFetchArray($res)
Fetch a result row as an associative and numeric array.
An object representing a master or slave position in a replicated setup.
mysqlFetchObject($res)
Fetch a result row as an object.
when a variable name is used in a it is silently declared as a new local masking the global
replace($table, $uniqueIndexes, $rows, $fname=__METHOD__)
doQuery($sql)
The DBMS-dependent part of query()
channelsMatch(DBMasterPos $pos)
lock($lockName, $method, $timeout=5)
lastErrno()
Get the last error number.
see documentation in includes Linker php for Linker::makeImageLink & $time
hasReached(DBMasterPos $pos)
close()
Closes a database connection.
wasConnectionError($errno)
wfDebug($text, $dest= 'all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
dropTable($tableName, $fName=__METHOD__)
listViews($prefix=null, $fname=__METHOD__)
Lists VIEWs in the database.
We ve cleaned up the code here by removing clumps of infrequently used code and moving them off somewhere else It s much easier for someone working with this code to see what s _really_ going and make changes or fix bugs In we can take all the code that deals with the little used title reversing we can concentrate it all in an extension file
tableExists($table, $fname=__METHOD__)
Query whether a given table exists.
Base class for the more common types of database errors.
deleteJoin($delTable, $joinTable, $delVar, $joinVar, $conds, $fname=__METHOD__)
DELETE where the condition is a join.
listTables($prefix=null, $fname=__METHOD__)
List all tables on the database.
setSessionOptions(array $options)
getSlavePos()
Get the position of the master from SHOW SLAVE STATUS.
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
getHeartbeatData(array $conds)
mysqlError($conn=null)
Returns the text of the error message from previous MySQL operation.
mysqlPing()
Ping a server connection or reconnect if there is no connection.
getApproximateLagStatus()
duplicateTableStructure($oldName, $newName, $temporary=false, $fname=__METHOD__)
__construct(array $params)
Additional $params include:
addQuotes($s)
Adds quotes and backslashes.
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 as
mysqlNumRows($res)
Get number of rows in result.
mysqlSetCharset($charset)
Set the character set of the MySQL link.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
selectDB($db)
Change the current database.
indexInfo($table, $index, $fname=__METHOD__)
Get information about an index into an object Returns false if the index does not exist...
mysqlNumFields($res)
Get number of fields in result.
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
wasReadOnlyError()
Determines if the last failure was due to the database being read-only.
closeConnection()
Closes underlying database connection.
setBigSelects($value=true)
selectField($table, $var, $cond= '', $fname=__METHOD__, $options=[])
A SELECT wrapper which returns a single field from a single result row.
string null $serverVersion
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
wasDeadlock()
Determines if the last failure was due to a deadlock.
$wgAllDBsAreLocalhost
Make all database connections secretly go to localhost.
Database abstraction object for MySQL.
MysqlMasterPos $lastKnownSlavePos
mysqlFieldName($res, $n)
Get the name of the specified field in a result.
getServer()
Get the server hostname or IP address.
getSearchEngine()
Get search engine class.
estimateRowCount($table, $vars= '*', $conds= '', $fname=__METHOD__, $options=[])
Estimate rows in dataset Returns estimated count, based on EXPLAIN output Takes same arguments as Dat...
query($sql, $fname=__METHOD__, $tempIgnore=false)
Run an SQL query and return the result.
wasErrorReissuable()
Determines if the last query error was something that should be dealt with by pinging the connection ...
commit($fname=__METHOD__, $flush= '')
Commits a transaction previously started using begin().
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 $status
float $asOfTime
UNIX timestamp.
lockIsFree($lockName, $method)
Check to see if a named lock is available.
getLBInfo($name=null)
Get properties passed down from the server info array of the load balancer.
Result wrapper for grabbing data queried by someone else.
getLogContext(array $extras=[])
Create a log context to pass to wfLogDBError or other logging functions.
BagOStuff $srvCache
APC cache.
mysqlFreeResult($res)
Free result memory.
nativeReplace($table, $rows, $fname)
REPLACE query wrapper for MySQL and SQLite, which have a native REPLACE statement.
isQuotedIdentifier($name)
$wgSQLMode
SQL Mode - default is turning off all modes, including strict, if set.
getBindingHandle()
Get the underlying binding handle, mConn.
fieldInfo($table, $field)
reportConnectionError($error= 'Unknown error')
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
mysqlFetchField($res, $n)
Get column information from a result.
$wgDBmysql5
Set to true to engage MySQL 4.1/5.0 charset-related features; for now will just cause sending of 'SET...
open($server, $user, $password, $dbName)
Allows to change the fields on the form that will be generated $name