Viewing File: /opt/alt/alt-php-config/alt-php-panel-configuration.pyo
ó
ÒÉ‚jc @ s d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z y d d l j j
Z
Wn e k
r d d l Z
n Xd Z
d „ Z d „ Z d „ Z d „ Z d
„ Z d „ Z d „ Z d
„ Z d „ Z d „ Z e d k re j e e j d ƒ ƒ n d S( iÿÿÿÿN( t copy2t checkt installt uninstallc C s t j j d ƒ s t St S( sk
Check is it environment with installed plesk panel
@rtype : bool
@return True or False
s /usr/sbin/plesk( t ost patht existst Falset True( ( ( s6 /opt/alt/alt-php-config/alt-php-panel-configuration.pyt is_plesk s c
C s\ t j j d ƒ s t St t j d ƒ ( } t j d d g d | d | ƒ} Wd QX| d k S( sj
Check if we're in environment with enabled cagefs
@rtype : bool
@return True or False
s /usr/sbin/cagefsctlt wbs --cagefs-statust stdoutt stderrNi ( R R R R t opent devnullt
subprocesst call( R t result( ( s6 /opt/alt/alt-php-config/alt-php-panel-configuration.pyt
has_cagefs s c C s t ƒ o t ƒ S( sŽ
Check is it environment with installed plesk panel on clean ELS system without cagefs
@rtype : bool
@return True or False
( R R ( ( ( s6 /opt/alt/alt-php-config/alt-php-panel-configuration.pyt
is_bare_plesk- s c C sƒ | r t j } n t j } t j ƒ } | j | ƒ d } t j | d ƒ } | j | ƒ t j ƒ } | j | ƒ | j | ƒ | S( sÉ
Logging configuration function
:type verbose: bool
:param verbose: Enable additional debug output if True, display only errors
othervise
:return: configured logger object
s %(levelname)-8s: %(message)ss %H:%M:%S %d.%m.%y( t loggingt DEBUGt ERRORt
StreamHandlert setLevelt Formattert setFormattert getLoggert
addHandler( t verboset levelt handlert
log_formatt formattert logger( ( s6 /opt/alt/alt-php-config/alt-php-panel-configuration.pyt configure_logging6 s
c C sE g } x. t j d ƒ D] } | j | d | f ƒ q W| j ƒ | S( s¨
Returns list of installed alt-php versions and their base directories
:rtype: list
:return: List of version (e.g. 44, 55) and base directory tuples
s /opt/alt/php[0-9][0-9]iþÿÿÿ( t globt appendt sort( t php_versionst php_dir( ( s6 /opt/alt/alt-php-config/alt-php-panel-configuration.pyt find_alt_php_versionsN s
c C s¸ t j d d g d t j d t j d t ƒ} | j ƒ \ } } x[ | j d ƒ D]J } d | | f | j ƒ j d ƒ d k rO t j d
| | f ƒ t SqO Wt j d | | f ƒ t
S( sx
:param php_ver: alt-php version (e.g. 44, 55, 70)
:return: If handler exist returns True, otherwise False
s /usr/local/psa/bin/php_handlers --listR R t universal_newliness
s alt-php%s-%st i s Handler for alt-php%s-%s exist.s# Handler for alt-php%s-%s not exist.( R t Popent PIPEt STDOUTR t communicatet splitt stripR t infoR ( t cgi_typet php_vert proct outt _t line( ( s6 /opt/alt/alt-php-config/alt-php-panel-configuration.pyt plesk_check_php_handler\ s )c C s t ƒ r$ t j d | | f ƒ t St | | ƒ rN t j d | | f ƒ t St j d | | f ƒ t j j d j | | ƒ ƒ d } | d d d | | f d t
j j | d
ƒ d t
j j | d ƒ d
| d d | | f g } | d k rw| j
d d | d t
j j | d ƒ d t
j j | d ƒ g ƒ t
j j d | ƒ s™t t
j j | d ƒ t
j j | d ƒ ƒ q™n"