| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Move DatabaseTest and DatabaseSQLTest to libs,
and remove MediaWikiTestCase dependency.
* Refactor DatabaseTest to be a test of the Database abstract class,
not of whatever current DB backend is configured by LocalSettings.
- Remove most switches/conditionals and other tests for specific
database backends. Move those to individual test classes for
those backends instead.
- Some tests appear to have been integration tests for the PHP driver
and/or the db backend itself. Moved to a new DatabaseIntegrationTest.
- Now that only the abstract Database is invoked, the test runs a bit
faster (no real connections/queries).
* Add missing @covers tags, and remove or fix broken ones
(follows-up 26e52f0c491a4).
Change-Id: I9dc4a558e701d00e95789e7eb8e02926783b65ad
|
|
|
|
|
|
|
|
| |
Constructs a query for the union of permutations of a set of fields, for
use in situations where the database otherwise makes poor plans due to
inability to use indexes effectively (e.g. T149077 and T168010).
Change-Id: I20980dcada664486c09198b8c45896620bd83e81
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The TitleValue constructor, used by the link cache among other things,
throws an exception for DB keys which do not satisfy a simple sanity test
(starting or ending with _, or containing a space, tab, CR or LF
character). This has broken certain special pages on a number of WMF sites;
see T99736, T146778 and T155091.
The new cleanupInvalidDbKeys.php script allows these bogus entries to be
removed from the DB, making sure these exceptions won't be thrown in the
future. It cleans the title columns of the page, archive, redirect,
logging, category, protected_titles, recentchanges, watchlist, pagelinks,
templatelinks, and categorylinks tables.
The script doesn't support batching; most wikis should have fewer than 500
broken entries in each table. If need be, the script can be run several
times.
To make the LIKE queries work properly I had to fix the broken escaping
behaviour of Database::buildLike() -- previously it had a habit of double-
escaping things. Now an ESCAPE clause is added to change the escape
character from the problematic default backslash, and tests are added to
cover the changes.
Bug: T155091
Change-Id: I908e795e884e35be91852c0eaf056d6acfda31d8
|
|
|
|
| |
Change-Id: I0cba263cd02fc5c4bfe8f063f38d1b4be28246b0
|
|
|
|
| |
Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511
|
|
|
|
|
|
|
|
| |
Also make the temp table tracking catch plain "DROP TABLE"
in addition to the stricter "DROP TEMPORARY TABLE" clause.
Bug: T146300
Change-Id: Ia8306ec25e63adcdcf0dcc8f6a700dd01afdc948
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The Database class was previously just a short-hand for "Database::",
and such calls should still work. The class now resides in /libs/rdbms.
The subclasses now extend DatabaseBase to avoid breaking type hints
that use that (hints use either IDatabase or DatabaseBase).
Also, use CASCADE with DROP TABLE for MySQL as with other DBs.
Keep SQLite excempt due to lack of support.
Added getDomainID() methods to avoid mentioning the word "wiki".
Change-Id: Ibd05d786cb26c21dcc9cb9601f6b2b52056af9ae
|
|
|
|
|
|
|
|
|
|
|
| |
This avoids slave lag and makes query time account easier.
It also avoids table-level autoinc locking and slave drift
with statement-based replication in some setups.
Also refactored the use of $wgCommandLine mode in
DatabaseBase slightly, so that it can be injected.
Change-Id: I2dba6024ecf32c9ee24a3080cce3b02568c1458b
|
|
|
|
|
|
|
|
|
|
| |
Per wikitech-l consensus:
https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html
Notes:
* Disabled CallTimePassByReference due to false positives (T127163)
Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Amends to Database::makeList() to check if 'NULL' is present in array while
building IN clause. Presently a NULL in array intended to build IN clause, is
treated as a usual value. This creates
problem:https://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_in
Therefore null is appended at the end of the IN clause as " $field IS NULL"
rather than within the IN clause.
DatabaseSQLTest.php: Some test cases added for the modified behaviour.
Bug: T50853
Change-Id: Ic255c37e9702fd44d8173027ab8036ddc48f9d2e
|
|
|
|
| |
Change-Id: I5a5be6769c7d0e5f2a97d3fbefd62df3c59f0716
|
|
|
|
| |
Change-Id: I5f4bc0df8183cf338ff45cacfc7279c2cd38ee04
|
|
|
|
| |
Change-Id: I3ce92463d485a0fb23e464e9a8059330f32d79af
|
|
|
|
| |
Change-Id: I010ff5ce7afd85c7f9d528a98f2448547874b8b3
|
|
|
|
|
|
|
|
| |
Follow up Id7fc6652
Pass function name to begin/rollback/commit
Use __METHOD__ as default param (see I86cbdeab)
Change-Id: I9eb326c035d4a604db5b3492f090d8dd9d21c920
|
|
|
|
| |
Change-Id: I16a9b42651f1cfb1a70dffbb67b7b83dfeb90d03
|
|
|
|
|
|
|
| |
Created a DatabaseTestHelper class, which extends DatabaseBase and
implements STUBs for the interface methods and abstract methods
Change-Id: I9965b3604e78b2722077a35a7b4ce62a5bcb370e
|
|
|
|
|
|
| |
4 of n.
Change-Id: I23e2409ce9eff14c3434154d236de83c93a92440
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix almost all occurences of the following sniffs:
Generic.CodeAnalysis.UselessOverridingMethod.Found
Generic.Formatting.NoSpaceAfterCast.SpaceFound
Generic.Functions.FunctionCallArgumentSpacing.SpaceBeforeComma
Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine
Generic.PHP.LowerCaseConstant.Found
PSR2.Classes.PropertyDeclaration.ScopeMissing
PSR2.Files.EndFileNewline.TooMany
PSR2.Methods.MethodDeclaration.StaticBeforeVisibility
Change-Id: I96aacef5bafe5a2bca659744fba1380999cfc37d
|
|
|
|
|
|
|
|
| |
1) DatabaseSQLTest::testMediaWikiTestCaseParentSetupCalled
DatabaseSQLTest::setUp() must call parent::setUp()
Failed asserting that an array has the key 'setUp'.
Change-Id: I6aa5cb09999e0cee9b36fedd9193cb5aa08914ad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit depends on the introduction of
MediaWikiTestCase::setMwGlobals in change Iccf6ea81f4.
Various tests already set their globals, but forgot to restore
them afterwards, or forgot to call the parent setUp, tearDown...
Either way they won't have to anymore with setMwGlobals.
Consistent use of function characteristics:
* protected function setUp
* protected function tearDown
* public static function (provide..)
(Matching the function signature with PHPUnit/Framework/TestCase.php)
Replaces:
* public function (setUp|tearDown)\(
* protected function $1(
* \tfunction (setUp|tearDown)\(
* \tprotected function $1(
* \tfunction (data|provide)\(
* \tpublic static function $1\(
Also renamed a few "data#", "provider#" and "provides#" functions
to "provide#" for consistency. This also removes confusion where
the /media tests had a few private methods called dataFile(),
which were sometimes expected to be data providers.
Fixes:
TimestampTest often failed due to a previous test setting a
different language (it tests "1 hour ago" so need to make sure
it is set to English).
MWNamespaceTest became a lot cleaner now that it executes with
a known context. Though the now-redundant code that was removed
didn't work anyway because wgContentNamespaces isn't keyed by
namespace id, it had them was values...
FileBackendTest:
* Fixed: "PHP Fatal: Using $this when not in object context"
HttpTest
* Added comment about:
"PHP Fatal: Call to protected MWHttpRequest::__construct()"
(too much unrelated code to fix in this commit)
ExternalStoreTest
* Add an assertTrue as well, without it the test is useless
because regardless of whether wgExternalStores is true or false
it only uses it if it is an array.
Change-Id: I9d2b148e57bada64afeb7d5a99bec0e58f8e1561
|
|
|
|
|
|
| |
Current no use in core.
Change-Id: I8ed86c8238146285dd1caed4d8586c877cbecf44
|
|
|
|
|
|
|
| |
Change the one use of that method to use the new syntax.
Add some tests.
Change-Id: I9ad4e5b5e97d1d13cfd858105167ca5d20ffaf83
|
|
This introduce the syntax from aliased table names for aliased field
names into the abstract database layer:
array( 'alias' => 'field' ) gives 'field AS alias'
This patch also includes changes to query pages, api and some more
places to show, how the new syntax looks in "production".
This allow us to remove the "AS" for Non-PostgreSQL databases, if we
want that.
Change-Id: I5f0de1c2f29092c173aec3de93ffdef436799e8d
|