mirror of
https://github.com/YunoHost-Apps/freshrss_ynh.git
synced 2024-09-03 18:36:33 +02:00
Rollback to post_user_create
Delete post_app_remove_access
This commit is contained in:
parent
f9c2bad137
commit
eee878db51
2 changed files with 32 additions and 19 deletions
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
app=$1
|
|
||||||
deleted_users=$2
|
|
||||||
|
|
||||||
|
|
||||||
if [[ "freshrss" = "$app" ]];
|
|
||||||
then
|
|
||||||
db_user=freshrss
|
|
||||||
db_name=freshrss
|
|
||||||
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
|
|
||||||
|
|
||||||
#for each deleted users
|
|
||||||
for myuser in $(echo "$deleted_users" | sed "s/,/ /g")
|
|
||||||
do
|
|
||||||
#drop all 3 tables
|
|
||||||
mysql -u root -p$root_pwd -e "DROP TABLE $myuser\_entry; DROP TABLE $myuser\_feed; DROP TABLE $myuser\_catefory;" $db_name
|
|
||||||
done
|
|
||||||
fi
|
|
32
hooks/post_user_create
Executable file
32
hooks/post_user_create
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
db_user=freshrss
|
||||||
|
db_name=freshrss
|
||||||
|
db_pwd=$(sudo yunohost app setting freshrss mysqlpwd)
|
||||||
|
app_path=/var/www/freshrss
|
||||||
|
|
||||||
|
myuser=$1
|
||||||
|
|
||||||
|
#check wallabag
|
||||||
|
if [[ $(sudo yunohost app list -f wallabag | /bin/grep -q "installed: True") -eq 0 ]]; then
|
||||||
|
echo "Detected wallabag"
|
||||||
|
$wallabagPath=$(sudo yunohost app setting wallabag path)
|
||||||
|
$wallabagUrl=$domain$wallabagPath
|
||||||
|
$sharingWallabag="array('type' => 'wallabag','name' => 'Wallabag','url' => 'https://$wallabagUrl',),"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#copy sql
|
||||||
|
sudo cp $app_path/app/SQL/install_ynh.sql /tmp/$myuser-install.sql
|
||||||
|
#change username in sql
|
||||||
|
sudo sed -i "s/YnoUser/$myuser/g" /tmp/$myuser-install.sql
|
||||||
|
#create tables
|
||||||
|
mysql -u $db_user -p$db_pwd $db_user < /tmp/$myuser-install.sql
|
||||||
|
#remove temp sql
|
||||||
|
sudo rm /tmp/$myuser-install.sql
|
||||||
|
#copy default conf
|
||||||
|
sudo cp $app_path/data/user.php.dist $app_path/data/$myuser\_user.php
|
||||||
|
#change username
|
||||||
|
sudo sed -i "s/YnoUser/$myuser/g" $app_path/data/$myuser\_user.php
|
||||||
|
#add wallabag sharing
|
||||||
|
sudo sed -i "s/sharingArrayYnh/$sharingWallabag/g" $final_path/data/$myuser\_user.php
|
Loading…
Add table
Reference in a new issue