WC_Log_Handler_File::should_rotate()protectedWC 1.0

Check if log file should be rotated.

Compares the size of the log file to determine whether it is over the size limit.

Метод класса: WC_Log_Handler_File{}

Хуков нет.

Возвращает

true|false. True if if should be rotated.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->should_rotate( $handle );
$handle(строка) (обязательный)
Log handle.

Код WC_Log_Handler_File::should_rotate() WC 8.7.0

protected function should_rotate( $handle ) {
	$file = self::get_log_file_path( $handle );
	if ( $file ) {
		if ( $this->is_open( $handle ) ) {
			$file_stat = fstat( $this->handles[ $handle ] );
			return $file_stat['size'] > $this->log_size_limit;
		} elseif ( file_exists( $file ) ) {
			return filesize( $file ) > $this->log_size_limit;
		} else {
			return false;
		}
	} else {
		return false;
	}
}