WP_CLI\Utils

check_proc_available()WP-CLI 1.0

Check that proc_open() and proc_close() haven't been disabled.

Хуков нет.

Возвращает

true|false.

Использование

check_proc_available( $context, $return );
$context(строка)
If set will appear in error message.
По умолчанию: null
$return(true|false)
If set will return false rather than error out.
По умолчанию: false

Код check_proc_available() WP-CLI 2.8.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;
}