Commit graph

1232 commits

Author SHA1 Message Date
jenkins-bot
d34a6ca677 Merge "Fix some stuttering in comments and documentation" 2014-12-17 22:28:27 +00:00
Ricordisamoa
12dec5d85d Fix some stuttering in comments and documentation
Change-Id: I9c0088b9aab37335203cad45a1d6fa8ac3f43321
2014-12-17 19:44:10 +00:00
Bryan Davis
6aa3c4fe84 Logging related comment updates
* Pretty up some logging related comments.
* Send wfDebugLog messages to logger at info level

Change-Id: I97b8629095e8d6168dbeb791dfb5e7753d281cbe
2014-12-16 17:12:23 -07:00
Bryan Davis
6a8c686c7a Deprecate wfErrorLog
When a logging service other than MWLoggerLegacySpi is used, the
behavior of wfErrorLog is not guaranteed.

Change-Id: I8543bfd556aa752665f7a3daa855d3c2f7fc8956
2014-12-15 16:26:03 -07:00
Kunal Mehta
e27ae6b5ec Convert more wfRunHooks() --> Hooks::run()
Change-Id: I1b1e3cb6871721fc05dda881a8020c9a5d30a514
2014-12-12 14:47:31 -08:00
Bartosz Dziewoński
c819a558fe GlobalFunctions: Fix 'Undefined index' notice in wfBacktrace
Notice: Undefined index: line in
/var/www/wiki/includes/GlobalFunctions.php on line 1840

Caused by fc2e6df64f, previous versions
used isset here.

Change-Id: Ie9434f09e0905346ace19909fb316d47c75e0440
2014-12-12 21:35:36 +00:00
Ricordisamoa
fc5fd5c37a Typo fixes and non-code tweaks
Skipped replacements:
* prefered → preferred
* prolly → probably

Skipped files:
* resources/lib/jquery.ui/jquery.ui.mouse.js
* resources/lib/jquery/jquery.form.js

Change-Id: Ib7923f362ddfca1b892bf5d601785d6b5aa5d44c
2014-12-12 18:31:15 +00:00
jenkins-bot
d8ab903223 Merge "Cleaned up LoadBalancer::getConnection" 2014-12-12 02:47:39 +00:00
Aaron Schulz
e369f66d00 Replace wfRunHooks calls with direct Hooks::run calls
* This avoids the overhead of an extra function call

Change-Id: I8ee996f237fd111873ab51965bded3d91e61e4dd
2014-12-10 12:26:59 -08:00
Aaron Schulz
52e6121447 Cleaned up LoadBalancer::getConnection
* It will also no longer call getReaderIndex( false, ... ) twice
* Removed various related ampersands

Change-Id: Ia79e2007dbf84e7437f9439aa6371333aa3e1b23
2014-12-10 00:27:48 -08:00
Chad Horohoe
52f3b13312 Remove Profiler::isStub()
Just check for ProfilerStub directly.

Change-Id: I503916599f182df4206da5282193ae6ec9324ee6
2014-12-03 20:19:56 -08:00
Bryan Davis
9be737caef Decorate deprecated functions with wfDeprecated()
Change-Id: Iaa7d11a9fdd1c68dc7ff1b3138fe8c9ba229cc69
2014-11-24 16:41:10 -07: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
Bryan Davis
0b91f622a3 Prettier wfLogProfilingData() log message
Make the profiler logging output introduced in Iae11e1e a little nicer.
Stop adding the Profiler::getRawData() information and add the URL and
textual report to the default log message. When testing with a Monolog
logger and Logstash the getRawData output from the Xhprof profiler was
found to be too big to be usable. The default message output was found
to be less informative than desirable when a PSR-3 logger other than
MWLoggerLegacyLogger was used. MWLoggerLegacyLogger implements special
backwards compatible formatting for the profileoutput channel that will
not be effected by this change.

