WP_CLI\Utils
check_proc_available()
Check that proc_open() and proc_close() haven't been disabled.
No Hooks.
Returns
true|false.
Usage
check_proc_available( $context, $return );
- $context(string)
- If set will appear in error message.
Default:null - $return(true|false)
- If set will return false rather than error out.
Default:false
check_proc_available() check proc available code WP-CLI 2.13.0-alpha
function check_proc_available( $context = null, $return = false ) {
if ( ! function_exists( 'proc_open' ) || ! function_exists( 'proc_close' ) ) {
if ( $return ) {
return false;
}
$msg = 'The PHP functions `proc_open()` and/or `proc_close()` are disabled. Please check your PHP ini directive `disable_functions` or suhosin settings.';
if ( $context ) {
WP_CLI::error( sprintf( "Cannot do '%s': %s", $context, $msg ) );
} else {
WP_CLI::error( $msg );
}
}
return true;
}