WC_Log_Handler_File::open()
Open log file for writing.
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'
WC_Log_Handler_File::open() WC Log Handler File::open code WC 9.5.1
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; }