WC_Log_Handler_File::open() protected WC 1.0
Open log file for writing.
{} Это метод класса: WC_Log_Handler_File{}
Хуков нет.
Возвращает
true/false. Success.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->open( $handle, $mode );
- $handle(строка) (обязательный)
- Log handle.
- $mode(строка)
- File mode.
По умолчанию: 'a'
Код WC_Log_Handler_File::open() WC Log Handler File::open WC 5.0.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.
@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;
}