B4BY.588
Home
Terminal
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
alt
/
alt-php-config
/
Filename :
alt-php-panel-configuration.pyc
back
Copy
� &teic @ 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"