WordPress at Your Fingertips
function is not described

WC_Log_Handler_File::should_rotate() protected WC 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.

{} It's a 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.

Code of WC_Log_Handler_File::should_rotate() WC 5.8.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;
	}
}