Fixes in dashboard for save php ini in server
This commit is contained in:
parent
05025fbdb5
commit
56157e4adb
3 changed files with 118 additions and 29 deletions
|
|
@ -3,6 +3,7 @@ from pastafariutils import linux
|
|||
import distro
|
||||
import argparse
|
||||
import os
|
||||
import json
|
||||
|
||||
php_versions=['8.2', '8.3', '8.4']
|
||||
|
||||
|
|
@ -18,7 +19,29 @@ args=parser.parse_args()
|
|||
|
||||
version=args.version
|
||||
|
||||
linux.json_log('Getting php.ini from server', error=0, status=0, progress=0, no_progress=1);
|
||||
|
||||
if not version in php_versions:
|
||||
linux.json_log('Error: php version not supported', error=1, status=1, progress=100, no_progress=0);
|
||||
exit(1)
|
||||
|
||||
path_php_ini='/etc/php/php.ini'
|
||||
|
||||
if linux_distro=='debian':
|
||||
path_php_ini='/etc/php/{}/fpm/php.ini'.format(version)
|
||||
|
||||
#print(path_php_ini)
|
||||
|
||||
if not os.path.isfile(path_php_ini):
|
||||
|
||||
linux.json_log('Error: php.ini not found in {}'.path_php_ini(), error=1, status=1, progress=100, no_progress=0);
|
||||
exit(1)
|
||||
|
||||
php_ini_file=''
|
||||
|
||||
with open(path_php_ini) as f:
|
||||
php_ini_file=f.read()
|
||||
|
||||
#print(json.dumps({'error': 0, 'status': 1, 'progress': 100, 'no_progress':0, 'message': '{"distro": "'+distro.id()+'"}', 'result': 1}))
|
||||
|
||||
linux.json_log(json.dumps({'file':php_ini_file}), error=0, status=1, progress=100, no_progress=0, result=1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue