Commit graph

55 commits

Author SHA1 Message Date
Kunal Mehta
f6e5079a69 Use mediawiki/at-ease library for suppressing warnings
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
2015-06-11 18:49:29 +00:00
jenkins-bot
661f171575 Merge "Added $wgJobSerialCommitThreshold setting" 2015-04-27 08:29:46 +00:00
Aaron Schulz
7c821caef5 Added $wgJobSerialCommitThreshold setting
* This is used to avoid lag by certain jobs

Bug: T95501
Change-Id: Id707c9a840fa23d56407e03aaae4e25149a1f906
2015-04-24 11:38:16 -07:00
Aaron Schulz
fe72859716 Allow setting MySQL session variables via config
Change-Id: I39c7e0f5ffe53a3fb15da489f4dddc36af99a4b3
2015-04-24 11:07:02 -07:00
umherirrender
b21bf82bb1 Fixed detection of unsigned mysql column in updater
MediaWiki running with an old mysql or php without mysqli cannot
use the newly added flags property of Database::fieldInfo.
For backward compatibility add the missing properties using the flags
property to the result of Database::fieldInfo.

Added missing unsigned, numeric, blob and zerofill properties to the
MysqlField using flags in mysqli.
The missing fields in mysqli are taken from
http://php.net/manual/en/function.mysql-fetch-field.php

Follow-Up: I641dc1fad0a5bb14815f55e0357243a562fd672b
Change-Id: I1da904df72f8af7725fc7ff94121ef85b18a36f8
2015-03-05 18:25:50 +00:00
umherirrender
a086557ab8 [schema] Make column user_newtalk.user_id an unsigned int
The primary key of the user table is an unsigned int, the column
user_newtalk.user_id refer the id and should have the same typ to store
the same values as the user table does.

No pre-deployment activity necessary; no need to sync deployment
and merge; can be done at any time (now or later)

Bug: T77005
Change-Id: I641dc1fad0a5bb14815f55e0357243a562fd672b
2015-02-17 17:27:54 +00:00
Kevin Israel
5f3957498b Database: Cast to int in estimateRowCount(), selectRowCount()
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
2015-02-06 05:03:45 -05:00
Aaron Schulz
c73cd2ef7c Always set group_concat_max_len to avoid awful truncation gotcha
Change-Id: I1000412a0c58a9d76ea25f6ecc37a3a464aa430a
2015-01-13 17:24:16 -08:00
Ricordisamoa
2ae155da52 Fix phpcs errors in includes/
Mostly Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines

Change-Id: I678b2f0902f11cd1dfa1611b9da24e7237df9122
2015-01-08 20:15:07 +01:00
Aaron Schulz
4ff8136807 Removed remaining profile calls
Change-Id: I31c81c78715048004fc8fca0f27d09c1fa71c118
2015-01-08 02:49:33 -08:00
Chad Horohoe
aa21e125a3 Remove obvious function-level profiling
Xhprof generates this data now. Custom profiling of various
sub-function units are kept.

Calls to profiler represented about 3% of page execution
time on Special:BlankPage (1.5% in/out); after this change
it's down to about 0.98% of page execution time.

Change-Id: Id9a1dc9d8f80bbd52e42226b724a1e1213d07af7
2015-01-07 11:14:24 -08:00
Aaron Schulz
6ade2968ae Avoid blocking on ChronologyProtecter check in LoadBalancer::getConnection()
Change-Id: Iccf324d87d117972cc6321b2abf1ff101d98fa65
2014-12-12 02:25:04 +00:00
Bryan Davis
2792ea9783 Add logging context to database logs
* Add optional $context parameter to wfDebug, wfDebugLog, wfLogDBError
  and wfErrorLog that will be passed to MWLogger.
* Add support for PSR-3 style log message parameter interpolation in
  MWLoggerLegacyLogger.
* Add context information to wfLogDBError calls made from DatabaseBase,
  DatabaseMysqlBase and LoadBalancer instances.
* Deprecate wfDebugTimer() which now appears to be unused.

Change-Id: Ic90d593d00a2b0b5b80ed205908cbe624042603c
2014-11-19 17:59:55 +00:00
Kevin Israel
b824271351 DatabaseMysqlBase: Use VERSION() rather than server_info
I noticed enwiki's Special:Version page was reporting the version
of MariaDB 10 as "5.5.5-10.0.11-MariaDB-log" rather than just
"10.0.11-MariaDB-log". This change should fix that.

Change-Id: I6bf7e27e88014f70594b33d089636b09b6c97527
2014-09-20 06:16:09 -04:00
umherirrender
b409008ca5 Remove wrong @return from doc blocks
These functions actually does not return anything, so the @return is
wrong here. '@return void' is ignored.

