mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-84446 core: Check existence of pcntl_signal
This commit is contained in:
parent
3c848c4dce
commit
c89067d1b8
1 changed files with 9 additions and 5 deletions
|
@ -56,13 +56,17 @@ class core_shutdown_manager {
|
||||||
// 'pcntl_async_signals'
|
// 'pcntl_async_signals'
|
||||||
// 'pcntl_signal'
|
// 'pcntl_signal'
|
||||||
// The 'pcntl' extension is optional and not available on Windows.
|
// The 'pcntl' extension is optional and not available on Windows.
|
||||||
if (extension_loaded('pcntl') && function_exists('pcntl_async_signals')) {
|
if (extension_loaded('pcntl')) {
|
||||||
|
if (function_exists('pcntl_async_signals')) {
|
||||||
// We capture and handle SIGINT (Ctrl+C) and SIGTERM (termination requested).
|
// We capture and handle SIGINT (Ctrl+C) and SIGTERM (termination requested).
|
||||||
pcntl_async_signals(true);
|
pcntl_async_signals(true);
|
||||||
|
}
|
||||||
|
if (function_exists('pcntl_signal')) {
|
||||||
pcntl_signal(SIGINT, ['core_shutdown_manager', 'signal_handler']);
|
pcntl_signal(SIGINT, ['core_shutdown_manager', 'signal_handler']);
|
||||||
pcntl_signal(SIGTERM, ['core_shutdown_manager', 'signal_handler']);
|
pcntl_signal(SIGTERM, ['core_shutdown_manager', 'signal_handler']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Signal handler for SIGINT, and SIGTERM.
|
* Signal handler for SIGINT, and SIGTERM.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue