Commit graph

1095 commits

Author SHA1 Message Date
Antoine Musso
8bfe2518f7 wfIniGetBool: reduce strtolower() calls
We were calling strtolower() up to three times. As a micro optimization,
call it once around ini_get() and do the logical checks against the
variable containing the lower case output.

Change-Id: I16c149fbb9de84d7b6f3e68da06de208c5572b7c
2013-05-29 10:51:01 +00:00
Daniel Friesen
97caae596d Drop support for XHTML 1.0
* $wgHtml5 = false; is now ignored completely.
* $wgDocType and $wgDTD have been removed.
* $wgXhtmlDefaultNamespace is now ignored.
* XHTML5 will be output if $wgMimeType is set to an XML mime type (according to HTML5's rules).
* For backwards compatibility with extensions $wgHtml5 and $wgXhtmlDefaultNamespace are set
  in Setup.php but depending on them is deprecated.

Change-Id: Iad9634e2ee420b5a3bbffe550421fde4fa1819b0
2013-05-15 23:09:25 -07:00
Tim Starling
196865004d Remove taint support
Venema's taint feature was apparently never publicised beyond the
php-dev mailing list, and now there is a PECL taint extension which is
incompatible with the interface assumed here.

Grep confirms that wfArrayMap() is not used in any extensions.

Change-Id: I17d8d302947443262474c608829c7c7504bef589
2013-05-06 17:39:07 +10:00
Max Semenik
068ce81799 Merge "Import: Fix incorrect wfRunHooks usage" 2013-05-02 19:26:07 +00:00
Max Semenik
1f8a7dc2d2 Import: Fix incorrect wfRunHooks usage
af125df519 broke importing
because Import.php was calling wfRunHooks() improperly.
Fixing the calls and making the wfRunHooks() signature
match Hooks::run() to make call errors immediately detectable.

Change-Id: If44292fedf6917cde1dae7f0391231a18d414610
2013-05-02 18:06:19 +00:00
Kevin Israel
34d49b33a5 wfRandomString: Correct bias toward digits 1-7
Two problems with a single line of code:

* dechex() does not include leading zeros, so the first digit
  generated in each iteration cannot be zero unless the return
  value of mt_rand() is 0.

  This also means wfRandomString() is extremely unlikely to
  start a string with '0'.

* mt_rand() does not actually uniformly distribute values over
  [0,2^32-1]; it actually right-shifts one of the bits off (just
  because "[...] the previous php_rand only returns 31 at most"),
  so the maximum value is 0x7fffffff, not 0xffffffff.

  This means wfRandomString() will never start a string with
  any of the digits 8-f.

Including leading zeros and using only the 28 LSBs to form seven
hex digits at a time is the simplest fix.

Change-Id: Ic19b5b97c582485780b24fd35ffef2111cc8b3ca
2013-04-29 00:33:06 -04:00
umherirrender
6f79eef473 Fixed spacing around parenthesis in includes
Change-Id: Ie8adc00f4ee8ecec4554e584c18d5d2073415397
2013-04-28 15:50:07 +00:00
umherirrender
9f14ecf829 Added space after switch/Removed spaces after unset
While at it, added/removed some other spaces in the same files

Change-Id: I84d8001aa123a008807ad5eb76f396aed7c899a4
2013-04-26 16:42:31 +02:00
Aaron Schulz
ccabd0efb0 Changed on-request job running to shell out instead of doing a loop.
* Also factored out a new wfShellExecDisabled() function.
* This will keep the process in the background if possible to avoid
  killing site performance, especially with slow jobs.
* This also keep fatals and uncatcheable exceptions from
  hitting the user.
* If $wgPhpCli is not set to an actual path or safe mode
  is on, then the old code will be used.

Change-Id: I6a28152251659ee53eee2604f16d5bf02c85a44f
2013-04-25 23:46:05 +00:00
umherirrender
dbd0b590e9 else if -> elseif
Also fixed some spacing while at it
Added some braces for one line statements

Change-Id: Iebfa2b17091509daabc76248121c7763e2295d20
2013-04-17 16:52:47 +02:00
umherirrender
97234cc884 Added spaces before and removed spaces after 'array'
Fix some other spacing while at it

Change-Id: I13f81533eaf40e06c13cf377c0f08ef5cef01d00
2013-04-14 21:57:46 +02:00
umherirrender
15abcf71ca Added/Removed spaces around string concatenation
And added/removed spaces around some other tokens,
like +, -, *, /, <, >, =, !

Fixed windows newline style

Change-Id: I0b9c8c408f3f6bfc0d685a074d7ec468fb848fc8
2013-04-13 13:36:24 +02:00
jenkins-bot
8e8856146d Merge "Fixed fatal when using fake load balancers." 2013-04-05 20:29:29 +00:00
Aaron Schulz
97dcbc1c26 Added "cluster" parameter to wfWaitForSlaves() for external DBs.
Change-Id: I226a1793dfb901de8e1c0ac40c1dc3ad890de95a
2013-04-04 16:10:56 -07:00
Aaron Schulz
7fd8d513c4 Fixed fatal when using fake load balancers.
The error was:
Catchable fatal error: Argument 1 passed to DatabaseMysql::masterPosWait()
must implement interface DBMasterPos, boolean given, called in
/var/www/DevWiki/core/includes/db/LoadBalancer.php on line 419

Change-Id: I230585930c1424b0868f9aa290167c66bc6848bd
2013-04-04 10:29:13 -07:00
jenkins-bot
cfcbb5e3ba Merge "Adding wfLogWarning for production warnings." 2013-04-04 16:52:45 +00:00
Aaron Schulz
5f1e95436e Avoid sending multiple UDP packets for the same key in wfIncrStats().
* This should help reduce collector data loss.

Change-Id: Ibe55648422d1b8aac86dd6fa83973d3c8715b0aa
2013-03-29 12:01:42 -07:00
Alexandre Emsenhuber
15833dafdf Fix case of some Title methods
Change-Id: I1a37ffb0e8cde4deac027721b0e463585b58d634
2013-03-26 10:54:15 +01:00
umherirrender
6c278b6d7e fix some spacing
* Removed spaces around array index
* Removed double spaces or added spaces to begin or end of function
  calls, method signature, conditions or foreachs
* Added braces to one-line ifs
* Changed multi line conditions to one line conditions
* Realigned some arrays

Change-Id: Ia04d2a99d663b07101013c2d53b3b2e872fd9cc3
2013-03-25 22:22:46 +00:00
Peter Gehres
2772d8c1a6 Merge "Fix wfWaitForSlaves() so the $wiki parameter actually works correctly" 2013-03-20 21:44:04 +00:00
Peter Gehres
7cb764095f Fix wfWaitForSlaves() so the $wiki parameter actually works correctly
Change-Id: I1f3da5921f2d724e10c448700ea8b958ff159451
2013-03-20 14:25:38 -07:00
daniel
aacdbbc6f3 Adding wfLogWarning for production warnings.
Currently, trigger_error() is used to report non-fatal problems in 
production. It seems more consistent to have our own function to do 
that, with behavior consistent with wfWarn().

Change-Id: I531b7ceec089978c2832721486f277fdfca65270
2013-03-19 15:24:00 +00:00
umherirrender
926d2ee143 Remove spaces between parentheses in function calls
Change-Id: If8ec665a01b566fa5189dfcc810b2d9a17f371e1
2013-03-17 16:13:22 +01:00
Yuri Astrakhan
9506e3d812 Spellchecked /includes directory
* Ran spell-checker over code comments in /includes/
* A few spellchecking fixes for wfDebug() calls

Found one very strange (NOOP?) line in Linker.php - see "TODO: BUG?"

Change-Id: Ibb86b51073b980eda9ecce2cf0b8dd33f058adbf
2013-03-13 03:42:41 -04:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
jenkins-bot
073a675adf Merge "fix some spacing" 2013-03-07 17:13:27 +00:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00
umherirrender
e43dc272bd Fix align of block comments
Change-Id: I88ea33a125a71671886b49e4ebf4c1d0a1cce572
2013-03-07 17:27:38 +01:00
Aaron Schulz
9ace77f03c Moved wfPickRandom to ArrayUtils.
Change-Id: I45e21e722245901ab2988be4892cdb393169c62c
2013-03-05 15:07:09 -08:00
jenkins-bot
7027ba7e93 Merge "Remove DB2 support" 2013-03-01 22:00:46 +00:00
Alexandre Emsenhuber
4421f598ea Correct documentation for wfPickRandom()'s return types
Also make LoadBalancer::pickRandom()'s one consistent.

Change-Id: Ib80827ef20b32fecb799f327545b1232272076d2
2013-03-01 08:22:46 +01:00
Reedy
99512fd3d6 Move LoadBalancer::pickRandom() to wfPickRandom()
Code is copypaste reused in other extensions

Change-Id: I4c677ddc01ee264f3b72bb17135972adc96144ae
2013-02-28 12:52:35 -08:00
Niklas Laxström
74667197d6 Refresh docs for wfMessage
Change-Id: I53d2d32e7d6972171f3c2430412a44eea0b5b0a8
2013-02-26 10:48:06 +00:00
Chad Horohoe
6f4448dd71 Remove DB2 support
Change-Id: I9b294a213a4000f503c0010d88757db6dda927c0
2013-02-25 13:47:03 -08:00
jenkins-bot
c48323708b Merge "(bug 45069) wfParseUrl() no longer produces a PHP notice if passed a "mailto:" URL without address" 2013-02-20 15:42:16 +00:00
Kevin Israel
1d41a94cff Always cast input to string in wfBaseConvert
Fixes a regression caused by I841717be: IP::toHex('128.0.0.0')
was broken on 32-bit systems with the GMP extension installed.

Change-Id: I0c9a4ae771668e005355e381de4065d73c261460
2013-02-19 04:31:33 -05:00
Alexandre Emsenhuber
a7c103ad00 (bug 45069) wfParseUrl() no longer produces a PHP notice if passed a "mailto:" URL without address
Calling wfParseUrl( 'mailto:' ) or wfParseUrl( 'mailto:?subject=...' ) was resulting in the following PHP errors:
PHP Notice:  Undefined index: path in includes/GlobalFunctions.php on line 813
PHP Notice:  Undefined index: path in includes/GlobalFunctions.php on line 814

Now the existence of that key is checked and if missing an empty string is set so for consistency of the returned value.

The fix is based on the snippet provided on
https://www.mediawiki.org/wiki/Thread:Project:Support_desk/GLobafunctions.php_wfParseUrl_choking_on_url

Change-Id: Ife07d6e2a364a7cafda387cf7ed9cd71c2b68ef8
2013-02-18 13:17:23 +01:00
jenkins-bot
a87e2ea37a Merge "Improve the shell cgroup feature" 2013-02-07 18:40:49 +00:00
Chad Horohoe
296e57f634 Deprecate in_string()
It's a silly wrapper for something you can do in one line
of PHP anyway.

Change-Id: Ib85e4aaa20e62fe5f218b38cf0759c9c799c3381
2013-02-06 14:38:57 -05:00
Tim Starling
674962b339 Improve the shell cgroup feature
* Make the cgroup name configurable, so that it can be switched on and
  off in configuration, or so a different cgroup can be used for
  different wikis. The DefaultSettings.php entry also makes the feature
  more discoverable and so more useful to non-Wikimedia users.

* Send named parameters to the shell script instead of numbered
  parameters. Send the command as argument 1, for easier ps -f
  interpretation.

* Move the wrapper script to includes/, since it doesn't need to be
  executable anymore, so it doesn't make sense for it to be in bin/.

* Remove the requirement for a release script to be used. Clean up in
  the wrapper script instead. The release script had to be configured
  globally, which might not be suitable for all MediaWiki installations.

Change-Id: Ic8362cab63df162852d5df56cf695ef163cd6232
2013-02-05 16:47:34 +11:00
Ori Livneh
6c163ad265 (Bug 37957) Replace php_sapi_name() with PHP_SAPI
The PHP_SAPI constant has been available since PHP 4.2.0. It's more
concise to use the constant and has less overhead than a function call.

Furthermore, PHP_SAPI rhymes with "happy", whereas "php_sapi_name"
rhymes with "lame". QED, etc.

Change-Id: Ie8c121cb8fcef50536af8d3f66723b458f0bf9af
2013-02-04 12:50:45 -08:00
umherirrender
1044b0b8df fix some spacing
Change-Id: I8f976013f33c5818e4402604fe8610aa3f43b0c6
2013-02-04 20:18:33 +00:00
S Page
a5e40b661c Document that default timestamp is current time.
Change-Id: Ie255ac62a52f5d023f7cd6ffc6c0df91e7a02403
2013-01-19 07:35:22 +00:00
Aaron Schulz
3943a73e21 Do not send data for 0 increment calls in wfIncrStats().
Change-Id: I5f1ca83ad56e129b42a96a5c73ec42cd2d978901
2013-01-18 10:26:54 -08:00
Tim Starling
c8e3fa04db Implement wall clock time limits for shell commands
* Use the "timeout" command to implement wall clock time limits.
* Write a message to stderr when the time limit is exceeded, for
consistency with ulimit
* Configure with $wgMaxShellWallClockTime
* If "time" is specified in $limits, use that as the wall clock limit in
preference to the global variable, to support legacy callers which
usually want to disable the limits.
* Remove the requirement for ulimit5.sh to be executable since this is
not necessary when you specify the interpreter. Should avoid subtle
problems when the executable bit is accidentally stripped.
* Move the interpretation of 0/-1/false limits to the shell script, so
that e.g. wall clock time can be limited even if memory is unlimited.

Change-Id: Id9f2fea7c3b027565bdc33b88a1a7d4cdfe43a6c
2013-01-14 09:53:59 +11:00
jenkins-bot
f02f1a7658 Merge "Cleaned up and optimized wfBaseConvert();" 2013-01-02 21:38:58 +00:00
btongminh
4f23290816 wfMerge() now works if $wgDiff3 contains spaces
Change-Id: Ia18012ee87fe45e292cf08542f5b0680d0b85371
2012-12-29 21:39:54 +01:00
Tyler Anthony Romeo
9b9daadc46 Cleaned up and optimized wfBaseConvert();
* Added code to use BCMath or GMP if they are
  loaded, since they are both significantly faster.
  A parameter was added that can be used to force
  usage of a specific engine (mainly for testing).
* Made an array of base digits rather than using
  strpos() every time.
* Used casting instead of intval(), since the latter
  is six times slower.

Also added unit tests for wfBaseConvert as well as
a benchmarking class that measures the difference
between using GMP, BCMath, and pure PHP.

Change-Id: I841717be2b29a0b7fc57a13fde5cc0642cda82df
2012-12-27 00:17:18 -05:00
Aaron Schulz
b44f8b296b Made wfBaseconvert actually work with $lowercase=false.
* This used to return false for any non-digit input characters.

Change-Id: Ie7fca2669724dea29f4733bbc77a559d4f48a5b1
2012-12-25 09:36:45 +00:00
Alexandre Emsenhuber
4b5f75205b Use wfWikiID() instead of $wgDBname in wfIncrStats()
This allows to have distinct stat groups for people using database table prefix and
it makes wfIncrStats() consistent with ProfilerSimpleUDP that already uses wfWikiID().

Change-Id: Iecef9f490df8c5685a4887cc81dcb4a7e4d3172c
2012-12-21 18:17:30 +00:00