WC_Download_Handler::clean_buffers
Clean all output buffers.
Can prevent errors, for example: transfer closed with 3 bytes remaining to read.
Метод класса: WC_Download_Handler{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = WC_Download_Handler::clean_buffers();
Код WC_Download_Handler::clean_buffers() WC Download Handler::clean buffers WC 11.3.0
private static function clean_buffers() {
foreach ( array_reverse( ob_get_status( true ) ) as $buffer ) {
$flags = $buffer['flags'];
if ( $flags & PHP_OUTPUT_HANDLER_REMOVABLE ) {
ob_end_clean();
continue;
}
// This buffer can't be removed, and the ones below it can't be reached, so the file has to go through them.
if ( $flags & PHP_OUTPUT_HANDLER_CLEANABLE ) {
ob_clean();
} elseif ( $buffer['buffer_used'] > 0 ) {
wc_get_logger()->warning(
sprintf(
/* translators: %1$s: output buffer handler name, %2$d: number of bytes. */
__( 'Output buffer "%1$s" cannot be removed or cleaned, so %2$d bytes of earlier output will be sent before the downloaded file.', 'woocommerce' ),
$buffer['name'],
$buffer['buffer_used']
)
);
}
return;
}
}