Go to the documentation of this file.
74 $this->serverPort =
$params[
'port'];
75 $this->useWindowsAuth =
$params[
'UseWindowsAuth'];
81 # Test for driver support, to avoid suppressed fatal error
82 if ( !function_exists(
'sqlsrv_connect' ) ) {
85 "Microsoft SQL Server Native (sqlsrv) functions missing.
86 You can download the driver from: http://go.microsoft.com/fwlink/?LinkId=123470\n"
90 # e.g. the class is being loaded
91 if ( !strlen(
$user ) ) {
100 $connectionInfo = [];
102 if ( $dbName !=
'' ) {
103 $connectionInfo[
'Database'] = $dbName;
108 if ( !$this->useWindowsAuth ) {
109 $connectionInfo[
'UID'] =
$user;
113 Wikimedia\suppressWarnings();
114 $this->conn = sqlsrv_connect(
$server, $connectionInfo );
115 Wikimedia\restoreWarnings();
117 if ( $this->conn ===
false ) {
121 $this->opened =
true;
123 ( $dbName !=
'' ) ? $dbName :
null,
137 return sqlsrv_close( $this->conn );
149 } elseif (
$result ===
true ) {
168 if ( preg_match(
'/\bLIMIT\s*/i', $sql ) ) {
174 if ( preg_match(
'#\bEXTRACT\s*?\(\s*?EPOCH\s+FROM\b#i', $sql,
$matches ) ) {
176 $sql = str_replace(
$matches[0],
"DATEDIFF(s,CONVERT(datetime,'1/1/1970'),", $sql );
186 $scrollArr = [
'Scrollable' => SQLSRV_CURSOR_STATIC ];
193 $stmt = sqlsrv_prepare( $this->conn, $sql, [], $scrollArr );
196 $stmt = sqlsrv_query( $this->conn, $sql, [], $scrollArr );
203 if ( $this->ignoreDupKeyErrors ) {
212 $errors = sqlsrv_errors();
215 foreach ( $errors
as $err ) {
227 $this->lastAffectedRowCount = sqlsrv_rows_affected( $stmt );
237 sqlsrv_free_stmt(
$res );
246 return $res->fetchObject();
254 return $res->fetchRow();
268 if (
$ret ===
false ) {
271 $ret = (int)sqlsrv_has_rows(
$res );
286 return sqlsrv_num_fields(
$res );
299 return sqlsrv_field_metadata(
$res )[$n][
'Name'];
316 return $res->seek( $row );
324 $retErrors = sqlsrv_errors( SQLSRV_ERR_ALL );
325 if ( $retErrors !=
null ) {
326 foreach ( $retErrors
as $arrError ) {
330 $strRet =
"No errors found";
341 return '[SQLSTATE ' .
342 $err[
'SQLSTATE'] .
'][Error Code ' . $err[
'code'] .
']' . $err[
'message'];
349 $err = sqlsrv_errors( SQLSRV_ERR_ALL );
350 if ( $err !==
null && isset( $err[0] ) ) {
351 return $err[0][
'code'];
358 $errors = sqlsrv_errors( SQLSRV_ERR_ALL );
365 $statementOnly =
false;
366 $codeWhitelist = [
'2601',
'2627',
'547' ];
367 foreach ( $errors
as $error ) {
368 if ( $error[
'code'] ==
'3621' ) {
369 $statementOnly =
true;
370 } elseif ( !in_array( $error[
'code'], $codeWhitelist ) ) {
371 $statementOnly =
false;
376 return $statementOnly;
408 if ( isset(
$options[
'EXPLAIN'] ) ) {
412 $this->
query(
"SET SHOWPLAN_ALL ON" );
414 $this->
query(
"SET SHOWPLAN_ALL OFF" );
416 if ( isset(
$options[
'FOR COUNT'] ) ) {
418 $this->
query(
"SET SHOWPLAN_ALL OFF" );
422 'COUNT(*) AS EstimateRows',
459 if ( isset(
$options[
'EXPLAIN'] ) ) {
466 if ( strpos( $sql,
'MAX(' ) !==
false || strpos( $sql,
'MIN(' ) !==
false ) {
468 if ( is_array( $table ) ) {
472 if ( is_array(
$t ) ) {
482 foreach ( $bitColumns
as $col => $info ) {
484 "MAX({$col})" =>
"MAX(CAST({$col} AS tinyint))",
485 "MIN({$col})" =>
"MIN(CAST({$col} AS tinyint))",
487 $sql = str_replace( array_keys( $replace ), array_values( $replace ), $sql );
494 public function deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
499 parent::deleteJoin( $delTable, $joinTable, $delVar, $joinVar, $conds,
$fname );
500 }
catch ( Exception
$e ) {
507 public function delete( $table, $conds,
$fname = __METHOD__ ) {
510 parent::delete( $table, $conds,
$fname );
511 }
catch ( Exception
$e ) {
537 if ( is_string( $column ) && !in_array( $column, [
'*',
'1' ] ) ) {
538 $conds[] =
"$column IS NOT NULL";
550 if ( isset( $row[
'EstimateRows'] ) ) {
551 $rows = (int)$row[
'EstimateRows'];
567 # This does not return the same info as MYSQL would, but that's OK
568 # because MediaWiki never uses the returned value except to check for
569 # the existence of indexes.
570 $sql =
"sp_helpindex '" . $this->
tableName( $table ) .
"'";
578 foreach (
$res as $row ) {
579 if ( $row->index_name == $index ) {
580 $row->Non_unique = !stristr( $row->index_description,
"unique" );
581 $cols = explode(
", ", $row->index_keys );
582 foreach ( $cols
as $col ) {
583 $row->Column_name = trim( $col );
586 } elseif ( $index ==
'PRIMARY' && stristr( $row->index_description,
'PRIMARY' ) ) {
587 $row->Non_unique = 0;
588 $cols = explode(
", ", $row->index_keys );
589 foreach ( $cols
as $col ) {
590 $row->Column_name = trim( $col );
615 # No rows to insert, easy just return now
616 if ( !
count( $arrToInsert ) ) {
626 if ( !( isset( $arrToInsert[0] ) && is_array( $arrToInsert[0] ) ) ) {
627 $arrToInsert = [ 0 => $arrToInsert ];
633 $tableRawArr = explode(
'.', preg_replace(
'#\[([^\]]*)\]#',
'$1', $table ) );
634 $tableRaw = array_pop( $tableRawArr );
636 "SELECT NAME AS idColumn FROM SYS.IDENTITY_COLUMNS " .
637 "WHERE OBJECT_NAME(OBJECT_ID)='{$tableRaw}'"
639 if (
$res && sqlsrv_has_rows(
$res ) ) {
641 $identityArr = sqlsrv_fetch_array(
$res, SQLSRV_FETCH_ASSOC );
642 $identity = array_pop( $identityArr );
644 sqlsrv_free_stmt(
$res );
651 if ( in_array(
'IGNORE',
$options ) ) {
653 $this->ignoreDupKeyErrors =
true;
657 foreach ( $arrToInsert
as $a ) {
662 $identityClause =
'';
667 foreach ( $a
as $k => $v ) {
668 if ( $k == $identity ) {
669 if ( !is_null( $v ) ) {
672 $sqlPre =
"SET IDENTITY_INSERT $table ON;";
673 $sqlPost =
";SET IDENTITY_INSERT $table OFF;";
683 $identityClause =
"OUTPUT INSERTED.$identity ";
686 $keys = array_keys( $a );
689 $sql = $sqlPre .
'INSERT ' . implode(
' ',
$options ) .
690 " INTO $table (" . implode(
',',
$keys ) .
") $identityClause VALUES (";
694 if ( isset( $binaryColumns[$key] ) ) {
702 if ( is_null(
$value ) ) {
704 } elseif ( is_array(
$value ) || is_object(
$value ) ) {
714 $sql .=
')' . $sqlPost;
720 }
catch ( Exception
$e ) {
722 $this->ignoreDupKeyErrors =
false;
729 $row =
$ret->fetchObject();
730 if ( is_object( $row ) ) {
731 $this->lastInsertId = $row->$identity;
735 if ( $this->lastAffectedRowCount == -1 ) {
736 $this->lastAffectedRowCount = 1;
742 $this->ignoreDupKeyErrors =
false;
764 $insertOptions = [], $selectOptions = [], $selectJoinConds = []
768 $ret = parent::nativeInsertSelect(
778 }
catch ( Exception
$e ) {
817 $sql =
"UPDATE $opts $table SET " . $this->
makeList( $values,
LIST_SET, $binaryColumns );
819 if ( $conds !== [] && $conds !==
'*' ) {
825 $this->
query( $sql );
826 }
catch ( Exception
$e ) {
851 if ( !is_array( $a ) ) {
852 throw new DBUnexpectedError( $this, __METHOD__ .
' called with incorrect parameters' );
859 foreach ( array_keys( $a )
as $field ) {
860 if ( !isset( $binaryColumns[$field] ) ) {
864 if ( is_array( $a[$field] ) ) {
865 foreach ( $a[$field]
as &$v ) {
870 $a[$field] =
new MssqlBlob( $a[$field] );
875 return parent::makeList( $a, $mode );
885 $sql =
"SELECT CHARACTER_MAXIMUM_LENGTH,DATA_TYPE FROM INFORMATION_SCHEMA.Columns
886 WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'";
890 if ( strtolower( $row[
'DATA_TYPE'] ) !=
'text' ) {
891 $size = $row[
'CHARACTER_MAXIMUM_LENGTH'];
908 if ( $offset ===
false || $offset == 0 ) {
909 if ( strpos( $sql,
"SELECT" ) ===
false ) {
910 return "TOP {$limit} " . $sql;
912 return preg_replace(
'/\bSELECT(\s+DISTINCT)?\b/Dsi',
913 'SELECT$1 TOP ' . $limit, $sql, 1 );
917 $select = $orderby = [];
918 $s1 = preg_match(
'#SELECT\s+(.+?)\s+FROM#Dis', $sql, $select );
919 $s2 = preg_match(
'#(ORDER BY\s+.+?)(\s*FOR XML .*)?$#Dis', $sql, $orderby );
921 $first = $offset + 1;
922 $last = $offset + $limit;
924 $sub2 =
'sub_' . ( $this->subqueryId + 1 );
925 $this->subqueryId += 2;
928 throw new DBUnexpectedError( $this,
"Attempting to LIMIT a non-SELECT query\n" );
932 $overOrder =
'ORDER BY (SELECT 1)';
934 if ( !isset( $orderby[2] ) || !$orderby[2] ) {
936 $sql = str_replace( $orderby[1],
'', $sql );
938 $overOrder = $orderby[1];
939 $postOrder =
' ' . $overOrder;
941 $sql =
"SELECT {$select[1]}
943 SELECT ROW_NUMBER() OVER({$overOrder}) AS rowNumber, *
944 FROM ({$sql}) {$sub1}
946 WHERE rowNumber BETWEEN {$first} AND {$last}{$postOrder}";
964 $pattern =
'/\bLIMIT\s+((([0-9]+)\s*,\s*)?([0-9]+)(\s+OFFSET\s+([0-9]+))?)/i';
965 if ( preg_match( $pattern, $sql,
$matches ) ) {
970 $sql = str_replace(
$matches[0],
'', $sql );
972 return $this->
limitResult( $sql, $row_count, $offset );
982 return "[{{int:version-db-mssql-url}} MS SQL Server]";
989 $server_info = sqlsrv_server_info( $this->conn );
991 if ( isset( $server_info[
'SQLServerVersion'] ) ) {
992 $version = $server_info[
'SQLServerVersion'];
1004 list( $db, $schema, $table ) = $this->
tableName( $table,
'split' );
1006 if ( $db !==
false ) {
1008 $this->queryLogger->error(
"Attempting to call tableExists on a remote table" );
1012 if ( $schema ===
false ) {
1016 $res = $this->
query(
"SELECT 1 FROM INFORMATION_SCHEMA.TABLES
1017 WHERE TABLE_TYPE = 'BASE TABLE'
1018 AND TABLE_SCHEMA = '$schema' AND TABLE_NAME = '$table'" );
1020 if (
$res->numRows() ) {
1035 list( $db, $schema, $table ) = $this->
tableName( $table,
'split' );
1037 if ( $db !==
false ) {
1039 $this->queryLogger->error(
"Attempting to call fieldExists on a remote table" );
1043 $res = $this->
query(
"SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS
1044 WHERE TABLE_SCHEMA = '$schema' AND TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" );
1046 if (
$res->numRows() ) {
1054 list( $db, $schema, $table ) = $this->
tableName( $table,
'split' );
1056 if ( $db !==
false ) {
1058 $this->queryLogger->error(
"Attempting to call fieldInfo on a remote table" );
1062 $res = $this->
query(
"SELECT * FROM INFORMATION_SCHEMA.COLUMNS
1063 WHERE TABLE_SCHEMA = '$schema' AND TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" );
1065 $meta =
$res->fetchRow();
1091 sqlsrv_begin_transaction( $this->conn );
1100 sqlsrv_commit( $this->conn );
1110 sqlsrv_rollback( $this->conn );
1120 return str_replace(
"'",
"''",
$s );
1130 } elseif (
$s instanceof
Blob ) {
1134 return $blob->fetch();
1136 if ( is_bool(
$s ) ) {
1139 return parent::addQuotes(
$s );
1149 return '[' .
$s .
']';
1157 return strlen(
$name ) &&
$name[0] ==
'[' && substr(
$name, -1, 1 ) ==
']';
1168 return str_replace( [ $escapeChar,
'%',
'_',
'[',
']',
'^' ],
1169 [
"{$escapeChar}{$escapeChar}",
"{$escapeChar}%",
"{$escapeChar}_",
1170 "{$escapeChar}[",
"{$escapeChar}]",
"{$escapeChar}^" ],
1176 $this->
query(
"USE $encDatabase" );
1178 $this->currentDomain = $domain;
1194 if ( is_numeric( $key ) ) {
1195 $noKeyOptions[$option] =
true;
1203 if ( isset( $noKeyOptions[
'DISTINCT'] ) || isset( $noKeyOptions[
'DISTINCTROW'] ) ) {
1204 $startOpts .=
'DISTINCT';
1207 if ( isset( $noKeyOptions[
'FOR XML'] ) ) {
1209 $tailOpts .=
" FOR XML PATH('')";
1213 return [ $startOpts,
'', $tailOpts,
'',
'' ];
1225 return implode(
' + ', $stringList );
1249 $this->subqueryId++;
1251 $delimLen = strlen( $delim );
1252 $fld =
"{$field} + {$this->addQuotes( $delim )}";
1253 $sql =
"(SELECT LEFT({$field}, LEN({$field}) - {$delimLen}) FROM ("
1254 . $this->
selectSQLText( $table, $fld, $conds,
null, [
'FOR XML' ], $join_conds )
1255 .
") {$gcsq} ({$field}))";
1262 if ( $length ===
null ) {
1268 $length = 2147483647;
1270 return 'SUBSTRING(' . implode(
',', [
$input, $startPosition, $length ] ) .
')';
1280 $tableRawArr = explode(
'.', preg_replace(
'#\[([^\]]*)\]#',
'$1', $table ) );
1281 $tableRaw = array_pop( $tableRawArr );
1283 if ( $this->binaryColumnCache ===
null ) {
1287 return $this->binaryColumnCache[$tableRaw] ?? [];
1295 $tableRawArr = explode(
'.', preg_replace(
'#\[([^\]]*)\]#',
'$1', $table ) );
1296 $tableRaw = array_pop( $tableRawArr );
1298 if ( $this->bitColumnCache ===
null ) {
1302 return $this->bitColumnCache[$tableRaw] ?? [];
1306 $res = $this->
select(
'INFORMATION_SCHEMA.COLUMNS',
'*',
1309 'TABLE_SCHEMA' => $this->
dbSchema(),
1310 'DATA_TYPE' => [
'varbinary',
'binary',
'image',
'bit' ]
1313 $this->binaryColumnCache = [];
1314 $this->bitColumnCache = [];
1315 foreach (
$res as $row ) {
1316 if ( $row->DATA_TYPE ==
'bit' ) {
1317 $this->bitColumnCache[$row->TABLE_NAME][$row->COLUMN_NAME] = $row;
1319 $this->binaryColumnCache[$row->TABLE_NAME][$row->COLUMN_NAME] = $row;
1330 # Replace reserved words with better ones
1347 if ( $format ==
'split' ) {
1350 $table = explode(
'.', $table );
1351 while (
count( $table ) < 3 ) {
1352 array_unshift( $table,
false );
1365 public function dropTable( $tableName, $fName = __METHOD__ ) {
1366 if ( !$this->
tableExists( $tableName, $fName ) ) {
1371 $sql =
"DROP TABLE " . $this->
tableName( $tableName );
1373 return $this->
query( $sql, $fName );
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. 'ImgAuthModifyHeaders':Executed just before a file is streamed to a user via img_auth.php, allowing headers to be modified beforehand. $title:LinkTarget object & $headers:HTTP headers(name=> value, names are case insensitive). Two headers get special handling:If-Modified-Since(value must be a valid HTTP date) and Range(must be of the form "bytes=(\d*-\d*)") will be honored when streaming the file. '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 'ImportHandleUnknownUser':When a user doesn 't exist locally, this hook is called to give extensions an opportunity to auto-create it. If the auto-creation is successful, return false. $name:User name '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 since 1.16! 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:Array with elements of the form "language:title" in the order that they will be output. & $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':DEPRECATED since 1.28! Use HtmlPageLinkRendererBegin instead. 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
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
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
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 user
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for tableName() and addQuotes(). You will need both of them. ------------------------------------------------------------------------ Basic query optimisation ------------------------------------------------------------------------ MediaWiki developers who need to write DB queries should have some understanding of databases and the performance issues associated with them. Patches containing unacceptably slow features will not be accepted. Unindexed queries are generally not welcome in MediaWiki
if(is_array( $mode)) switch( $mode) $input
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
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
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Allows to change the fields on the form that will be generated $name
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
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
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction $rows
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 & $options
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
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Class to handle database/prefix specification for IDatabase domains.
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 but it is *strongly *advised not to try any more intrusive changes to get MediaWiki to conform more closely to your filesystem hierarchy Any such attempt will almost certainly result in unnecessary bugs The standard recommended location to install relative to the web is it should be possible to enable the appropriate rewrite rules by if you can reconfigure the web server