1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/emailpoubelle_ynh.git synced 2024-09-03 18:26:29 +02:00

Merge pull request #4 from Krakinou/Testing

include SQL correction and nginx correction
This commit is contained in:
Krakinou 2018-12-01 11:57:32 +01:00 committed by GitHub
commit bc3f24c8e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 7 deletions

View file

@ -28,7 +28,7 @@ TODO :
[ ] remove new locale on remove [ ] remove new locale on remove
[ ] Why the flag don't show?? [X] Why the flag don't show??
[X] Implement Admin panel [X] Implement Admin panel

View file

@ -2,7 +2,7 @@ location YNH_EXAMPLE_PATH {
# Path to source # Path to source
alias YNH_EXAMPLE_ALIAS ; alias YNH_EXAMPLE_ALIAS ;
# Example PHP configuration # Example PHP configuration
index index.php; index www/index.php;
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;

View file

@ -7,7 +7,7 @@
"fr": "Créez des adresses email jetables qui redirigent les mails vers votre adresse réelle" "fr": "Créez des adresses email jetables qui redirigent les mails vers votre adresse réelle"
}, },
"url": "https://framagit.org/kepon/emailPoubellePhp/", "url": "https://framagit.org/kepon/emailPoubellePhp/",
"version": "2.0~ynh2", "version": "2.0~ynh3",
"license": "Beerware", "license": "Beerware",
"maintainer": { "maintainer": {
"name": "krakinou", "name": "krakinou",

View file

@ -74,6 +74,7 @@ ynh_replace_string "Template-exemple" "$domain" $final_path/www/index.php
#Temporaire - mettre en config #Temporaire - mettre en config
ln -s $final_path/lang/fr $final_path/lang/fr_FR ln -s $final_path/lang/fr $final_path/lang/fr_FR
ln -s $final_path/lang/it $final_path/lang/it_IT ln -s $final_path/lang/it $final_path/lang/it_IT
ln -s $final_path/www/template-exemple $final_path/template-exemple
#=============================================== #===============================================
@ -121,7 +122,7 @@ sudo newaliases
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
sudo sed -i "s@YNH_EXAMPLE_PATH@$path_url@g" ../conf/nginx.conf sudo sed -i "s@YNH_EXAMPLE_PATH@$path_url@g" ../conf/nginx.conf
sudo sed -i "s@YNH_EXAMPLE_ALIAS@$final_path/www/@g" ../conf/nginx.conf sudo sed -i "s@YNH_EXAMPLE_ALIAS@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf
# Handle root path, avoid double slash. # Handle root path, avoid double slash.

View file

@ -60,9 +60,16 @@ if [[ $?==0 ]]; then
ynh_replace_string "define('ALIASLIMITBYMAIL" "//define('ALIASLIMITBYMAIL" $final_path/conf.php ynh_replace_string "define('ALIASLIMITBYMAIL" "//define('ALIASLIMITBYMAIL" $final_path/conf.php
#setting conf file not world-readable (dude, there is a plain-text password !) #setting conf file not world-readable (dude, there is a plain-text password !)
sudo chmod o-r $final_path/conf.php sudo chmod o-r $final_path/conf.php
fi fi
#change nginx.conf as per https://forum.yunohost.org/t/need-help-on-nginx-conf-cannot-access-resources/6342
ynh_replace_string "alias $finalpath/www/ ;" "alias $finalpath/ ;" /etc/yunohost/$domain.d/$app.conf
ynh_replace_string "index index.php;" "index www/ndex.php;" /etc/yunohost/$domain.d/$app.conf
#correct template name in index.php
ynh_replace_string "Template-exemple" "$domain" $final_path/www/index.php
#mysqlpwd setting was implemented in ynh2 - check if saved and if not implement #mysqlpwd setting was implemented in ynh2 - check if saved and if not implement
db_pass=$(ynh_app_setting_get $app mysqlpwd) db_pass=$(ynh_app_setting_get $app mysqlpwd)
if [ -z $db_pass]; then if [ -z $db_pass]; then
@ -83,11 +90,15 @@ cp ../src/README.md $final_path/README.md
cp ../src/CHANGELOG.md $final_path/CHANGELOG.md cp ../src/CHANGELOG.md $final_path/CHANGELOG.md
cp ../src/conf-dist.php $final_path/conf-dist.php cp ../src/conf-dist.php $final_path/conf-dist.php
cp ../conf/index_source.php $final_path/www/index.php cp ../conf/index_source.php $final_path/www/index.php
test -e $final_path/template-exemple
if [[ ! $? -eq 0 ]]; then
ln -s $final_path/www/template-exemple $final_path/template-exemple
fi
#Temporaire - mettre en config #Temporaire - mettre en config
ln -s $final_path/lang/fr $final_path/lang/fr_FR ln -s $final_path/lang/fr $final_path/lang/fr_FR
ln -s $final_path/lang/it $final_path/lang/it_IT ln -s $final_path/lang/it $final_path/lang/it_IT
chown -R www-data:www-data $final_path chown -R www-data:www-data $final_path
#adding php-cli for cron #adding php-cli for cron

View file

@ -79,7 +79,13 @@ function AjouterAlias($status, $alias,$email, $life, $comment) {
die(); die();
} }
UpdateVirtualDB(); UpdateVirtualDB();
return $dbco->lastInsertId(); if (preg_match('/^sqlite/', DB)) {
return $dbco->lastInsertId();
} else {
$stmt = $dbco->query("SELECT LAST_INSERT_ID()");
return $stmt->fetchColumn();
}
} }
// delete email // delete email