64 $this->dbDir = isset( $p[
'dbDirectory'] ) ? $p[
'dbDirectory'] :
$wgSQLiteDataDir;
66 if ( isset( $p[
'dbFilePath'] ) ) {
67 parent::__construct( $p );
73 $this->mDBname = $p[
'dbname'];
75 parent::__construct( $p );
77 if ( $p[
'dbname'] && !$this->
isOpen() ) {
78 if ( $this->
open( $p[
'host'], $p[
'user'], $p[
'password'], $p[
'dbname'] ) ) {
86 $this->trxMode = isset( $p[
'trxMode'] ) ? strtoupper( $p[
'trxMode'] ) : null;
87 if ( $this->trxMode &&
88 !in_array( $this->trxMode, [
'DEFERRED',
'IMMEDIATE',
'EXCLUSIVE' ] )
90 $this->trxMode = null;
91 wfWarn(
"Invalid SQLite transaction mode provided." );
94 $this->lockMgr =
new FSLockManager( [
'lockDirectory' =>
"{$this->dbDir}/locks" ] );
107 $p[
'dbFilePath'] = $filename;
108 $p[
'schema'] =
false;
109 $p[
'tablePrefix'] =
'';
143 $fileName = self::generateFileName( $this->dbDir, $dbName );
144 if ( !is_readable( $fileName ) ) {
145 $this->mConn =
false;
163 $this->dbPath = $fileName;
166 $this->mConn =
new PDO(
"sqlite:$fileName",
'',
'',
167 [ PDO::ATTR_PERSISTENT =>
true ] );
169 $this->mConn =
new PDO(
"sqlite:$fileName",
'',
'' );
171 }
catch ( PDOException
$e ) {
172 $err = $e->getMessage();
175 if ( !$this->mConn ) {
176 wfDebug(
"DB connection error: $err\n" );
181 if ( $this->mOpened ) {
182 # Set error codes only, don't raise exceptions
183 $this->mConn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT );
184 # Enforce LIKE to be case sensitive, just like MySQL
185 $this->
query(
'PRAGMA case_sensitive_like = 1' );
218 return "$dir/$dbName.sqlite";
226 if ( self::$fulltextEnabled === null ) {
227 self::$fulltextEnabled =
false;
228 $table = $this->
tableName(
'searchindex' );
229 $res = $this->
query(
"SELECT sql FROM sqlite_master WHERE tbl_name = '$table'", __METHOD__ );
231 $row =
$res->fetchRow();
232 self::$fulltextEnabled = stristr( $row[
'sql'],
'fts' ) !==
false;
236 return self::$fulltextEnabled;
244 static $cachedResult = null;
245 if ( $cachedResult !== null ) {
246 return $cachedResult;
248 $cachedResult =
false;
249 $table =
'dummy_search_test';
251 $db = self::newStandaloneInstance(
':memory:' );
252 if ( $db->query(
"CREATE VIRTUAL TABLE $table USING FTS3(dummy_field)", __METHOD__,
true ) ) {
253 $cachedResult =
'FTS3';
257 return $cachedResult;
273 $file = self::generateFileName( $this->dbDir,
$name );
277 return $this->
query(
"ATTACH DATABASE $file AS $name",
$fname );
287 return parent::isWriteQuery( $sql ) && !preg_match(
'/^(ATTACH|PRAGMA)\b/i', $sql );
297 $res = $this->mConn->query( $sql );
298 if (
$res ===
false ) {
302 $this->mAffectedRows = $r->rowCount();
331 $cur = current( $r );
332 if ( is_array( $cur ) ) {
335 foreach ( $cur
as $k => $v ) {
336 if ( !is_numeric( $k ) ) {
357 $cur = current( $r );
358 if ( is_array( $cur ) ) {
385 if ( is_array( $r ) && count( $r ) > 0 ) {
387 return count( $r[0] ) / 2;
401 if ( is_array( $r ) ) {
402 $keys = array_keys( $r[0] );
419 if ( strpos(
$name,
'sqlite_' ) === 0 ) {
443 return intval( $this->mConn->lastInsertId() );
458 for ( $i = 0; $i < $row; $i++ ) {
468 if ( !is_object( $this->mConn ) ) {
469 return "Cannot return last error, no db connection";
471 $e = $this->mConn->errorInfo();
473 return isset(
$e[2] ) ?
$e[2] :
'';
480 if ( !is_object( $this->mConn ) ) {
481 return "Cannot return last error, no db connection";
483 $info = $this->mConn->errorInfo();
512 if (
$res->numRows() == 0 ) {
516 foreach (
$res as $row ) {
517 $info[] = $row->name;
530 $row = $this->
selectRow(
'sqlite_master',
'*',
535 if ( !$row || !isset( $row->sql ) ) {
540 $indexPos = strpos( $row->sql,
'INDEX' );
541 if ( $indexPos ===
false ) {
544 $firstPart = substr( $row->sql, 0, $indexPos );
545 $options = explode(
' ', $firstPart );
547 return in_array(
'UNIQUE',
$options );
558 if ( is_numeric( $k ) && ( $v ==
'FOR UPDATE' || $v ==
'LOCK IN SHARE MODE' ) ) {
563 return parent::makeSelectOptions(
$options );
582 # SQLite uses OR IGNORE not just IGNORE
584 if ( $v ==
'IGNORE' ) {
599 return parent::makeInsertOptions(
$options );
611 if ( !count( $a ) ) {
615 # SQLite can't handle multi-row inserts, so divide up into multiple single-row inserts
616 if ( isset( $a[0] ) && is_array( $a[0] ) ) {
618 foreach ( $a
as $v ) {
638 if ( !count( $rows ) ) {
642 # SQLite can't handle multi-row replaces, so divide up into multiple single-row queries
643 if ( isset( $rows[0] ) && is_array( $rows[0] ) ) {
645 foreach ( $rows
as $v ) {
646 if ( !$this->
nativeReplace( $table, $v,
"$fname/multi-row" ) ) {
682 $glue = $all ?
' UNION ALL ' :
' UNION ';
684 return implode( $glue, $sqls );
712 return "[{{int:version-db-sqlite-url}} SQLite]";
719 $ver = $this->mConn->getAttribute( PDO::ATTR_SERVER_VERSION );
728 return wfMessage( self::getFulltextSearchModule()
743 $sql =
'PRAGMA table_info(' . $this->
addQuotes( $tableName ) .
')';
745 foreach (
$res as $row ) {
746 if ( $row->name == $field ) {
755 if ( $this->trxMode ) {
760 $this->mTrxLevel = 1;
776 return new Blob( $b );
784 if ( $b instanceof
Blob ) {
796 if (
$s instanceof
Blob ) {
797 return "x'" . bin2hex(
$s->fetch() ) .
"'";
798 } elseif ( is_bool(
$s ) ) {
800 } elseif ( strpos(
$s,
"\0" ) !==
false ) {
813 ': Quoting value containing null byte. ' .
814 'For consistency all binary data should have been ' .
815 'first processed with self::encodeBlob()'
817 return "x'" . bin2hex(
$s ) .
"'";
819 return $this->mConn->quote(
$s );
832 return parent::buildLike(
$params ) .
"ESCAPE '\' ";
839 return "SearchSqlite";
848 $args = func_get_args();
849 $function = array_shift(
$args );
851 return call_user_func_array( $function,
$args );
859 $s = parent::replaceVars(
$s );
860 if ( preg_match(
'/^\s*(CREATE|ALTER) TABLE/i',
$s ) ) {
864 $s = preg_replace(
'/\b(var)?binary(\(\d+\))/i',
'BLOB',
$s );
866 $s = preg_replace(
'/\b(un)?signed\b/i',
'',
$s );
868 $s = preg_replace(
'/\b(tiny|small|medium|big|)int(\s*\(\s*\d+\s*\)|\b)/i',
'INTEGER',
$s );
871 '/\b(float|double(\s+precision)?)(\s*\(\s*\d+\s*(,\s*\d+\s*)?\)|\b)/i',
876 $s = preg_replace(
'/\b(var)?char\s*\(.*?\)/i',
'TEXT',
$s );
878 $s = preg_replace(
'/\b(tiny|medium|long)text\b/i',
'TEXT',
$s );
880 $s = preg_replace(
'/\b(tiny|small|medium|long|)blob\b/i',
'BLOB',
$s );
882 $s = preg_replace(
'/\bbool(ean)?\b/i',
'INTEGER',
$s );
884 $s = preg_replace(
'/\b(datetime|timestamp)\b/i',
'TEXT',
$s );
886 $s = preg_replace(
'/\benum\s*\([^)]*\)/i',
'TEXT',
$s );
888 $s = preg_replace(
'/\bbinary\b/i',
'',
$s );
890 $s = preg_replace(
'/\bauto_increment\b/i',
'AUTOINCREMENT',
$s );
892 $s = preg_replace(
'/\)[^);]*(;?)\s*$/',
')\1',
$s );
894 $s = preg_replace(
'/primary key (.*?) autoincrement/i',
'PRIMARY KEY AUTOINCREMENT $1',
$s );
895 } elseif ( preg_match(
'/^\s*CREATE (\s*(?:UNIQUE|FULLTEXT)\s+)?INDEX/i',
$s ) ) {
897 $s = preg_replace(
'/\(\d+\)/',
'',
$s );
899 $s = preg_replace(
'/\bfulltext\b/i',
'',
$s );
900 } elseif ( preg_match(
'/^\s*DROP INDEX/i',
$s ) ) {
902 $s = preg_replace(
'/\sON\s+[^\s]*/i',
'',
$s );
903 } elseif ( preg_match(
'/^\s*INSERT IGNORE\b/i',
$s ) ) {
905 $s = preg_replace(
'/^\s*INSERT IGNORE\b/i',
'INSERT OR IGNORE',
$s );
911 public function lock( $lockName, $method, $timeout = 5 ) {
912 if ( !is_dir(
"{$this->dbDir}/locks" ) ) {
913 if ( !is_writable( $this->dbDir ) || !mkdir(
"{$this->dbDir}/locks" ) ) {
914 throw new DBError(
"Cannot create directory \"{$this->dbDir}/locks\"." );
921 public function unlock( $lockName, $method ) {
932 return '(' . implode(
') || (', $stringList ) .
')';
936 $delim, $table, $field, $conds =
'', $join_conds = []
938 $fld =
"group_concat($field," . $this->
addQuotes( $delim ) .
')';
940 return '(' . $this->
selectSQLText( $table, $fld, $conds, null, [], $join_conds ) .
')';
952 $res = $this->
query(
"SELECT sql FROM sqlite_master WHERE tbl_name=" .
956 throw new MWException(
"Couldn't retrieve structure for table $oldName" );
960 '/(?<=\W)"?' . preg_quote( trim( $this->
addIdentifierQuotes( $oldName ),
'"' ) ) .
'"?(?=\W)/',
966 if ( preg_match(
'/^\\s*CREATE\\s+VIRTUAL\\s+TABLE\b/i', $sql ) ) {
967 wfDebug(
"Table $oldName is virtual, can't create a temporary duplicate.\n" );
969 $sql = str_replace(
'CREATE TABLE',
'CREATE TEMPORARY TABLE', $sql );
976 $indexList = $this->
query(
'PRAGMA INDEX_LIST(' . $this->
addQuotes( $oldName ) .
')' );
977 foreach ( $indexList
as $index ) {
978 if ( strpos( $index->name,
'sqlite_autoindex' ) === 0 ) {
982 if ( $index->unique ) {
983 $sql =
'CREATE UNIQUE INDEX';
985 $sql =
'CREATE INDEX';
988 $indexName = $newName .
'_' . $index->name;
989 $sql .=
' ' . $indexName .
' ON ' . $newName;
991 $indexInfo = $this->
query(
'PRAGMA INDEX_INFO(' . $this->
addQuotes( $index->name ) .
')' );
993 foreach ( $indexInfo
as $indexInfoRow ) {
994 $fields[$indexInfoRow->seqno] = $indexInfoRow->name;
997 $sql .=
'(' . implode(
',', $fields ) .
')';
999 $this->
query( $sql );
1023 $vars = get_object_vars( $table );
1024 $table = array_pop(
$vars );
1026 if ( !$prefix || strpos( $table, $prefix ) === 0 ) {
1027 if ( strpos( $table,
'sqlite_' ) !== 0 ) {
1028 $endArray[] = $table;
1040 return 'SQLite ' . (
string)$this->mConn->getAttribute( PDO::ATTR_SERVER_VERSION );
1052 $this->info =
$info;
1057 return $this->info->name;
1065 if ( is_string( $this->info->dflt_value ) ) {
1067 if ( preg_match(
'/^\'(.*)\'$', $this->info->dflt_value ) ) {
1068 return str_replace(
"''",
"'", $this->info->dflt_value );
1072 return $this->info->dflt_value;
1079 return !$this->info->notnull;
1083 return $this->info->type;
select($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
Execute a SELECT query constructed using the various parameters provided.
$wgSQLiteDataDir
To override default SQLite data directory ($docroot/../data)
Database error base class.
the array() calling protocol came about after MediaWiki 1.4rc1.
Utility classThis allows us to distinguish a blob from a normal string and an array of strings...
attachDatabase($name, $file=false, $fname=__METHOD__)
Attaches external database to our connection, see http://sqlite.org/lang_attach.html for details...
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
buildGroupConcatField($delim, $table, $field, $conds= '', $join_conds=[])
Build a GROUP_CONCAT or equivalent statement for a query.
static generateFileName($dir, $dbName)
Generates a database file name.
unionSupportsOrderAndLimit()
This code would result in ircNotify being run twice when an article is and once for brion Hooks can return three possible true was required This is the default since MediaWiki *some string
static getFulltextSearchModule()
Returns version of currently supported SQLite fulltext search module or false if none present...
FSLockManager $lockMgr
(hopefully on the same server as the DB)
tableName($name, $format= 'quoted')
Use MySQL's naming (accounts for prefix etc) but remove surrounding backticks.
Base for all database-specific classes representing information about database fields.
insert($table, $a, $fname=__METHOD__, $options=[])
Based on generic method (parent) with some prior SQLite-sepcific adjustments.
when a variable name is used in a it is silently declared as a new local masking the global
insertId()
This must be called after nextSequenceVal.
open($server, $user, $pass, $dbName)
Open an SQLite database and return a resource handle to it NOTE: only $dbName is used, the other parameters are irrelevant for SQLite databases.
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
close()
Closes a database connection.
selectSQLText($table, $vars, $conds= '', $fname=__METHOD__, $options=[], $join_conds=[])
The equivalent of IDatabase::select() except that the constructed SQL is returned, instead of being immediately executed.
listTables($prefix=null, $fname=__METHOD__)
List all tables on the database.
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':DEPRECATED!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
static newStandaloneInstance($filename, array $p=[])
__construct($info, $tableName)
wfDebugLog($logGroup, $text, $dest= 'all', array $context=[])
Send a line to a supplementary debug log file, if configured, or main debug log if not...
openFile($fileName)
Opens a database file.
unlock($lockName, $method)
Release a lock.
makeSelectOptions($options)
Filter the options used in SELECT statements.
string $trxMode
Transaction mode.
wfWarn($msg, $callerOffset=1, $level=E_USER_NOTICE)
Send a warning either to the debug log or in a PHP error depending on $wgDevelopmentWarnings.
fieldInfo($table, $field)
Get information about a given field Returns false if the field does not exist.
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
static bool $fulltextEnabled
Whether full text is enabled.
$wgSharedDB
Shared database for multiple wikis.
static factory($dbType, $p=[])
Given a DB type, construct the name of the appropriate child class of DatabaseBase.
makeInsertOptions($options)
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 just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned after processing after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"<
checkForEnabledSearch()
Check if the searchindext table is FTS enabled.
addIdentifierQuotes($s)
Quotes an identifier using backticks or "double quotes" depending on the database type...
duplicateTableStructure($oldName, $newName, $temporary=false, $fname=__METHOD__)
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
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
string $dbPath
File name for SQLite database file.
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
selectRow($table, $vars, $conds, $fname=__METHOD__, $options=[], $join_conds=[])
Single row SELECT wrapper.
doQuery($sql)
SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result...
deadlockLoop()
No-op version of deadlockLoop.
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
indexInfo($table, $index, $fname=__METHOD__)
Returns information about an index Returns false if the index does not exist.
makeUpdateOptionsArray($options)
closeConnection()
Does not actually close the connection, just destroys the reference for GC to do its work...
__construct(array $p)
Additional params include:
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
tableName()
Name of table this field belongs to.
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 just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned after processing after in associative array form externallinks including delete and insert
lock($lockName, $method, $timeout=5)
Acquire a named lock.
query($sql, $fname=__METHOD__, $tempIgnore=false)
Run an SQL query and return the result.
indexName($index)
Index names have DB scope.
replace($table, $uniqueIndexes, $rows, $fname=__METHOD__)
indexUnique($table, $index, $fname=__METHOD__)
numRows($res)
The PDO::Statement class implements the array interface so count() will work.
Result wrapper for grabbing data queried by someone else.
nativeReplace($table, $rows, $fname)
REPLACE query wrapper for MySQL and SQLite, which have a native REPLACE statement.
textFieldSize($table, $field)
Returns the size of a text field, or -1 for "unlimited" In SQLite this is SQLITE_MAX_LENGTH, by default 1GB.
static fixIgnore($options)
isOpen()
Is a connection to the database open?
int $mAffectedRows
The number of rows affected as an integer.
static configuration should be added through ResourceLoaderGetConfigVars instead & $vars
unionQueries($sqls, $all)
Simple version of LockManager based on using FS lock files.
buildConcat($stringList)
Build a concatenation list to feed into a SQL query.
Allows to change the fields on the form that will be generated $name