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.

Method of the class: WC_Log_Handler_File{}

No Hooks.

Return

true|false. True if if should be rotated.

Usage

// protected - for code of main (parent) or child class
$result = $this->should_rotate( $handle );
$handle(string) (required)
Log handle.

WC_Log_Handler_File::should_rotate() code WC 9.3.3

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;
	}
}