Automattic\WooCommerce\Internal\Admin\Logging\FileV2
FileController::delete_files
Delete one or more files from the filesystem.
Method of the class: FileController{}
No Hooks.
Returns
Int
. The number of files that were deleted.
Usage
$FileController = new FileController(); $FileController->delete_files( $file_ids ): int;
- $file_ids(array) (required)
- An array of file IDs (file basename without the hash).
FileController::delete_files() FileController::delete files code WC 9.9.5
public function delete_files( array $file_ids ): int { $deleted = 0; $files = $this->get_files_by_id( $file_ids ); foreach ( $files as $file ) { $result = $file->delete(); if ( true === $result ) { $deleted ++; } } if ( $deleted > 0 ) { $this->invalidate_cache(); } return $deleted; }