diff --git a/yunohost_app.py b/yunohost_app.py index 9dda8233..762022c7 100644 --- a/yunohost_app.py +++ b/yunohost_app.py @@ -178,6 +178,7 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True) raise YunoHostError(1, _("App is already installed")) 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 } if 'dependencies' in manifest: _install_app_dependencies(manifest['dependencies']) @@ -198,13 +199,40 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True) 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']) - if is_webapp: domain_add([domain], web=True) + if is_webapp: + domain_add([domain], web=True) + # Customize apache conf + a2_conf_lines = [ + 'Alias '+ path +' '+ app_final_path + manifest['launch_path'] + ] + + if manifest['yunohost']['webapp']['language'] == 'php': + a2_conf_lines.extend([ + '', + ' AddType application/x-httpd-php .php', + ' ', + ' SetHandler application/x-httpd-php', + ' ', + ' AddType application/x-httpd-php-source .phps', + ' ', + ' DirectoryIndex index.php index.html', + ' ', + '' + ]) + + 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) + + with open(a2_conf_file, 'a') as file: + for line in a2_conf_lines: + file.write(line + '\n') + + os.system('service apache2 reload') # 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) @@ -215,20 +243,6 @@ def app_install(app, domain, path='/', label=None, public=False, protected=True) app_setting_path = apps_setting_path +'/'+ unique_app_id - # Customize apache conf - a2_conf_lines = [ - 'Alias '+ path +' '+ app_final_path + manifest['launch_path'] - ] - - 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) - - with open(a2_conf_file, 'a') as file: - for line in a2_conf_lines: - file.write(line + '\n') - - os.system('service apache2 reload') - # TMP: Remove old settings if os.path.exists(app_setting_path): shutil.rmtree(app_setting_path) diff --git a/yunohost_domain.py b/yunohost_domain.py index 9f4df983..8be98ca3 100644 --- a/yunohost_domain.py +++ b/yunohost_domain.py @@ -212,7 +212,7 @@ def _lemon_config(domain): "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Auth-User'} = '$uid';", "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Remote-User'} = '$uid';", "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Desc'} = '$description';", - "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Email'} = '$uid';", + "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Email'} = '$mail';", "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Name'} = '$cn';", "$tmp->{'exportedHeaders'}->{'"+ domain +"'}->{'Authorization'} = '\"Basic \".encode_base64(\"$uid:$_password\")';", "$tmp->{'vhostOptions'}->{'"+ domain +"'}->{'vhostMaintenance'} = 0;",