WC_Log_Handler_File::remove() public WC 1.0
Remove/delete the chosen file.
{} Это метод класса: WC_Log_Handler_File{}
Хуки из метода
Возвращает
true/false.
Использование
$WC_Log_Handler_File = new WC_Log_Handler_File(); $WC_Log_Handler_File->remove( $handle );
- $handle(строка) (обязательный)
- Log handle.
Код WC_Log_Handler_File::remove() WC Log Handler File::remove WC 5.0.0
public function remove( $handle ) {
$removed = false;
$logs = $this->get_log_files();
$handle = sanitize_title( $handle );
if ( isset( $logs[ $handle ] ) && $logs[ $handle ] ) {
$file = realpath( trailingslashit( WC_LOG_DIR ) . $logs[ $handle ] );
if ( 0 === stripos( $file, realpath( trailingslashit( WC_LOG_DIR ) ) ) && is_file( $file ) && is_writable( $file ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable
$this->close( $file ); // Close first to be certain no processes keep it alive after it is unlinked.
$removed = unlink( $file ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_unlink
}
do_action( 'woocommerce_log_remove', $handle, $removed );
}
return $removed;
}