WC_Log_Handler_File::increment_log_infix()
Increment a log file suffix.
Метод класса: WC_Log_Handler_File{}
Хуков нет.
Возвращает
true|false
. True if increment was successful, otherwise false.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->increment_log_infix( $handle, $number );
- $handle(строка) (обязательный)
- Log handle.
- $number(null|int)
- Log suffix number to be incremented.
По умолчанию: null
Код WC_Log_Handler_File::increment_log_infix() WC Log Handler File::increment log infix WC 9.4.2
protected function increment_log_infix( $handle, $number = null ) { if ( null === $number ) { $suffix = ''; $next_suffix = '.0'; } else { $suffix = '.' . $number; $next_suffix = '.' . ( $number + 1 ); } $rename_from = self::get_log_file_path( "{$handle}{$suffix}" ); $rename_to = self::get_log_file_path( "{$handle}{$next_suffix}" ); if ( $this->is_open( $rename_from ) ) { $this->close( $rename_from ); } if ( is_writable( $rename_from ) ) { // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_is_writable return rename( $rename_from, $rename_to ); // phpcs:ignore WordPress.VIP.FileSystemWritesDisallow.file_ops_rename } else { return false; } }