Commit graph

35 commits

Author SHA1 Message Date
Niklas Laxström
1f482132e9 Unbreak ForkController
pcntl_signal is a function, not an extension.

Change-Id: Ic86ec2b1fea4c62e4d8608a8089ea5c073dfa9c7
Follow-up: I66deaa9b346b936b2628ac0511492d20a42fea6c
2021-07-14 14:08:22 +02:00
Ammarpad
8270e5ef99 ForkController: Throw more meaningful error for missing PHP extensions
Currently all the signal constants emit warnings as they are undefined
in PHP 7.4 and throw fatal error in PHP 8, if pcntl is not available.

pcntl extension is not enabled by default, and is not required by
MediaWiki, so this class should throw a better error if it's not
found. The class already has comment that pcntl and posix are required
but this is meaningless since the error and a warning for each constant
would be emitted anyway.

https://www.php.net/manual/en/pcntl.installation.php

Convert RESTARTABLE_SIGNALS constant back to static property as it was,
because we can only use these constants after confirming they exist,
which happens in the constructor.

Bug: T280456
Change-Id: I66deaa9b346b936b2628ac0511492d20a42fea6c
2021-04-17 22:21:15 +01:00
DannyS712
d94498d3f2 Clean up ForkController using current code conventions
Declare variables on separate lines
Add some documentation
Use a constant

Change-Id: If6734bedc2a4b07b3442e14cb71a539377d22b16
2021-03-21 19:21:12 +00:00
Reedy
a8467a0fd7 Fix numerous PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I157220c4e9ff516283a60f06af99efa2439332e3
2020-05-12 18:41:43 +00:00
mainframe98
387a3ac44c Remove usages of $wgMemc
Usages in Installer.php were not removed as the installer is
resetting $wgMemc to an EmptyBagOStuff instance. Removing it
would risk breaking the installer for extensions still using
$wgMemc.

Bug: T160813
Change-Id: I46b837c92cf86474989ee6dd97f1251cf795309f
2020-01-20 19:41:32 +01:00
Aryeh Gregor
0d3d6be18d Convert FileBackendGroup to service
Bug: T234228
Change-Id: I25575f565eba122cdf971a5945572811d17fa3e1
2019-10-25 10:46:20 +03:00
Aryeh Gregor
5a6c18a086 LockManagerGroupFactory to replace singletons
100% test coverage of code that appears to be working and used, in both
LockManagerGroupFactory and also LockManagerGroup. Where possible I
wrote it as unit tests. One preexisting code path seems to be broken and
I marked the test as skipped. Two methods look unused and perhaps not
especially helpful, so I didn't write tests for them yet in case we want
to just get rid of them instead.

Change-Id: Iaa7354f31c451b87773468609c674a3bf1d4382f
2019-08-27 13:19:15 +03:00
James D. Forrester
460bcf81e7 build: Upgrade mediawiki/mediawiki-phan-config from 0.5.0 to 0.6.0 and make pass
Fix five instances of PhanPluginDuplicateConditionalNullCoalescing;
escape the rest for now.

Bug: T219114
Change-Id: Ic4bb30c43c5315ce6b878b37b432c6e219414f8b
2019-05-13 14:57:07 +00:00
Kunal Mehta
251a0b97e5 Treat phpdbg as run from the command line when checking PHP_SAPI
phpdbg is a gdb-style debugger for PHP that is run from the command
line. However, it has a different PHP_SAPI value, so it was impossible
to run maintenance scripts with it (until now).

To avoid having to check both PHP_SAPI values in a bunch of places,
introduce wfIsCLI() to easily check whether running from the
command-line or not.

We're (CI team) interested in generating code coverage with phpdbg
instead of xdebug, hence this patch.

Bug: T184043
Change-Id: Id1f994ca146d7858cd8bb6ab6cdbb7718ff524fb
2018-01-03 23:00:37 -08:00
Aaron Schulz
ac2c4cb838 Call resetChildProcessServices() in ForkController
Use this instead of bogus destroyInstance() call to LBFactory.

Change-Id: Iaf62925c0b3bf364dbaca8160f9c5bbfd97670ab
2016-10-11 12:52:44 -07:00
Stanislav Malyshev
208851e5ec Call destroy method that actually exists instead of one that doesn't anymore.
Bug: T147881
Change-Id: Idac48d3c022af60409df37f2b1fcf82af814bdfa
2016-10-11 12:13:10 -07:00
Catrope
1162ed5f88 Revert "Allow reset of global services."
Completely breaks login.

