Changeset View
Changeset View
Standalone View
Standalone View
scripts/__init_script__.php
| <?php | <?php | ||||
| if (function_exists('pcntl_async_signals')) { | |||||
| pcntl_async_signals(true); | |||||
| } else { | |||||
| declare(ticks = 1); | |||||
| } | |||||
epriestley: Oh, this has no effect before PHP7 because `declare(ticks = 1)` has file scope, not process… | |||||
| function __phutil_init_script__() { | function __phutil_init_script__() { | ||||
| // Adjust the runtime language configuration to be reasonable and inline with | // Adjust the runtime language configuration to be reasonable and inline with | ||||
| // expectations. We do this first, then load libraries. | // expectations. We do this first, then load libraries. | ||||
| // There may be some kind of auto-prepend script configured which starts an | // There may be some kind of auto-prepend script configured which starts an | ||||
| // output buffer. Discard any such output buffers so messages can be sent to | // output buffer. Discard any such output buffers so messages can be sent to | ||||
| // stdout (if a user wants to capture output from a script, there are a large | // stdout (if a user wants to capture output from a script, there are a large | ||||
| // number of ways they can accomplish it legitimately; historically, we ran | // number of ways they can accomplish it legitimately; historically, we ran | ||||
| ▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | function __phutil_init_script__() { | ||||
| } | } | ||||
| // Now, load libphutil. | // Now, load libphutil. | ||||
| $root = dirname(dirname(__FILE__)); | $root = dirname(dirname(__FILE__)); | ||||
| require_once $root.'/src/__phutil_library_init__.php'; | require_once $root.'/src/__phutil_library_init__.php'; | ||||
| PhutilErrorHandler::initialize(); | PhutilErrorHandler::initialize(); | ||||
| // If "variables_order" excludes "E", silently repair it so that $_ENV has | |||||
| // the values we expect. | |||||
| PhutilExecutionEnvironment::repairMissingVariablesOrder(); | |||||
| $router = PhutilSignalRouter::initialize(); | $router = PhutilSignalRouter::initialize(); | ||||
| $handler = new PhutilBacktraceSignalHandler(); | $handler = new PhutilBacktraceSignalHandler(); | ||||
| $router->installHandler('phutil.backtrace', $handler); | $router->installHandler('phutil.backtrace', $handler); | ||||
| $handler = new PhutilConsoleMetricsSignalHandler(); | $handler = new PhutilConsoleMetricsSignalHandler(); | ||||
| $router->installHandler('phutil.winch', $handler); | $router->installHandler('phutil.winch', $handler); | ||||
| } | } | ||||
| __phutil_init_script__(); | __phutil_init_script__(); | ||||
Oh, this has no effect before PHP7 because declare(ticks = 1) has file scope, not process scope.
I believe everything which cares about this already has the same block at top level anyway and that this has no effect.