WP_CLI
Extractor::ensure_dir_exists()
Ensure directory exists.
Метод класса: Extractor{}
Хуков нет.
Возвращает
true|false
. Whether the existence could be asserted.
Использование
$result = Extractor::ensure_dir_exists( $dir );
- $dir(строка) (обязательный)
- Directory to ensure the existence of.
Код Extractor::ensure_dir_exists() Extractor::ensure dir exists WP-CLI 2.8.0-alpha
private static function ensure_dir_exists( $dir ) { if ( ! is_dir( $dir ) ) { if ( ! @mkdir( $dir, 0777, true ) ) { $error = error_get_last(); WP_CLI::warning( sprintf( "Failed to create directory '%s': %s.", $dir, $error['message'] ) ); return false; } } return true; }