Fixers in manager_apache
This commit is contained in:
parent
8231aa715c
commit
592ad67719
5 changed files with 66 additions and 49 deletions
17
admin/app.py
17
admin/app.py
|
|
@ -82,6 +82,7 @@ def options_options(row_id, row):
|
|||
#
|
||||
#arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.ports', webserver_id=row_id), _('HTTP Ports')))
|
||||
#arr_options.append('<a href="{}">{}</a>'.format("", _('Edit')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.webservers_edit_languages', webserver_id=row_id), _('Languages')))
|
||||
arr_options.append('<a href="{}">{}</a>'.format(url_for('admin_app.delete_webserver', webserver_id=row_id), _('Delete')))
|
||||
|
||||
return '<br />'.join(arr_options)
|
||||
|
|
@ -628,7 +629,7 @@ def edit_virtualhost(virtualhost_id):
|
|||
virtual=VirtualHost(db)
|
||||
|
||||
#arr_vhost=virtual.select_a_row(virtualhost_id, [], True)
|
||||
with virtual.query('select virtualhost.*, webserver.id, serverdbtask.distro from virtualhost, webserver, serverdbtask WHERE virtualhost.id=%s AND virtualhost.webserver_id=webserver.id AND webserver.server_id=serverdbtask.id', [virtualhost_id]) as cursor:
|
||||
with virtual.query('select virtualhost.*, webserver.id, serverdbtask.distro, serverdbtask.id from virtualhost, webserver, serverdbtask WHERE virtualhost.id=%s AND virtualhost.webserver_id=webserver.id AND webserver.server_id=serverdbtask.id', [virtualhost_id]) as cursor:
|
||||
|
||||
arr_vhost=cursor.fetchone()
|
||||
|
||||
|
|
@ -676,11 +677,23 @@ def edit_virtualhost(virtualhost_id):
|
|||
|
||||
virtual.fields['php'].label=_('PHP support')
|
||||
virtual.fields['php'].name_form=SelectForm
|
||||
"""
|
||||
if arr_vhost['distro']!='arch':
|
||||
virtual.fields['php'].extra_parameters=[{'': 'No php support', '7.4': 'PHP 7.4', '8.0': 'PHP 8.0', '8.1': 'PHP 8.1', '8.2': 'PHP 8.2', '8.3': 'PHP 8.3'}]
|
||||
else:
|
||||
virtual.fields['php'].extra_parameters=[{'': 'No php support', '8.1': 'PHP 8.1 (On Arch, php-legacy for maximum compatibility)'}]
|
||||
"""
|
||||
with db.query('select * from phpserver where server_id=%s', [arr_vhost['serverdbtask.id']]) as cursor:
|
||||
arr_php=cursor.fetchall()
|
||||
|
||||
#print(arr_php)
|
||||
|
||||
virtual.fields['php'].extra_parameters=[{'': 'No php support'}]
|
||||
|
||||
for p in arr_php:
|
||||
#print(p['version'])
|
||||
virtual.fields['php'].extra_parameters[0][p['version']]='PHP '+p['version']
|
||||
|
||||
virtual.fields['php'].help=_('Add support to php to virtualhost. You can choose ophp version that you prefer')
|
||||
|
||||
#'port', 'ssl_port',
|
||||
|
|
@ -829,7 +842,7 @@ def save_edit_virtualhost():
|
|||
php=request.form.get('php', '')
|
||||
|
||||
if php!='':
|
||||
if php!='7.4' and php!='8.0' and php!='8.1' and php!='8.2' and php!='8.3':
|
||||
if php!='8.2' and php!='8.3' and php!='8.4':
|
||||
php=''
|
||||
|
||||
task_id=0
|
||||
|
|
|
|||
|
|
@ -164,47 +164,6 @@ if [ "$DISTRO" = 'debian' ] || [ "$DISTRO" = 'ubuntu' ]; then
|
|||
|
||||
fi
|
||||
|
||||
if [ -f "/usr/local/bin/composer" ]; then
|
||||
|
||||
echo "Updating composer..."
|
||||
|
||||
# need sudo for composer autoupdate
|
||||
|
||||
sudo /usr/local/bin/composer self-update
|
||||
|
||||
else
|
||||
|
||||
echo "Installing composer..."
|
||||
|
||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||
|
||||
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
|
||||
then
|
||||
>&2 echo 'ERROR: Invalid installer checksum'
|
||||
rm composer-setup.php
|
||||
exit 1
|
||||
fi
|
||||
|
||||
php composer-setup.php --quiet
|
||||
RESULT=$?
|
||||
rm composer-setup.php
|
||||
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
|
||||
echo '{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Composer installed sucessfully..."}'
|
||||
|
||||
else
|
||||
echo '{"error": 1, "status": 1, "progress": 100, "no_progress":0, "message": "Error: cannot install composer!"}'
|
||||
|
||||
exit 1
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
elif [ "$DISTRO" = 'rocky' ] || [ "$DISTRO" = 'almalinux' ] || [ "$DISTRO" = 'fedora' ]; then
|
||||
|
||||
|
|
@ -316,3 +275,46 @@ else
|
|||
|
||||
|
||||
fi
|
||||
|
||||
echo "Installing composer..."
|
||||
|
||||
if [ -f "/usr/local/bin/composer" ]; then
|
||||
|
||||
echo "Updating composer..."
|
||||
|
||||
# need sudo for composer autoupdate
|
||||
|
||||
sudo /usr/local/bin/composer self-update
|
||||
|
||||
else
|
||||
|
||||
echo "Installing composer..."
|
||||
|
||||
EXPECTED_CHECKSUM="$(php -r 'copy("https://composer.github.io/installer.sig", "php://stdout");')"
|
||||
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
|
||||
ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
|
||||
|
||||
if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]
|
||||
then
|
||||
>&2 echo 'ERROR: Invalid installer checksum'
|
||||
rm composer-setup.php
|
||||
exit 1
|
||||
fi
|
||||
|
||||
php composer-setup.php --quiet
|
||||
RESULT=$?
|
||||
rm composer-setup.php
|
||||
|
||||
sudo mv composer.phar /usr/local/bin/composer
|
||||
|
||||
if [ $RESULT -eq 0 ]; then
|
||||
|
||||
echo '{"error": 0, "status": 0, "progress": 100, "no_progress":0, "message": "Composer installed sucessfully..."}'
|
||||
|
||||
else
|
||||
echo '{"error": 1, "status": 1, "progress": 100, "no_progress":0, "message": "Error: cannot install composer!"}'
|
||||
|
||||
exit 1
|
||||
|
||||
fi
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ def manage():
|
|||
json_return['error']=0
|
||||
json_return['status']=0
|
||||
json_return['progress']=100
|
||||
json_return['message']='Cleaning certbot ssl certificate for the domain'
|
||||
json_return['message']='Cleaning certbot ssl certificate for the domain...'
|
||||
|
||||
print(json.dumps(json_return))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
from paramecio2.libraries.config_admin import config_admin
|
||||
from paramecio2.libraries.i18n import I18n
|
||||
from modules.apache.admin import install_apps
|
||||
from modules.apache.admin import languages
|
||||
|
||||
#modules_admin=[[I18n.lang('admin', 'users_admin', 'User\'s Admin'), 'paramecio.modules.admin.admin.ausers', 'ausers']]
|
||||
|
||||
config_admin.append([I18n.lang('webservers', 'webservers_apache_admin', 'Apache Webservers')])
|
||||
|
||||
config_admin.append([I18n.lang('webservers', 'webservers_apache', 'Webservers'), 'modules.apache.admin.app', 'admin_app.webservers', 'fa-globe'])
|
||||
#config_admin.append([I18n.lang('webservers', 'webservers_apache', 'Webservers'), 'modules.apache.admin.languages', 'admin_app.webservers', 'fa-globe'])
|
||||
#config_admin.append([I18n.lang('webservers', 'webservers', 'Webservers'), 'modules.webservers.admin.install_apps', 'admin_app.install_apps', 'fa-globe'])
|
||||
|
|
|
|||
|
|
@ -18,13 +18,13 @@ class ServerTask(Task):
|
|||
|
||||
self.name_task='Edit virtualhost in server'
|
||||
|
||||
self.description_task='Edot a virtual host in a server, or many of them'
|
||||
self.description_task='Edit a virtual host in a server, or many of them'
|
||||
|
||||
self.codename_task='edit_virtualhost_apache'
|
||||
|
||||
self.files=[]
|
||||
|
||||
self.files=[['modules/apache/scripts/manage_apache.py', 0o755], ['modules/apache/scripts/files/vhost.tpl', 0o644]]
|
||||
self.files=[['modules/apache/scripts/manage_apache.py', 0o755], ['modules/apache/scripts/add_php_vhost.py', 0o755], ['modules/apache/scripts/files/vhost.tpl', 0o644]]
|
||||
|
||||
if self.data['ssl']=='2':
|
||||
|
||||
|
|
@ -104,10 +104,10 @@ class ServerTask(Task):
|
|||
if self.data['php']!='':
|
||||
php_support='--php_version='+self.data['php']
|
||||
|
||||
self.files.append(['modules/apache/scripts/check_php.sh', 0o700])
|
||||
self.files.append(['modules/apache/scripts/add_php_vhost.py', 0o700])
|
||||
#self.files.append(['modules/apache/scripts/check_php.sh', 0o700])
|
||||
#self.files.append(['modules/apache/scripts/add_php_vhost.py', 0o700])
|
||||
|
||||
self.commands_to_execute.append(['modules/apache/scripts/check_php.sh', self.data['php']])
|
||||
#self.commands_to_execute.append(['modules/apache/scripts/check_php.sh', self.data['php']])
|
||||
|
||||
self.commands_to_execute.append(['modules/apache/scripts/add_php_vhost.py', '--user=%s --php_version=%s --domain=%s' % (self.data['user'], self.data['php'], self.data['domain']), 'sudo'])
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue