fj d dl Z d dlZd dlZd dlmZ d dlmZmZmZm Z d dl mZ d dlm Z e j d ZdefdZd Zd edefdZddZdd ZddZddZddZd Zd Zd ZdS ) N)iglob)request_data_storagelocal_tasks_storagepart_delimitertask_delimiter)dbm_storage)Taskreconfigurationreturnc dS )za Return all possible locations of xray.ini files in glob-like form Panel independent )z/opt/alt/php*/link/confz%/var/cagefs/*/*/etc/cl.php.d/alt-php*z"/opt/cpanel/ea-php*/root/etc/php.dz/opt/plesk/php/*/etc/php.dz/usr/local/php*/lib/php.conf.dzD/usr/share/cagefs/.cpanel.multiphp/opt/cpanel/ea-php*/root/etc/php.dz8/usr/share/cagefs-skeleton/usr/local/php*/lib/php.conf.d r [/opt/cloudlinux/venv/lib64/python3.11/site-packages/xray/reconfiguration/system_id_shift.py get_locationsr s r c t j | dS # t $ r'}t d| | Y d}~dS d}~ww xY w)zWrapped unlinkz%s not removed, reason: %sN)osunlinkOSErrorloggerwarning)_fpathes r safe_unlinkr $ sj @ & @ @ @3VQ?????????@s A AA globpathc # K t | D ]?}t j | D ](}d|v r"t j || V )@dS )zp Find xray.ini files in every directory matching given glob-like path. Return full path to xray.ini zxray.iniN)r r listdirpathjoin)r conf_dirnames r find_xray_inisr! , sm (OO 3 3Jx(( 3 3DT!!gll8T22222 33 3r c t D ]>} t | D ],}t d| t | -?dS )z7 Remove all xray.ini files found in filesystem Removing %sN)r r! r infor )locationxray_inis r remove_xray_inisr' 7 sb "OO " "&x00 " "HKK x000!!!! "" "r c ~ t d D ],} t d| t | -dS )z9 Remove all xray.tasks files found in filesystem */usr/share/alt-php-xray-tasks/*/xray.tasksr# N)r r r$ r ) tasks_files r remove_xray_tasksr+ A sK HII M:...J r c t t 5 } | D ]2}t d| | |= 3 ddd dS # 1 swxY w Y dS )zF Remove all entries from local dbm file with fake_ids mapping z Clear task %sN)r r keysr r$ decode)task_storageitems r clear_dbm_filer1 J s ( ) ) #\ %%'' # #DKK777T"" ## # # # # # # # # # # # # # # # # #s AA++A/2A/c t j t D ]O} t d| t t j t | PdS )z% Remove all request_id files zClear request_id for %sN)r r r r r$ r r r )r s r remove_req_id_filesr3 T s_ /00 > >-t444BGLL!5t<<====> >r c t j g ddd t d dS # t t t j f$ r6} t ddt | i Y d} ~ dS d} ~ ww xY w) z Restart X Ray Agent )z /sbin/servicez xray-agentrestartT)capture_outputtextzX Ray Agent restartedzFailed to restart X-Ray Agenterr)extraN) subprocessrunr r$ r ValueErrorSubprocessErrorerrorstr)r s r restart_agentr@ ] s , # # # '+ 7 7 7 7 +,,,,,Z!;<