Change-Id: I11495ee05b943c16c1c4715d617c8b50de22276c
2014-08-25 13:50:05 +00:00
umherirrender
02dc9da399 Cleanup some docs (includes/[a-d])
- 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
2014-07-24 19:42:45 +02:00
umherirrender
3b2236e40f Remove DatabaseMysqlBase::getLagFromProcesslist() (deprecated 1.19)
Change-Id: I7dfdd943abf1c94a35e2401f92208c19683dc200
2014-06-25 19:54:15 +02:00
umherirrender
23bb3d1cb4 Follow-Ups to "Fixed some @params documentation"
Fix of inline comments of the following patch sets:
Follow-Up: I0056b4a8df243cfc0c5f25378de48f7a35170aca
Follow-Up: I7f605aa9e117b5fd80d9b1440864fe526d2b14a5
Follow-Up: I3622f216a2ca8ac1b5e51892be9f98665f65bc36
Follow-Up: I6627ba0e76d3577c40bf2473e0f78a5ad7368634
Follow-Up: Id75b5ecf648ca50f955b3bde3307c82c4366b102
Follow-Up: I4ca5231119f33039d91da3b57a41cd40719a576b

Change-Id: Id9bbe84b2820e9db44af5783411e955f55f643d4
2014-04-23 13:39:49 +02:00
umherirrender
f5f1e38b9a Fixed some @params documentation (includes/[db|installer])
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
2014-04-19 13:55:27 +02:00
Bartosz Dziewoński
59002d8935 Consistently use '@deprecated since <version>'
Variants included 'in <version>', 'as of <version>' and just the
version number.

Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.

Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
2014-04-15 22:18:19 +02:00
jenkins-bot
d1f8fb08d4 Merge "Automatically add a new line at the end of wfLogDBError()" 2014-03-24 18:45:47 +00:00
Alexandre Emsenhuber
59c42b90d5 Automatically add a new line at the end of wfLogDBError()
I found two calls to wfLogDBError() that do not add a new line
at the end of the message. So instead of adding them to that
entries, I changed wfLogDBError() to automatically put it on
icoming messages; as for wfDebugLog().

Change-Id: Id014b5827a0aeef6873ebf08d78f0a3d7581d63b
2014-03-23 10:30:59 +01:00
Kevin Israel
f67543df06 DatabaseMysqlBase: Remove broken check for Percona Server
Percona Server does not include its name in its version suffix.
It would be possible to check for precompiled versions of the
product using the version_comment variable, though not third-
party builds from its source code (which are merely indicated
as "Source distribution").

Given that even Percona itself does not distinguish between
Percona Server and MySQL in their version of the mysql command-
line client, I have chosen simply to remove the broken check.

I have also made the check for MariaDB consistent with that
in its version of mysql (by also checking for the old suffix
"-maria-").

Follows-up 0eab1ace67.

Change-Id: I62c3949b775a38f28f09568ebb28af2adb9be69b
2014-03-21 20:17:08 -04:00
umherirrender
4c95d41c76 Standardize is_array check in Database::upsert
Change-Id: I81c7ff2cf6a1f5fe0a2a6cdad1dd26d746e17c10
2014-02-03 21:42:04 +01:00
Brad Jorsch
d5f52588a2 Move MySQL-specific fakeMaster/fakeSlave stuff to DatabaseMysqlBase
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
2014-01-13 15:00:27 -05:00
jenkins-bot
5330243416 Merge "WebInstaller: Don't call getSoftwareLink()" 2014-01-11 21:55:50 +00:00
jenkins-bot
9a3b6e5639 Merge "Return correct values and types" 2014-01-10 12:25:23 +00:00
Kevin Israel
0eab1ace67 WebInstaller: Don't call getSoftwareLink()
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
2014-01-10 03:38:44 -05:00
Siebrand Mazeland
aa4d6e1f2e Update formatting
Change-Id: I27e43c19906edc732b4976b8426ed34bad63622b
2014-01-06 21:04:34 +00:00
Siebrand Mazeland
985fc5226d Specify DBMasterPos::getMasterPos()
Change-Id: Id6268193d08737e2599ec84496527b3be348dfda
2014-01-06 20:02:20 +01:00
Siebrand Mazeland
687319540e Return correct values and types
Change-Id: Ia069856160aae1ab937daee2da0d6800fe89698f
2014-01-06 18:47:58 +00:00
Siebrand Mazeland
e22a70a103 Update documentation for database related classes
Change-Id: I364e192e2624f89a91dcb19e371ce3412142a95f
2014-01-06 19:45:40 +01:00
umherirrender
8a2e1a4c88 Fix doc for Database::upsert
One @params too much

Change-Id: I8cea6228587574ff90060d46b4430b2348a68973
2014-01-03 21:35:21 +01:00
jenkins-bot
3ebfa0acfc Merge "Revert "Declare visibility for class properties in MySQLMasterPos"" 2014-01-03 18:12:02 +00:00
Anomie
a399020c6a Revert "Declare visibility for class properties in MySQLMasterPos"
These members are accessed from DatabaseMysqlBase::masterPosWait and
DatabaseBase::masterPosWait, causing errors if the wiki has slave
databases or has fakeSlaveLag set.