This reverts commit 8e7a0a0912.

Change-Id: Ide7ab5632e987e81374c21173df6ab3998649df7
2016-04-11 13:40:28 -07:00
daniel
8e7a0a0912 Allow reset of global services.
This change provides a mechanism to reset global service instances
in an orderly manner. There are three use cases for this:

* the installation process
* forking processes
* integration tests (which must of the existing phpunit tests are)

Depends-On: I5d638ad415fc3840186a0beaa09ac02ea688539b
Change-Id: Ie98bf5af59208f186dba59a9e971c72ea0b63e69
2016-04-11 16:22:40 +02:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
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
2016-02-17 01:33:00 -08:00
Aaron Schulz
1c5071fd8a Make ForkController destroy redis instances too
Bug: T85565
Change-Id: I79e1b6aab30ef8ddfee2dd4f5f41e991562dbf13
2015-12-04 23:17:37 -08:00
umherirrender
3b2b6a2773 Add missing @param to function docs
Change-Id: I47fa96a976f55a1a93cb75397285edb8c7f4cd8a
2014-08-14 20:22:52 +02:00
Chad Horohoe
bcbe930866 Make it easy to get the number of the currently running child
Change-Id: I2071f04b6f01e640c850c6470cfa9f2f48f62eac
2014-01-08 14:18:28 -08:00
Chad Horohoe
2a47a3e91c Declare visibility on all properties in ForkController
Grepped all of core and extensions, and nothing uses them

Change-Id: I8e4f191aafffdbc2254e39bed81a5209cdf29795
2014-01-08 14:18:27 -08:00
umherirrender
ef2f507d23 Fixed spacing in files direct in includes folder
Added spaces before if, foreach
Added some braces for one line statements

Change-Id: Ibb8dd102db045522d12ff939075ba7420d95ab6b
2013-04-21 06:38:49 +00: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
Aaron Schulz
5b67e492ff [LockManager] Refactoring to allow proper cross-wiki support.
Change-Id: I331d011a6fa4edd434f0fb547d325ad60901119d
2013-01-28 11:03:33 -08:00
Alexandre Emsenhuber
15e9fcca01 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: Iaebd4e253ff3b35b568e9b394231a5691445ac95
2012-05-14 19:59:58 +02:00
Aaron
fbecd7781b Destroy any lock manager connections when forking.
Change-Id: I320ac659559eb82378da0b9afbbb1dd3e48ba41c
2012-04-20 16:34:43 -07:00
Aaron Schulz
4bfce6a539 Make sure ForkController nukes any connection resources that backends might have before forking 2012-03-09 22:59:13 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Tim Starling
2ba6b03e8e * Fix class name
* unset($wgMemc) doesn't actually do anything useful, it just removes the reference from the local scope. Set it to NULL instead.
2011-12-20 04:39:12 +00:00
Sam Reed
ad39f2da86 Trim trailing whitespace
Add/tweak/update documentation

Simplify some boolean returns
2011-09-04 21:40:17 +00:00
Sam Reed
296f3d3f4f And even more documentation 2011-05-28 18:59:42 +00:00
Platonides
9ced2d5c60 Follow up r83140. Add a clear() method to ObjectCache so that it can be used by ForkController. 2011-03-06 23:07:36 +00:00
Sam Reed
04f68827d0 Removal of unused globals
Removal of one setting of a variable to '', then not using further
2010-07-24 19:11:52 +00:00
Alexandre Emsenhuber
2620333e1d * add ForkController class to Maintenance group
* removed trailing spaces
2010-01-15 18:12:13 +00:00
Tim Starling
2ec95d3326 Assorted minor live patches to command-line scripts. 2009-04-30 05:52:25 +00:00
Tim Starling
0104dd55c9 Allow children to respond to SIGTERM 2009-03-18 02:30:02 +00:00
Tim Starling
d9bf616a44 * Added restart-on-error feature to ForkController, changed the interface to suit.
* Close some sockets before pcntl_exec() in an attempt to delay file handle exhaustion.
2009-02-27 04:18:34 +00:00
Tim Starling
abbf76b7b1 * Refactored the forking code from runJobs.php to a new class called ForkController. Implemented the same sort of forking in gearmanWorker.php.
* Fixed debugging code left in in gearmanRefreshLinks.php
2009-02-26 06:02:32 +00:00