In the age when we require PHP 5.5, pretending that mbstring emulation
is not slow and silly is silly.
Bug: T129435
Change-Id: Ic8235c9da9a926df63ec7388900c44eab454eebe
Specifically in the savepoint part of the code, where a failed query inside the
savepoint gives a non-false reply to pg_last_error by the time we call it,
which then leads to us doing 'RELEASE' instead of 'ROLLBACK TO', and causes
all sorts of mayhem.
The whole system needs a little cleanup, but this is an important bandaid.
Change-Id: I0223a3599816db5650f45863400e6194468d4361
Otherwise, transactions might be committed without cooperative
locks that were supposed to be present. This is similar to the
logic of not auto-reconnecting if a transaction was started to
avoid committing incomplete changes.
Change-Id: Ia7bc6b188bb5ee53a5bf7c5a30718bc7c4dd0ba9
* Simplify the debug log call and use queries group
* Remove $wgDebugDumpSqlLength, as profiler output
already has shortened query strings (one can use
profiling without DBO_DEBUG)
* Removed $wgDebugDBTransactions as BEGIN/COMMIT already show
* Removed PostgresTransactionState as it was only used for
$wgDebugDBTransactions handling
* This cuts down on lots of global variable usage
Change-Id: I185adb1694441d074dea965960429b4910727620
This gives static method callers the option
to use methods like Database::factory() instead
of having to use the uglier DatabaseBase::factory().
Change-Id: I61800626b71ad2803a897df060059dbaf8778679
wfSuppressWarnings() and wfRestoreWarnings() were split out into a
separate library. All usages in core were replaced with the new
functions, and the wf* global functions are marked as deprecated.
Additionally, some uses of @ were replaced due to composer's autoloader
being loaded even earlier.
Ie1234f8c12693408de9b94bf6f84480a90bd4f8e adds the library to
mediawiki/vendor.
Bug: T100923
Change-Id: I5c35079a0a656180852be0ae6b1262d40f6534c4
Doc comments state that these methods return ints. In order to ensure
that, values must be cast to int before they are returned.
With respect to selectRowCount(), follows-up 65f81d2843.
Change-Id: I108221ce4ad1b5b103b015fe875de54e04781741
The current API for Database::encodeBlob/Database::addQuotes requires
the code that is outputting binary data to have a database handle, so
that it may call Database::encodeBlob to get either a plain string or
a Blob object back. All database implementations other than MySQL
return a Blob object from Database::encodeBlob.
This is a rather inconvenient API, it tightly couples the creation of
binary data with the Database object unnecessarily. If all database
objects accept a Blob via Database::addQuotes then code can simply
wrap its arguments in Blob and know that any database it ends up at
will be properly handled.
This patch changes the default implementation of Database::addQuotes
to recognize a Blob object was passed in, and use Blob::fetch to turn
it back into a string. Database implementations other than MySQL all
handle this Blob object already. The postgresql implementation had
to be adjusted slightly. Now when it sees a Blob object that it did
not create it will encode that appropriately.
Bug: 72367
Change-Id: I12fb4bd339be19137fffba2e47a70741382f6a8c
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling
Change-Id: I7b65fe04db431342cc58b469dc48f41a50c4e891
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif
Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
MySQL automatically orders by the GROUP BY columns if no ORDER BY
is specified. You can countermand this by specifying
ORDER BY NULL, which can give speed improvements in some cases,
for example if the GROUP BY was implemented by hashing then a
sort is unneeded and wastes time.
PostgreSQL does not tolerate the ORDER BY NULL syntax,
and does not need an analgous hint because it never does
gratuitious sorting of the nature just discussed.
This patch makes PostgreSQL ignore the ORDER BY NULL clause.
It might be a better approach to find a way to add this clause
specifically to MySQL, rather than to drop it specifically from
other database engines.
SQLite seems to tolerate the MySQL syntax. Oracle and MSSQL
were not evaluated.
Bug: 65794
Change-Id: Ia9666136edd25e1e0d0728a8b28a92e44d00abc6
SQL errors would issue a rollback, even when it was
not actually in a transactions. Doing so would cause
another error to be reported. This could obscure the
original error, particularly during unit tests.
Fix this by not rolling back when not in a transaction.
Bug: 58095
Change-Id: Ib5220e37dd6c364feee6b7f8e7ecbdae2a2e0ba1
PostgreSQL is usually not used with table name prefixes,
and some of the PostgreSQL-specific code took the
shortcut of not dealing with prefixes. However, the PHPUnit
tests do force a prefix to be used, exposing this limitation.
Make PostgreSQL code add the prefix to table names being used
in FOR UPDATE OF clause.
This fixes 13 of the 17 PostgreSQL unit tests errors against
git HEAD:
EditPageTest::testAutoMerge with data set #1 ('Elmo', 'one
EditPageTest::testAutoMerge with data set #2 ('Elmo', 'Intro
EditPageTest::testAutoMerge with data set #3 ('Adam', 'one
EditPageTest::testAutoMerge with data set #4 ('Adam', 'one
EditPageTest::testAutoMerge with data set #5 ('Adam', 'Intro
EditPageTest::testAutoMerge with data set #6 ('Berta', 'one
EditPageTest::testAutoMerge with data set #7 ('Berta', 'one
EditPageTest::testAutoMerge with data set #8 ('Berta', 'Intro
WikiPageTest::testDoEdit
WikiPageTest::testDoEditContent
WikiPageTest::testDoRollback
WikiPageTest::testDoRollbackFailureSameContent
WikiPageTest::testExists
The change also applies to 1.22.6 and fixes several unit tests
errors there.
Change-Id: I054690f49e250cadd2dc2a6d9e20dea879d896b6
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.
Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
The fix for 47055 introduced a fatal error when running rebuildall.php. This
is a workaround suggested by gebhkla on Bugzilla (idle for 10+ days). It just
checks to make sure $options is actually an array before calling array_search
on it.
Bug: 60094
Change-Id: Ib54420b5a749c60b82a4757a9f5fa511f48fdb72
Probably the fakeMaster/fakeSlave stuff was originally intended to be
generic, but the existing code in Database.php is making some very
MySQL-specific assumptions. So let's evict it from Database.php (except
for the minimal support functions) and put it in DatabaseMysqlBase where
it makes more sense.
This also takes care of fixing the breakage described in I5d2a1696 by
reverting Id6268193 and the problematic bit of I364e192e (again).
Change-Id: I3dc6ca216bf2c2f07d3090e86f2539292e1fa86b
This gets the web installer working without the mysql or mysqli
PHP extension, which is not needed for other database systems.
* Avoid "lego" construction: put link text directly in the messages,
which because the messages are parsed as wikitext, is easy to do.
* Put URLs in separate, ignored messages to avoid duplication in
Database*::getSoftwareLink().
* Because I had to touch a MySQL-related i18n message, I figured
this would be a good time to address bug 28281 (regarding MySQL
forks and Special:Version).
* Other miscellaneous message changes, such as recommending the
mysqli PHP extension over the old, deprecated mysql extension.
Bug: 28281
Bug: 58167
Change-Id: I6dbc9d32c8c2d8f233a67d574229b80444885aea
* Add used by not declared class properties.
* Rename private $numeric_version to $numericVersion.
* Update some documentation.
Change-Id: I233001e732724146fcee04f0e358a9563c9e9fd4
Postgresql cannot handle FOR UPDATE with outer joins, but it allows
specifying which tables can be locked. This changes DatabasePostgresql
to render proper FOR UPDATE statements that only include the main
table and any tables in inner joins.
Bug: 47055
Change-Id: I1ac587ac39f448b9e7f4befb44826b43044ad6f0