This reverts commit d0325927d4.

Change-Id: I563bde457274dad2f254145426376b275b597e2a
2014-01-03 17:18:55 +00:00
jenkins-bot
923a6e62b8 Merge "Declare visibility for class properties in MySQLMasterPos" 2014-01-03 00:01:39 +00:00
Reedy
f239598cb1 void methods don't return anything. Especially when they always throw an exception
Change-Id: I6c959b44b64fdc38e248e0000a6594c12a10b6b4
2014-01-02 16:21:59 +00:00
Aaron Schulz
fbe350750b With mysqli, avoid setting the charset twice
* This uses MYSQLI_SET_CHARSET_NAME to set the charset to utf8/binary
* This replaces a live WMF hack to skip the extra round trip

Change-Id: I1718e013fcdc95163d111d460f0dd6d2190a99b1
2013-12-30 23:16:59 +00:00
Siebrand Mazeland
d0325927d4 Declare visibility for class properties in MySQLMasterPos
Change-Id: I020524274261144212901bfc8dfe094f03e4721c
2013-12-27 09:24:59 +00:00
Kevin Israel
bc06a9b8b7 Abstract out mysql_field_type() call from DatabaseBase
DatabaseMysqlBase::fieldType() is used in the maintenance script
convertLinks.php for upgrading from MediaWiki 1.2 or earlier. This
script was failing when the mysqli extension was enabled.

Follows-up b1cc3511fd, b2d64432ee, and 00299ecb95.

Change-Id: I5d888f4dd344ecba15506023d35f6d2d6e24cfd8
2013-12-15 18:40:50 +00:00
Platonides
73fd2d2497 Add missing wfProfileOut()s
Change-Id: I072224fdeda25f8fe8a76338e7e767ab4c0619f0
2013-11-23 19:15:07 +01:00
Aaron Schulz
d81f323f32 Avoiding implicit transactions when applying
* Some callers get the DB and flip DBO_TRX off, which does not
  help much if simply connecting to the DB starts a transaction.

Change-Id: I2bc90a1cdeade13ccb546db1183ab08f25156da1
2013-11-21 15:54:06 -08:00
Siebrand Mazeland
b547395796 Break long lines and formatting updates for includes/db/
Fix all line length related CodeSniffer warnings.

Change-Id: Id0fd8f4c7276185f51489659ee3cd06962fbc16d
2013-11-21 16:43:40 +00:00
Siebrand Mazeland
1e10dcd3aa Update formatting on database-related classes
Change-Id: I91f83e28ae25f80ba9e36c612f1ad050ffa1573c
2013-11-21 16:39:38 +00:00
umherirrender
f153998317 Fixed spacing
- Removed double spaces
- Added space after if/switch/foreach
- Removed space on elseif
- Added space around parentheses
- Added newline at end of file
- Removed space before semicolon at end of line

Change-Id: Id40b87e04786c6111e6686d7f7eea1e588bdf37d
2013-11-19 19:03:54 +01:00
Alexandre Emsenhuber
a222905098 Use the native set_charset() method if available instead of SET NAMES
According to the PHP manual, it is the recommended way to set the charset.

- mysql extension has it for MySQL >= 5.0.7
- mysqli extension has it for MySQL >= 5.0.6
or if using mysqlnd.

Change-Id: I8cd2f97fcad4b045c6f99ff894254847b13c6878
2013-11-16 07:57:52 +00:00
daniel
40f6d8546c Make sure we always restore the error handler.
Change-Id: I27f5d11ea27f783eda71c2bfdba7e70695f5d53c
2013-11-15 16:57:34 +00:00
AlephNull
e9d53667f4 MySQL method to find out view + fix fatal in tests
We were missing a method to list out views defined in a database. This
patch adds in MysqlBase::isView() and MysqlBse::listViews().

Since listViews() cache its result in DatabaseBase::$allViews, we also
introduce a final DatabaseBase::clearViewsCache() to let us clear the
per process cache.

Finally, fixed fatal error when duplicating VIEWs in MySQL.

bug: 43571
Change-Id: I8650baa4b721fe69ea3e1d557dd76745c0c7754e
2013-11-07 09:43:59 +00:00
Tim Starling
00299ecb95 Resubmit "Add support for mysqli extension"
This reverts commit 1d7e12179d.

Change-Id: Id1a3fc34e94006b880f58de83e5e7c70b21d26ed
2013-10-17 01:35:28 +00:00
Tim Starling
1d7e12179d Revert "Add support for mysqli extension"
Throws exception unconditionally, installer support is totally broken.

This reverts commit b2d64432ee.

Change-Id: I2edb78440806754c42d48c5da2ff74b4cb40fa2d
2013-10-16 23:49:24 +00:00