1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00

Merge pull request #32 from YunoHost-Apps/cron

Added cron and fixed upgrade
This commit is contained in:
James Cole 2021-02-08 06:40:33 +01:00 committed by GitHub
commit 295cb990dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 52 additions and 9 deletions

View file

@ -17,7 +17,7 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=66140e9d21f8d9e07074b5bded213265b06819d5 upgrade=1 from_commit=231c5e281e9cafabd35d4a6ef3c27fec6f3c470f
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0

2
conf/cron Normal file
View file

@ -0,0 +1,2 @@
# cron job for __APP__
0 3 * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/artisan firefly-iii:cron

View file

@ -6,7 +6,7 @@
"en": "Self-hosted financial manager.", "en": "Self-hosted financial manager.",
"fr": "Gestionnaire de finances personnelles." "fr": "Gestionnaire de finances personnelles."
}, },
"version": "5.4.6~ynh1", "version": "5.4.6~ynh2",
"url": "https://firefly-iii.org/", "url": "https://firefly-iii.org/",
"license": "GPL-3.0-or-later", "license": "GPL-3.0-or-later",
"maintainer": { "maintainer": {

View file

@ -60,6 +60,12 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP A CRON FILE
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================

View file

@ -171,6 +171,17 @@ ynh_script_progression --message="Securing files and directories..."
chown -R $app:$app $final_path chown -R $app:$app $final_path
chmod -R 775 ${final_path}/storage chmod -R 775 ${final_path}/storage
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..."
cp ../conf/cron /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================

View file

@ -63,6 +63,16 @@ ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated PHP-FPM config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
#=================================================
ynh_script_progression --message="Removing the cron file..."
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================

View file

@ -102,6 +102,13 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_script_progression --message="Restoring the cron file..."
ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# RESTORE THE LOGROTATE CONFIGURATION # RESTORE THE LOGROTATE CONFIGURATION
#================================================= #=================================================

View file

@ -201,18 +201,14 @@ ynh_script_progression --message="Deploying..."
pushd "$final_path" pushd "$final_path"
php$phpversion artisan migrate:refresh --seed rm -rf bootstrap/cache/*
php$phpversion artisan cache:clear
php$phpversion artisan migrate --seed
php$phpversion artisan firefly-iii:upgrade-database php$phpversion artisan firefly-iii:upgrade-database
php$phpversion artisan passport:install php$phpversion artisan passport:install
php$phpversion artisan cache:clear php$phpversion artisan cache:clear
#rm -rf "$final_path/bootstrap/cache/*"
#php$phpversion artisan cache:clear
#php$phpversion artisan migrate --seed
#php$phpversion artisan firefly-iii:upgrade-database
#php$phpversion artisan passport:install
#php$phpversion artisan cache:clear
popd popd
#================================================= #=================================================
@ -234,6 +230,17 @@ ynh_script_progression --message="Securing files and directories..."
chown -R $app: $final_path chown -R $app: $final_path
chmod -R 775 ${final_path}/storage chmod -R 775 ${final_path}/storage
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..."
cp ../conf/cron /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================