Change-Id: Id326aed4f72a3489fac30661c101ac3bb3af2530
2014-11-17 10:41:49 -07:00
Bartosz Dziewoński
3e85dfb8ad Standardize indentation of multiline 'if'/'elseif' conditions
Always indent the continuation one level deeper, and always place the
closing parenthesis on the next line, per coding conventions.
https://www.mediawiki.org/wiki/Manual:Coding_conventions#Indenting_and_alignment
https://www.mediawiki.org/wiki/Manual:Coding_conventions#Line_continuation

Regexp used: (\t+)(if|while|\} elseif|foreach).+(?<![;}])\n\1\S

Also:
* Change to just one line if line length stays under 100 characters.
* Add "// Do nothing" comment in empty 'if' bodies.
* Change '#' comments to '//' comments near affected code.

Change-Id: I4f62658fddb5a0ed18bbf9b2231cd794683d6402
2014-11-17 15:33:34 +00:00
Aaron Schulz
fc2e6df64f Added wfLogDBError() call to LoadBalancer::doWait()
Change-Id: Ida0970754a2a7287c129bb5ad633765dab97133a
2014-11-13 21:34:54 +00:00
umherirrender
6f50f1bee5 Remove unused global in wfLogProfilingData
Change-Id: I873efb8967cd17c89de5b32fcde6c738eefa03e6
2014-11-07 14:33:24 +00:00
jenkins-bot
fd92d3cd5f Merge "wfDebugLog(): remove unused global" 2014-11-04 21:17:30 +00:00
jenkins-bot
19c2a08267 Merge "Use MWLogger logging for wfLogProfilingData" 2014-11-04 21:17:19 +00:00
Chad Horohoe
beea060441 wfDebugLog(): remove unused global
Change-Id: I336b022c7c87550729ca4e97b0960ba6adec7bb5
2014-11-04 13:06:10 -08:00
jenkins-bot
cc3b1d1e2c Merge "Fixed spacing" 2014-10-30 20:09:54 +00:00
Kunal Mehta
0e17070d40 Require PHP >= 5.3.3
Bug: T839
Change-Id: Iac827ef8505ff0653a40e45d759b0f79619351ee
2014-10-30 10:10:52 -07:00
umherirrender
2a7c95acda Fixed spacing
- Changed spaces to tabs for indentation
- space after 'function'/'if'
- Added/Removed space after parenthesis/brackets/end of line
- Removed space after cast

Change-Id: I0e8e6a19b84b5e1308b632a0266cb78f688494ee
2014-10-30 17:50:19 +01:00
Aaron Schulz
5e5bf769fe Fixed possible db error log spam when cluster=* in wfWaitForSlaves()
Change-Id: Idd385cddb0fa9f56bddc46d41ae584ca65bc45ed
2014-10-29 16:36:55 -07:00
Bryan Davis
3328bd9961 Use MWLogger logging for wfLogProfilingData
Output structured profiling report data from wfLogProfilingData using
MWLogger.

Requires Ie667944, I5c82299, and I1e5596d.

Change-Id: Iae11e1e4fe970ada74136f0e969dc624c586ce17
2014-10-29 23:04:09 +00:00
Bryan Davis
28a7ce420b Use MWLogger logging for legacy logging methods
Send wfDebug, wfDebugLog, wfLogDBError and wfLogDBError log messages to
the new MWLogger PSR-3 logger subsystem. Compatibility with the historic
logging operations of wfLogDBError are provided by MWLoggerLegacyLogger
and the MWLoggerLegacySpi logger factory.

Requires the MWLogger system introduced in I5c82299 and the Composer
managed libraries from Ie667944.

Change-Id: I1e5596d590144fbfdfd5f18bc42cf1ef0dbcac12
2014-10-29 11:55:08 -07:00
Aaron Schulz
dadaf48a39 Optimized wfWaitForSlaves() to get the master positions for all LBs first
Change-Id: I4a4aa6a3f68ace85dcbfb73e982a16c62e21e6ed
2014-10-22 10:56:36 -07:00
Aaron Schulz
91733632d7 Fixed loop in wfWaitForSlaves()
* The "break" statements should obviously be "continue" here.

