Plugin Updates

This commit is contained in:
Tony Volpe
2024-04-02 20:23:21 +00:00
parent 96800520e8
commit 94170ec2c4
1514 changed files with 133309 additions and 105985 deletions

View File

@@ -123,6 +123,10 @@ class LogHandlerFileV2 extends WC_Log_Handler {
$backtrace = static::get_backtrace();
foreach ( $backtrace as $frame ) {
if ( ! isset( $frame['file'] ) ) {
continue;
}
foreach ( $source_roots as $type => $path ) {
if ( 0 === strpos( $frame['file'], $path ) ) {
$relative_path = trim( substr( $frame['file'], strlen( $path ) ), DIRECTORY_SEPARATOR );
@@ -233,7 +237,29 @@ class LogHandlerFileV2 extends WC_Log_Handler {
)
);
if ( is_wp_error( $files ) || count( $files ) < 1 ) {
if ( is_wp_error( $files ) ) {
return 0;
}
$files = array_filter(
$files,
function( $file ) use ( $timestamp ) {
/**
* Allows preventing an expired log file from being deleted.
*
* @param bool $delete True to delete the file.
* @param File $file The log file object.
* @param int $timestamp The expiration threshold.
*
* @since 8.7.0
*/
$delete = apply_filters( 'woocommerce_logger_delete_expired_file', true, $file, $timestamp );
return boolval( $delete );
}
);
if ( count( $files ) < 1 ) {
return 0;
}
@@ -250,31 +276,16 @@ class LogHandlerFileV2 extends WC_Log_Handler {
time(),
'info',
sprintf(
'%s %s',
sprintf(
esc_html(
// translators: %s is a number of log files.
_n(
'%s expired log file was deleted.',
'%s expired log files were deleted.',
$deleted,
'woocommerce'
)
),
number_format_i18n( $deleted )
esc_html(
// translators: %s is a number of log files.
_n(
'%s expired log file was deleted.',
'%s expired log files were deleted.',
$deleted,
'woocommerce'
)
),
sprintf(
esc_html(
// translators: %s is a number of days.
_n(
'The retention period for log files is %s day.',
'The retention period for log files is %s days.',
$retention_days,
'woocommerce'
)
),
number_format_i18n( $retention_days )
)
number_format_i18n( $deleted )
),
array(
'source' => 'wc_logger',