HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-4-197 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wordpress/wp-content/plugins/trinity-audio/inc/logs.php
<?php
  function trinity_log($message, $detailed_message = '', $debug_info = '', $log_type = TRINITY_AUDIO_ERROR_TYPES::info) {
    if ($log_type === TRINITY_AUDIO_ERROR_TYPES::error || $log_type === TRINITY_AUDIO_ERROR_TYPES::warn) {
      error_log($detailed_message);
    }

    /*
     * Note, that in while cycle - filesize will return cached result of size. In order to avoid it - you have to use
     * clearstatcache(), but it might slow down OS
     */

    if (file_exists(TRINITY_AUDIO_LOG) && filesize(TRINITY_AUDIO_LOG) >= TRINITY_AUDIO_LOG_MAX_SIZE) {
      trinity_empty_log();
    }

    $output = trinity_log_prepare_output($message, $detailed_message, $debug_info, $log_type);
    trinity_log_to_file($output);

    // TODO: log to depart
  }

  function trinity_log_prepare_output($message, $detailed_message, $debug_info, $log_type) {
    return json_encode(
      [
        'date'             => trinity_get_date(),
        'message'          => $message,
        'detailed_message' => $detailed_message,
        'debug_info'       => $debug_info,
        'type'             => $log_type,
      ]
    );
  }

  function trinity_empty_log() {
    $rotating_log_file = TRINITY_AUDIO_LOG;

    $ok = @unlink($rotating_log_file);
    if (!$ok) {
      error_log("Can't remove log file: $rotating_log_file. Try to empty it then...");
      $fp = @fopen($rotating_log_file, 'w');
      if (!$fp) return error_log("Can't empty log file: $rotating_log_file");
      fclose($fp);
    }
  }

  function trinity_log_to_file($message, $file_path = TRINITY_AUDIO_LOG, $mode = 'a+') {
    try {
      $ok = $fp = @fopen($file_path, $mode);
      if (!$ok) {
        return error_log('Can\'t open file ' . $file_path . ' ' . error_get_last()['message']);
      }

      $ok = @fwrite($fp, $message . "\n");
      if (!$ok) {
        return error_log('Can\'t write to file ' . $file_path . ' ' . error_get_last()['message']);
      }

      fclose($fp);
    } catch (Exception $e) {
    }
  }