Automattic\WooCommerce\Blueprint
Util::delete_dir
Recursively delete a directory.
Метод класса: Util{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = Util::delete_dir( $dir_path );
- $dir_path(строка) (обязательный)
- The path to the directory.
Код Util::delete_dir() Util::delete dir WC 10.0.2
public static function delete_dir( $dir_path ) { if ( ! is_dir( $dir_path ) ) { throw new \InvalidArgumentException( "$dir_path must be a directory" ); } if ( substr( $dir_path, strlen( $dir_path ) - 1, 1 ) !== '/' ) { $dir_path .= '/'; } $files = glob( $dir_path . '*', GLOB_MARK ); foreach ( $files as $file ) { if ( is_dir( $file ) ) { static::delete_dir( $file ); } else { // phpcs:ignore unlink( $file ); } } // phpcs:ignore rmdir( $dir_path ); }