Server : LiteSpeed
System : Linux server900.shared.spaceship.host 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
User : kvzyqrttyz ( 5084)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /opt/hc_php/unversioned/

📁 Create New:
⬆️ Upload File:
Current Dir [ Not Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: EventPublisher.php

Path: //opt/hc_php/unversioned/EventPublisher.php

Size: 1.2 KB

Permissions: 0644

<?php
namespace HcEventPublisher;

include_once('JsonRPC/Client.php');

use JsonRPC;

const USER_AGENT_SOCKET = '/var/run/hc_cpanelsharedhosting_agent/rpc_user.sock';
const ROOT_AGENT_SOCKET = '/var/run/hc_cpanelsharedhosting_agent/rpc.sock';
const METHOD = 'event.publish';
const DEBUG = false;

const BASE_PATH = '/var/cpanel/userdata';
const TOKEN_FILE = 'hc_agent.token';


class EventPublisher extends JsonRPC\Client {

    public function __construct()
    {   
        $processUser = posix_getpwuid(posix_geteuid());
        $this->user = $processUser['name'];
        if ($this->user == 'root') {
            parent::__construct(ROOT_AGENT_SOCKET);
        } else {
            parent::__construct(USER_AGENT_SOCKET);
        }
        $this->debug = DEBUG;
    }

    public function send($params=array()) {
        // Add token to the request if user is not root.
        if ($this->user != 'root') {
            $full_token_path = sprintf('%s/%s/%s', BASE_PATH, $this->user, TOKEN_FILE);
            if (file_exists($full_token_path)) {

                $params['metadata']['token'] = trim(file_get_contents($full_token_path));
            }
        }
        return $this->execute(METHOD, $params);
    }
} 

?>

← Back to Directory Edit File 🔒 Chmod

WP File Manager