|9eddlmZddlZddlmZmZmZddlmZm Z ddl m Z ddl m Z mZddlmZdd lmZdd lmZGd d e ZdS) )absolute_importN)ListDictTuple)MODULES_LOGS_DIRCL_SELECTOR_BIN)WizardInstaller)InstallationFailedExceptionPackageMissingError)ExternalProgramFailed)check_cagefs_initialized)FeatureceZdZejedZej Z dZ dZ dZ dZedZedZedZd Zd Zd Zd Zd S) PhpInstallerzphp.logc |jd| |tdddd|dgdS#t$rt wxYw)Nz)trying to set default php version as '%s'set --interpreterphpz--default-version--json app_loggerinfo _run_commandrr r )selfversions K/opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/modules/php.py_set_default_php_versionz%PhpInstaller._set_default_php_versions H'RRR 0   #Wh8 9 9 9 9 9% 0 0 0-// / 0 !AAc |jd| |tdddd|dgdS#t$rt wxYw)Nz%trying to set PHP Selector state '%s'rrrz--selector-statusrr)rstatuss r_set_cloudlinux_selector_statusz,PhpInstaller._set_cloudlinux_selector_status's DfMMM 0   #VX7 8 8 8 8 8% 0 0 0-// / 0rc|jdd|g}|D]0}d|ddz}||1 |j|dS#t $rtwxYw)z Install given php versions via groups :param versions: e.g ['4.4', '5.4', '5.6'] :return: None z)php version '%s' is going to be installed,zalt-php.N)rrjoinreplaceappend_install_groupsr r )rversionsgroupsv package_names r_install_php_versionz!PhpInstaller._install_php_version1s H#((S[J\J\]]] ( (A$qyyb'9'99L MM, ' ' ' ' 0 !D & ) ) ) )$ 0 0 0-// / 0s % A11B cF|d}|dg}|d}|r/|r-||vr)|jd|t||t r|r1|d|r||d Sd S |dd S#t$r3}|jdt|Yd }~d Sd }~wwxYwd S) a Run installation of php module It is possible to install only alt-php packages and skip further installation if 'enable_selector': False Otherwise we will configure php selector also -- set selector status to enabled -- set default version if it was passed :param options: {'versions': [5.5, 5.6], 'enable_selector': True} :return: default_versionr+enable_selectorzSVersion %s that specified to be set as default must be included in install_versionsenabled)r!disabledz/Error occurred while disabling PHP Selector: %sN) getrerrorr r/rr"r Exceptionstr)roptionsr1install_versionsto_enable_selectores rrun_installationzPhpInstaller.run_installationIs"++&788";;z266$[[):;;  4 4?:J#J#J%%;r+r1r2)clss rsupported_optionszPhpInstaller.supported_optionsnsAAAAc ddlm}n#t$rtdwxYw|dS)NrClSelect lvemanager)clselect.clselectrE ImportErrorr get_versionrDs r_php_get_default_versionz%PhpInstaller._php_get_default_versionrsb 4 2 2 2 2 2 2 2 4 4 4%l33 3 4xzz%%''** #cb ddlm}n#t$rtdwxYw|dS)Nr"interpreter_versions_short_summaryrFr)clselect.clselectctlrNrHr rMs r_php_interpreters_listz#PhpInstaller._php_interpreters_list{sV 4 O O O O O O O 4 4 4%l33 3 411%888rKcdddidg}|S)zh Get list of warnings that should be shown in wizard before module installation zFurther CloudLinux PHP Selector setup will be available in LVE Manager settings after installation. More details you can find in our documentation %(url)s.urlz:https://docs.cloudlinux.com/php_selector_installation.html)messagecontextr?)rwarningss r _get_warningszPhpInstaller._get_warningss+@[\   rBc:g}|D]$}|js ||j%t ||||d|d|dS)Nr)r1installed_versionsavailable_versionsr2)already_configuredr9rU) rP installedr)ranyrJ_get_available_versions_is_php_selector_enabledrV)rrXits rinitial_statuszPhpInstaller.initial_statuss --// 2 2B<   % %bj 1 1 1 1#&&8"9"9#'#@#@#B#B&8&*&B&B5&I&I#'#@#@#B#B  **,,   rBc`tto|S)zM Return True if Php Selector enabled in UI and could be used )boolr"_is_php_selector_enabled_in_config)rs rr^z%PhpInstaller._is_php_selector_enableds7 ,..B??AACC CrBc|jd ddlm}|dS#t $rYdSwxYw)zn Return True if Php Selector is enabled for UI in panel specific (DA, Plesk or cPanel) config z!trying to get Php Selector state.r)CloudlinuxSelectorLibrF)rrclselector.selectorlibrephp_selector_is_enabledrH)rres rrcz/PhpInstaller._is_php_selector_enabled_in_configsq @AAA  D D D D D D((//GGII I   55 s"? A  A N)__name__ __module__ __qualname__ospathr'rLOG_FILEr PHP_SELECTOR_REQUIRED_CL_COMPONENT_SUPPORTrr"r/r= classmethodrA staticmethodrJrPrVr`r^rcr?rBrrrsw||,i88H%,%9"0000000000#e#e#eJBB[B++\+99\9$   *CCC     rBr) __future__rrktypingrrrclwizard.constantsrrbaser clwizard.exceptionsr r clcommon.utilsr !clconfig.cagefs_statistics_configrclcommon.constrrr?rBrrzs'&&&&& $$$$$$$$$$@@@@@@@@QPPPPPPP000000FFFFFF""""""eeeee?eeeeerB