WP_CLI\Utils
inside_phar()
Check if a certain path is within a Phar archive.
If no path is provided, the function checks whether the current WP_CLI instance is running from within a Phar archive.
No Hooks.
Returns
true|false. Whether path is within a Phar archive.
Usage
inside_phar( $path );
- $path(string|null)
- Path to check.
Default: null, which checks WP_CLI_ROOT
inside_phar() inside phar code WP-CLI 2.13.0-alpha
function inside_phar( $path = null ) {
if ( null === $path ) {
if ( ! defined( 'WP_CLI_ROOT' ) ) {
return false;
}
$path = WP_CLI_ROOT;
}
return 0 === strpos( $path, PHAR_STREAM_PREFIX );
}