aboutsummaryrefslogtreecommitdiffstats
path: root/includes/db
Commit message (Collapse)AuthorAgeFilesLines
...
* rdbms: inject the mysql index name aliases into DatabaseAaron Schulz2018-03-121-0/+27
| | | | | | Also added LBFactory::setTableAlias() for consistency with this Change-Id: Ie49003ff8fd5b99f75db9fae8fe0a184444254d4
* Introduce IDatabase::buildSubstringaddshore2018-03-071-0/+9
| | | | Change-Id: I96f3e0c4920d52f63175cb6767c149f20a8a8cde
* Add `actor` table and code to start using itBrad Jorsch2018-02-231-1/+4
| | | | | | | | | | | | | Storing the user name or IP in every row in large tables like revision and logging takes up space and makes operations on these tables slower. This patch begins the process of moving those into one "actor" table which other tables can reference with a single integer field. A subsequent patch will remove the old columns. Bug: T167246 Depends-On: I9293fd6e0f958d87e52965de925046f1bb8f8a50 Change-Id: I8d825eb02c69cc66d90bd41325133fd3f99f0226
* rdbms: remove "m" prefix from Database fieldsAaron Schulz2018-02-151-70/+70
| | | | | | | | | Done using the PhpStorm refactor->rename tool. Also move "defaultBigSelects" declaration to DatabaseMysqlBase as no other classes uses that. Change-Id: I424a2d9815de3a5d4cca2522f3db23a5efe6b592
* Update suppressWarning()/restoreWarning() callsReedy2018-02-101-12/+12
| | | | | Bug: T182273 Change-Id: I9e1b628fe5949ca54258424c2e45b2fb6d491d0f
* Merge "rdbms: set the schema in the LBFactory local domain"jenkins-bot2018-02-021-1/+1
|\
| * rdbms: set the schema in the LBFactory local domainAaron Schulz2018-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, enforce that new DB connection use the domain schema as is the case with the DB name and table prefix. The code worked previously since the local domain did not override the schema in the server configuration arrays, so it happened not to clobber the domain schema. Lastly, fix unit test fatal in LBFactorySingle::forEachLB() when called during LBFactorySingle::_destruct(). Change-Id: Ia9ddef0f21591d0c8b15f2947cd61569e3fec7a0
* | rdbms: make affectedRows() work more consistentlyAaron Schulz2018-01-301-1/+1
| | | | | | | | | | | | | | | | | | * Update replace()/upsert() to combine the affected row count for the non-native case * Also make replace() atomic in the non-native case, similar to how upsert() already works Change-Id: I6c9bcba54eca6bcf4a93a9b230aaedf7f36aa877
* | Use ::class to resolve class names in includes filesUmherirrender2018-01-271-2/+2
|/ | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
* Introduce DB schema overrides for unit tests.daniel2018-01-051-2/+2
| | | | | | | | | | | | | This introduces MediaWikiTestCase::getSchemaOverrides, which can be overwritten to return information about which tables are going to be altered, and which SQL files should be used to set up the target schema. This allows tests for a class that interacts with the database can have a subclass for each supported database schema. NOTE: this has only been tested with MySQL. Bug: T180705 Change-Id: I7a4071072d802a82ecf7d16fbf8882ff8c79287f
* Remove some dumb headers with my name in itChad Horohoe2017-11-301-3/+0
| | | | Change-Id: Ib34b623b47fb92f1383bc5c55c50a16dd6d49abd
* Use the main stash for LBFactory "memStash" parameterAaron Schulz2017-11-101-5/+7
| | | | | | | | | | | This store is used for ChronologyProtector positions. It should be cross-DC since the sticky DC cookie may not work for rapid cross-wiki farm activity, causing some request go to the non-primary DC. NOTE: this change should be deployed on all farm wikis at once Change-Id: Ife126592aacace696e43912b9461164a9ea98bc1
* Deprecate IDatabase::nextSequenceValue()Brad Jorsch2017-08-311-22/+3
| | | | | | | | | | | | | It's often forgotten because MySQL and Sqlite don't use it, the only users are PostgreSQL and Oracle. And when used, if inserts to multiple tables are being done it's easy to get the ordering wrong. This patch reimplements DatabasePostgres::insertId() in terms of PG's lastval() function, and adds triggers to the Oracle schema to make it work the same as the other databases. Bug: T164900 Change-Id: Ib308190c52673a9266c8495a589ae644f9fbefce
* rdbms: Rename "memCache" to "memStash" in LBFactoryAaron Schulz2017-08-171-1/+1
| | | | | | | This needs to be cross DC, so fix the name and comments. Also update the one MWLBFactory reference to it. Change-Id: I5ef10000276c300299fd1ece35ada0d78388bef7
* Add missing & to @param documentation to match functon callUmherirrender2017-08-111-1/+1
| | | | Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
* Remove auto-generated "Constructor" documentation on constructorsThiemo Mättig2017-07-211-2/+0
| | | | | | | | | | | Having such comments is worse than not having them. They add zero information. But you must read the text to understand there is nothing you don't already know from the class and the method name. This is similar to I994d11e. Even more trivial, because this here is about comments that don't say anything but "constructor". Change-Id: I474dcdb5997bea3aafd11c0760ee072dfaff124c
* Merge "Remove exception and drop cloned tables in PostgresSQL too"jenkins-bot2017-06-281-1/+3
|\
| * Remove exception and drop cloned tables in PostgresSQL tooyoonghm2017-06-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | In PostgresSQL a) Temp tables are automatically deleted upon end of session b) Same temp table name hides existing table for current session It is not necessary to consider 'postgres' during dropping of table. I guess similar logic for Oracle but I could not verify. It seems that no one use Oracle for MediaWiki. Bug: T113445 Change-Id: I37b5483a6e9abe5cda0d4dfc103c287641f277a7
* | DB: Add join conditions to selectField, selectFieldValues, and insertSelectBrad Jorsch2017-06-141-18/+11
|/ | | | | | | | | | | | | | | selectField() and selectFieldValues() are trivial, they just need to pass it through to select(). In fact, selectFieldValues() was already doing it, just no one ever updated IDatabase. insertSelect() is a little more work. nativeInsertSelect() was originally written as largely a copy-paste of select() and has since gotten well out of sync. Now that we have selectSQLText(), we should be able to just use that. DatabasePostgres's implementation can wrap the parent implementation instead of being another copy-paste, but DatabaseOracle seems to still need to be special. Change-Id: I0e6a9e6daa510639d3212641606047a5db96c500
* A service for read-only modeTim Starling2017-04-191-3/+5
| | | | | | | | | | | | | | | | Introduce a service to represent wfReadOnly() and friends. It's necessary to have two service instances, one for wfReadOnly() and one for wfConfiguredReadOnlyReason(), to avoid a circular dependency, since LoadBalancer needs the configured reason during construction, but wfReadOnly() needs to query the currently active load balancer. Not having a cache of the configuration makes it possible to dynamically change the configuration. Ideally things would not change the configuration, and I removed such instances in core, but to support extensions, I added a test ensuring that the configuration can be changed. Change-Id: I9bbee946c10742526d3423208efd68cb3cc5a7ee
* Move DB errors to Rdbms namespaceAaron Schulz2017-04-151-0/+2
| | | | Change-Id: I463bd86123501abc68fdb78b4cda6110f7af2549
* Move Database and subclasses to Rdbms namespaceAaron Schulz2017-04-121-0/+2
| | | | Change-Id: I52bef87512f9ddd155d1f4cc0052f6b7a0db5b42
* Move IDatabase/IMaintainableDatabase to Rdbms namespaceAaron Schulz2017-03-282-0/+3
| | | | Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
* Move ResultWrapper subclasses to RdbmsAaron Schulz2017-03-031-0/+1
| | | | Change-Id: I6f3f0e85e268b24c57c537aa6ad8016e0b4cdddb
* Merge "includes: Replace implicit Bugzilla bug numbers with Phab ones"jenkins-bot2017-02-281-1/+1
|\
| * includes: Replace implicit Bugzilla bug numbers with Phab onesJames D. Forrester2017-02-211-1/+1
| | | | | | | | | | | | | | It's unreasonable to expect newbies to know that "bug 12345" means "Task T14345" except where it doesn't, so let's just standardise on the real numbers. Change-Id: I6f59febaf8fc96e80f8cfc11f4356283f461142a
* | installer: Fix "relation 'user' does not exist" error for PostgresTimo Tijhof2017-02-231-0/+3
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | On Travis CI, the Postgres build has been failing very early on in the installer (before phpunit) due to a database error: > Creating administrator user account.. DBQueryError at Database.php:1059 > Query: SELECT user_id FROM "user" WHERE user_name = 'Admin' LIMIT 1 > Function: User::idForName > Error: 42P01 ERROR: relation "user" does not exist > LINE 1: SELECT /* User::idForName */ user_id FROM "user" ... This is because the installer makes its own Database object without involving ServiceWiring or MWLBFactory, which means wgDBport and (more importantly) 'keywordTableMap' don't get applied. While keywordTableMap doesn't matter during the database installation, after the installer is done updating GlobalVarConfig and resetting MediaWikiServices, DatabaseInstaller::enableLB takes that homemade connection and injects it into MediaWikiServices by redefining the 'DBLoadBalancerFactory' service. Which then affects all use of wfGetDB(), such as from User::idForName(). Bug: T30162 Bug: T75174 Bug: T75176 Change-Id: I7af58c4beffc4908a93c0c1d8ab1aec9d4ec57c6
* Move ORAResult to /dbAaron Schulz2017-02-172-107/+108
| | | | Change-Id: I9be89faef693343a4071d7c29b6ca0c021e7fb63
* Move Field classes to Rdbms namespaceAaron Schulz2017-02-161-0/+53
| | | | | | Update core callers and leave a class alias to \Field. Change-Id: I4908282301d5de2a20baafe510557bd2c3867de5
* Move Blob class to Rdbms namespacesAaron Schulz2017-02-131-0/+1
| | | | | | | Leave \Blob as an alias. Callers can now use the Rdbms\Blob class for "extends"/"new" and the Rdbms\IBlob interface for type hints. Change-Id: I983b76f181ac60c1eb92c350cd27ad77ec90a192
* Fix assortment of IDEA warningsAaron Schulz2017-02-111-13/+7
| | | | Change-Id: I3fb482232483f37bf73ebbeb405056794109e618
* Move mssql class to /libsAaron Schulz2017-02-102-1384/+9
| | | | | | | | | * Inject global variables in MWLBFactory.php * Remove incompatible ignoreErrors() override which is only called from the base classes. * Remove use of wf* methods. Change-Id: Idf8202474182cc82fb6ef453e2722e7af17e32aa
* Move DatabaseDomain to Rdbms namespaceAaron Schulz2017-02-071-0/+1
| | | | Change-Id: Ifb06e792a36b5123ec3596933d0d394711ee5d08
* Move LBFactory to Rdbms namespaceAaron Schulz2017-02-031-0/+11
| | | | Change-Id: I5ae10783228d0252284807c9562bc8e328d4becb
* Replace use of &$thisBrad Jorsch2017-01-311-2/+2
| | | | | | | | | Use of &$this doesn't work in PHP 7.1. For callbacks to methods like array_map() it's completely unnecessary, while for hooks we still need to pass a reference and so we need to copy $this into a local variable. Bug: T153505 Change-Id: I8bbb26e248cd6f213fd0e7460d6d6935a3f9e468
* Fixing grammar, capitalization and spelling in commentsZppix2017-01-191-6/+6
| | | | Change-Id: Iac80f6668be17c0e35908fc8fdacbae0201f2d7f
* Merge "Cleanup some incorrect return annotations"jenkins-bot2016-12-162-2/+2
|\
| * Cleanup some incorrect return annotationsErik Bernhardson2016-12-122-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of these are simply changing annotations to reflect reality. If a function can return false to indicate failure the @return should indicate it. Some are fixing preg_match calls, preg match returns 1, 0 or false, but the functions all claim to return booleans. This is far from all the incorrect return types in mediawiki, there are around 250 detected by phan, but have to start somewhere. Change-Id: I1bbdfee6190747bde460f8a7084212ccafe169ef
* | Add LoadBalancer::getMaintenanceConnectionRef() methodAaron Schulz2016-12-101-4/+5
|/ | | | | | | | | | | This is useful when IMaintainableDatabase methods are needed for foreign wiki connections to things like external store. Also: * Set visibility for ExternalStoreDB methods. * Cleaned up various type hints and comments. Change-Id: Ie35b1ff21032cc4e78912dc499486da23aeba041
* Avoid use of DatabaseBase in /includesAaron Schulz2016-12-022-2/+2
| | | | Change-Id: Ia3b7f9cb7d40f4ec9f19c924904e8a096880ec6a
* Only apply wgDBschema to postgres/mssqlAaron Schulz2016-11-211-4/+15
| | | | | Bug: T148956 Change-Id: I14f0aa7dd52bd0bdd0d3f8729b562a0fee2df6fa
* Revert "objectcache: detect default getWithSetCallback() set options"Hashar2016-11-161-19/+0
| | | | | | | | | | Causes HHVM 3.12.7 to segfault and or: Fatal error: Stack overflow in includes/libs/objectcache/BagOStuff.php on line 754 This reverts commit b47ce21cec3a4340dd37c773210a514350f10297. Bug: T150833 Change-Id: Ia52fdf65f5e386c0eaa1046328680fb5c8a9081a
* objectcache: detect default getWithSetCallback() set optionsAaron Schulz2016-11-161-0/+19
| | | | | | | | | | This works by setting a callback to return the cache set options. The callback will watch DB reads and create a merged result from said usage. This handles callers that are missing getCacheSetOptions(). Change-Id: Ia264f011e45e8cf105480955dad7e2c4c2357b73
* Depedency inject remappedTableName() map via MWLBFactoryAaron Schulz2016-11-091-1/+7
| | | | Change-Id: I71d3481fc624f665bac81725026647bbb84ae608
* Update weblinks in comments from HTTP to HTTPSFomafix2016-11-071-1/+1
| | | | | | | | Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link. Also update some defect links. Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
* Clean up some ObjectCache factory callersAaron Schulz2016-10-031-2/+3
| | | | | | | | * Use services container in more places. * Undeprecated getLocalServerInstance() since $fallback is not handled elsewhere. Change-Id: Id1fcd1c465d2d92653357523f4225f1c4d1ace2f
* database: Rename LBFactoryMW to MWLBFactoryTimo Tijhof2016-09-301-2/+2
| | | | | | | | | | It's no longer an LBFactory subclass (since 5d4b009cf), and the MW-prefix seems more natural for this class. The class has only existed since for about 2 weeks (since 0e5cd18b7) and is not used outside MediaWiki core across Wikimedia Git. Change-Id: I34be982b5d10ad03e062033da9c40b4a01665289
* Merge "Replace DatabaseBase:: with Database:: and update type hints"jenkins-bot2016-09-271-4/+4
|\
| * Replace DatabaseBase:: with Database:: and update type hintsAaron Schulz2016-09-271-4/+4
| | | | | | | | Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511
* | Remove a few unused variablesMax Semenik2016-09-261-1/+1
|/ | | | Change-Id: Ibfc4c6cbbc08b5917f1a84d86d2d4a0855e371a1