Change-Id: Ia4a9bad77a9f512153aee6b77443104e71f5cd56
2014-10-22 10:32:48 -07:00
Aaron Schulz
6b2177bdc3 Made wfWaitForSlaves() support waiting on all clusters as needed
Change-Id: Icc45ae26fee655597ae1c437b5f774d7e84f643a
2014-10-21 14:35:42 -07:00
Yuri Astrakhan
df43a26e0a Minor doc fix for wfShellExecWithStderr()
Change-Id: I9d5fe442c6e85d61c1cdec8c42caab06b37856b1
2014-10-08 14:12:11 -04:00
Kevin Israel
4620e3b862 hash_equals(): Avoid division by zero when $known_string is empty
Per Tim Starling's review of Icb239471, reverted back to the version of
the function from Patch Set 1 of Iece006ec, which did not have the bug.
This version does not attempt to minimize the inevitable leakage of the
string's length.

Also revised the doc comment to explain more effectively what the problem
with a normal (===) string comparison is for the use cases of this function.

Follows-up b9e1d5f5c0.

Change-Id: I1b347e69b39af3d7d8ba6673af63f1a616befbdf
2014-10-07 06:42:12 +00:00
Anomie
8f0ed5f5a7 Revert "Replace wfMsgReplaceArgs by RawMessage"
This was merged too quickly, has several issues.

This reverts commit 6abefb274f.

Change-Id: Ibf3e464fa9eb534d599274dd9262a30d5a6a6948
2014-09-29 17:41:56 +00:00
umherirrender
6abefb274f Replace wfMsgReplaceArgs by RawMessage
The replace of $n params can also be done using the Message class. In
case there are no message keys, the RawMessage class is used.

Deprecated wfMsgReplaceArgs, but added no warning, because it is used in
some extensions and from deprecated functions

Change-Id: I62091b09e4490e59ed7258566e0ddf2f8ee799d2
2014-09-29 19:23:19 +02:00
Aaron Schulz
a55544180b Slave lag check tweaks to JobRunner
* Do not block forever, but wait up to 10 seconds. Likewise,
  check the lag times in memcached on startup. This at least
  lets runners avoid lagged wikis but still work on others.
* Made a few small related documentation and code cleanups.

Change-Id: Ic1339bab54cba6b6cbea7d97a80ff87c7c5c87af
2014-09-24 00:59:55 +00:00
Brad Jorsch
0011f2a77f Update wfMessage doc
The Message class constructor has long supported passing an array of
keys for fallback messages, and wfMessage passes the $keys parameter
through unchanged.

And since this is already in use in core, we may as well document it.

Change-Id: I8f7f9ade87e855300650b2e7e31b9303daa96ac5
2014-09-17 06:02:24 +00:00
Marius Hoch
fbc7206444 Prevent "Notice: Undefined index" in wfDiff
Change-Id: I4cc7d10021a114a2035dd2d9274c2340242800cb
2014-09-15 03:52:31 +02:00
Kevin Israel
5957856c46 wfBaseConvert(): Work around PHP Bug #50175
Before php/php-src@834daa455b, PHP's gmp_init() function would try
to autodetect hex and binary numbers even when a base was explicitly
specified[1], so the results for some base-36 numbers having leading
zeros could be incorrect. Work around this bug by trimming off any
leading zeros before calling gmp_init().

[1]: https://bugs.php.net/bug.php?id=50175

Bug: 69249
Change-Id: I5f5458c1a1195f55fa12904c103da6ea7558010a
2014-09-02 16:02:27 -04:00
umherirrender
51adb81e6e Add some @see to doc blocks
This avoids repeating the @params for the functions

