mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Customize apache conf for php
This commit is contained in:
parent
798cee75e1
commit
3ba251e049
2 changed files with 31 additions and 17 deletions
|
@ -178,6 +178,7 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True)
|
||||||
raise YunoHostError(1, _("App is already installed"))
|
raise YunoHostError(1, _("App is already installed"))
|
||||||
|
|
||||||
unique_app_id = manifest['yunohost']['uid'] +'__'+ str(instance_number)
|
unique_app_id = manifest['yunohost']['uid'] +'__'+ str(instance_number)
|
||||||
|
app_final_path = apps_path +'/'+ unique_app_id
|
||||||
script_var_dict = { 'APP_DIR': app_tmp_folder }
|
script_var_dict = { 'APP_DIR': app_tmp_folder }
|
||||||
|
|
||||||
if 'dependencies' in manifest: _install_app_dependencies(manifest['dependencies'])
|
if 'dependencies' in manifest: _install_app_dependencies(manifest['dependencies'])
|
||||||
|
@ -198,28 +199,27 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True)
|
||||||
if 'script_path' in manifest['yunohost']:
|
if 'script_path' in manifest['yunohost']:
|
||||||
_exec_app_script(step='install', path=app_tmp_folder +'/'+ manifest['yunohost']['script_path'], var_dict=script_var_dict, app_type=manifest['type'])
|
_exec_app_script(step='install', path=app_tmp_folder +'/'+ manifest['yunohost']['script_path'], var_dict=script_var_dict, app_type=manifest['type'])
|
||||||
|
|
||||||
if is_webapp: domain_add([domain], web=True)
|
if is_webapp:
|
||||||
|
domain_add([domain], web=True)
|
||||||
# Copy files to the right place
|
|
||||||
try: os.listdir(apps_path)
|
|
||||||
except OSError: os.makedirs(apps_path)
|
|
||||||
|
|
||||||
app_final_path = apps_path +'/'+ unique_app_id
|
|
||||||
|
|
||||||
# TMP: Remove old application
|
|
||||||
if os.path.exists(app_final_path): shutil.rmtree(app_final_path)
|
|
||||||
|
|
||||||
os.system('cp -a "'+ app_tmp_folder +'" "'+ app_final_path +'"')
|
|
||||||
os.system('chown -R www-data: "'+ app_final_path +'"')
|
|
||||||
shutil.rmtree(app_final_path + manifest['yunohost']['script_path'])
|
|
||||||
|
|
||||||
app_setting_path = apps_setting_path +'/'+ unique_app_id
|
|
||||||
|
|
||||||
# Customize apache conf
|
# Customize apache conf
|
||||||
a2_conf_lines = [
|
a2_conf_lines = [
|
||||||
'Alias '+ path +' '+ app_final_path + manifest['launch_path']
|
'Alias '+ path +' '+ app_final_path + manifest['launch_path']
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if manifest['yunohost']['webapp']['language'] == 'php':
|
||||||
|
a2_conf_lines.extend([
|
||||||
|
'<IfModule php5_module>',
|
||||||
|
' AddType application/x-httpd-php .php',
|
||||||
|
' <FilesMatch \.php$>',
|
||||||
|
' SetHandler application/x-httpd-php',
|
||||||
|
' </FilesMatch>',
|
||||||
|
' AddType application/x-httpd-php-source .phps',
|
||||||
|
' <IfModule dir_module>',
|
||||||
|
' DirectoryIndex index.php index.html',
|
||||||
|
' </IfModule>',
|
||||||
|
'</IfModule>'
|
||||||
|
])
|
||||||
|
|
||||||
a2_conf_file = a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf'
|
a2_conf_file = a2_settings_path +'/'+ domain +'.d/'+ unique_app_id +'.app.conf'
|
||||||
if os.path.exists(a2_conf_file): os.remove(a2_conf_file)
|
if os.path.exists(a2_conf_file): os.remove(a2_conf_file)
|
||||||
|
|
||||||
|
@ -229,6 +229,20 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True)
|
||||||
|
|
||||||
os.system('service apache2 reload')
|
os.system('service apache2 reload')
|
||||||
|
|
||||||
|
# Copy files to the right place
|
||||||
|
try: os.listdir(apps_path)
|
||||||
|
except OSError: os.makedirs(apps_path)
|
||||||
|
|
||||||
|
|
||||||
|
# TMP: Remove old application
|
||||||
|
if os.path.exists(app_final_path): shutil.rmtree(app_final_path)
|
||||||
|
|
||||||
|
os.system('cp -a "'+ app_tmp_folder +'" "'+ app_final_path +'"')
|
||||||
|
os.system('chown -R www-data: "'+ app_final_path +'"')
|
||||||
|
shutil.rmtree(app_final_path + manifest['yunohost']['script_path'])
|
||||||
|
|
||||||
|
app_setting_path = apps_setting_path +'/'+ unique_app_id
|
||||||
|
|
||||||
|
|
||||||
# TMP: Remove old settings
|
# TMP: Remove old settings
|
||||||
if os.path.exists(app_setting_path): shutil.rmtree(app_setting_path)
|
if os.path.exists(app_setting_path): shutil.rmtree(app_setting_path)
|
||||||
|
|
|
@ -212,7 +212,7 @@ def _lemon_config(domain):
|
||||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Auth-User'} = '$uid';",
|
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Auth-User'} = '$uid';",
|
||||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Remote-User'} = '$uid';",
|
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Remote-User'} = '$uid';",
|
||||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Desc'} = '$description';",
|
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Desc'} = '$description';",
|
||||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Email'} = '$uid';",
|
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Email'} = '$mail';",
|
||||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Name'} = '$cn';",
|
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Name'} = '$cn';",
|
||||||
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Authorization'} = '\"Basic \".encode_base64(\"$uid:$_password\")';",
|
"$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Authorization'} = '\"Basic \".encode_base64(\"$uid:$_password\")';",
|
||||||
"$tmp->{'vhostOptions'}->{'"+ domain +"'}->{'vhostMaintenance'} = 0;",
|
"$tmp->{'vhostOptions'}->{'"+ domain +"'}->{'vhostMaintenance'} = 0;",
|
||||||
|
|
Loading…
Add table
Reference in a new issue