WordPress at Your Fingertips
function is not described

WC_Log_Handler_File::open() protected WC 1.0

Open log file for writing.

{} It's a method of the class: WC_Log_Handler_File{}

No Hooks.

Return

true|false. Success.

Usage

// protected - for code of main (parent) or child class
$result = $this->open( $handle, $mode );
$handle(string) (required)
Log handle.
$mode(string)
File mode.
Default: 'a'

Code of WC_Log_Handler_File::open() WC 5.8.0

protected function open( $handle, $mode = 'a' ) {
	if ( $this->is_open( $handle ) ) {
		return true;
	}

	$file = self::get_log_file_path( $handle );

	if ( $file ) {
		if ( ! file_exists( $file ) ) {
			$temphandle = @fopen( $file, 'w+' ); // @codingStandardsIgnoreLine.
			if ( is_resource( $temphandle ) ) {
				@fclose( $temphandle ); // @codingStandardsIgnoreLine.

				if ( Constants::is_defined( 'FS_CHMOD_FILE' ) ) {
					@chmod( $file, FS_CHMOD_FILE ); // @codingStandardsIgnoreLine.
				}
			}
		}

		$resource = @fopen( $file, $mode ); // @codingStandardsIgnoreLine.

		if ( $resource ) {
			$this->handles[ $handle ] = $resource;
			return true;
		}
	}

	return false;
}