Change-Id: Ie1f4488a0a7aa30ab128b9ea7ff6f3af12a88884
2014-08-24 11:19:32 +02:00
umherirrender
6b4c44c2db Add missing @param to function docs
Change-Id: Ib26407bc55dff7969d8a3b1e2ae51751b202d8fb
2014-08-18 16:24:59 +00:00
Aaron Schulz
cafcb6b225 Vastly increase how long wfWaitForSlaves() can block in CLI mode
* All maintenance scripts pretty much assumed this behavior, but it
  was not actually the case. This can avoid some massive lag problems.

Change-Id: I5894409d6abade16afd8144f6689c2aff3fa7327
2014-07-31 23:28:11 -07:00
withoutaname
aa21cbc5fb Remove global functions deprecated since 1.22
Specifically functions wfArrayLookup(), wfArrayMerge(),
wfDebugDieBacktrace() and wfTime() from GlobalFunctions.php.

Change-Id: I9339cb2d8da41953a0e2a051452298f480256ebc
2014-07-31 00:25:05 -07:00
umherirrender
1c68a1ee86 Cleanup some docs (includes/*.php)
- 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: I783e4dbfe5f6f98b32b9a03ccf6439e13e132bcc
2014-07-24 19:42:24 +02:00
umherirrender
4ee680a8b3 Fixed spacing
- Removed spaces after not operator (!)
- Removed spaces inside array index
- use tab as indent instead of spaces
- Add newline at end of file
- Removed spaces after casts

Change-Id: I9ba17c4385fcb43d38998d45f89cf42952bc791b
2014-07-24 11:53:04 +02:00
Yuri Astrakhan
d1d6cb7bc3 Allow wfShellExec() to use an array as a command prompt
Command line may now be given as an array, where each value
will be escaped and glued together with a space.

Change-Id: I9237ec1fccc60c0c4a360562db1c050a3be7e6a3
2014-07-24 05:00:37 +00:00
Max Semenik
9f522988b8 Fix race condition in wfShellExec()
Especially when executing commands that return a relatively lot of data in stdout
quickly, proc_get_status() may return that command has terminated before everything
has been read from pipes. Handle this case by continuing to perform
non-blocking select on the process's streams until all remaining data has been
read.

Bug: 67870
Change-Id: I050292dbb76821f66a15f937bf3aaf4defe67687
2014-07-21 23:21:23 -07:00
Kevin Israel
d3b172af3b Remove Fallback::iconv()
The iconv fallback is, for the most part, a remnant of PHP 4 support.
Though iconv was not enabled by default in PHP 4, it is in PHP 5. This
is the case even for Windows builds, which use GNU libiconv.

As for the major Linux distributions:

* Debian, CentOS, Ubuntu -> always enabled
* Fedora, Slackware -> .so in the same package, enabled by default
* Arch -> .so in the same package, disabled by default
* openSUSE -> separate package

Change-Id: Ie1112a5742646a0e1f951e188480c23851859320
2014-07-21 00:36:22 -04:00
Aaron Schulz
92e0d0f927 Added a hasMasterConnection() method to LoadBalancer
* Made wfWaitForSlaves() use it instead of using isOpen() incorrectly.
  The index for the master is 0, not DB_MASTER. This fixes 2979f0b6.

Change-Id: I48e5c7f10d8fe6b8bf6e830282352e3238b5d3ae
2014-07-19 16:19:43 -07:00
Aaron Schulz
2979f0b6f1 Avoid useless delay and master connections in wfWaitForSlaves() in runJobs.php
* Some jobs, like Parsoid ones, do not actually do master DB updates

Change-Id: I1a8830eafd7760d081df966bb423030dcdc96408
2014-07-19 15:19:40 -07:00
withoutaname
a5ed84d4d9 Remove deprecated global function wfViewPrevNext()
Deprecated since 1.19, alternative is Language::viewPrevNext().

Change-Id: I26d8dec1475ac3f6592f8d0ef7936440c1a0f14d
2014-07-18 21:20:00 +00:00
jenkins-bot
358f2a07c6 Merge "GlobalFunctions: Deprecate swap()" 2014-07-10 00:50:28 +00:00