WC_Log_Handler_File::remove()
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 9.4.2
public function remove( $handle ) { $removed = false; $logs = $this->get_log_files(); $log_directory = LoggingUtil::get_log_directory(); $handle = sanitize_title( $handle ); if ( isset( $logs[ $handle ] ) && $logs[ $handle ] ) { $file = realpath( trailingslashit( $log_directory ) . $logs[ $handle ] ); if ( 0 === stripos( $file, realpath( trailingslashit( $log_directory ) ) ) && 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; }