1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/moncycle_ynh.git synced 2024-09-03 19:46:16 +02:00

Merge pull request #18 from Limezy/v7.6

V7.6 with fixed upgrade
This commit is contained in:
Limezy 2023-12-04 23:17:38 +06:30 committed by GitHub
commit b0bd6b8603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 71 additions and 9 deletions

View file

@ -7,6 +7,8 @@
** https://github.com/jean-io/moncycle.app
*/
define("APP_URL", "__DOMAIN__/__PATH__");
define("DB_HOST", "localhost");
define("DB_ID", "__DB_USER__");
define("DB_NAME", "__DB_NAME__");

17
conf/migrate_7.0.5.sql Normal file
View file

@ -0,0 +1,17 @@
SET NAMES utf8mb4;
CREATE TABLE `jetton` (
`no_jetton` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`no_compte` mediumint(8) unsigned DEFAULT NULL,
`nom` varchar(256) COLLATE utf8mb4_bin NOT NULL,
`expire` tinyint(1) unsigned NOT NULL DEFAULT 0,
`pays` varchar(2) COLLATE utf8mb4_bin DEFAULT NULL,
`date_creation` timestamp NOT NULL DEFAULT current_timestamp(),
`date_use` timestamp NULL DEFAULT NULL,
`jetton_str` varchar(512) COLLATE utf8mb4_bin NOT NULL,
`captcha` varchar(16) COLLATE utf8mb4_bin DEFAULT NULL,
PRIMARY KEY (`no_jetton`),
UNIQUE KEY `jetton_str` (`jetton_str`),
KEY `no_compte` (`no_compte`),
CONSTRAINT `observation_ibfk_2` FOREIGN KEY (`no_compte`) REFERENCES `compte` (`no_compte`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;

View file

@ -26,9 +26,12 @@ location __PATH__/ {
}
# Default indexes and catch-all
rewrite ^__PATH__/(connexion|inscription|compte|export)$ __PATH__/$1.php;
rewrite ^/(export|inscription|compte)$ /$1.php;
rewrite ^/(connexion)$ /$1.html;
rewrite ^/api/(deconnexion)$ /api/$1.php;
rewrite ^/img/(captcha)$ /img/$1.php;
index index.html index.php;
try_files $uri $uri/ __PATH__/index.php?$args;
try_files $uri $uri.php $uri/index.php $uri/ $1?$args $1.php?$args;
# Execute and serve PHP files
location ~ [^/]\.php(/|$) {

View file

@ -5,7 +5,7 @@ name = "Moncycle"
description.en = "Menstrual cycle follow-up for natural family planning"
description.fr = "Suivi de cycle pour les méthodes naturelles de régulation de naissance"
version = "7.0~ynh5"
version = "7.0~ynh6"
maintainers = ["Raoul de Limezy"]
@ -35,12 +35,11 @@ ram.runtime = "50M"
[install.init_main_permission]
type = "group"
default = false
[resources]
[resources.sources.main]
url = "https://github.com/jean-io/moncycle.app/archive/v7.tar.gz"
sha256 = "25f435a55304a5692f55a681971ac41a034c527a87198612e3bfadb7a3b92028"
url = "https://github.com/jean-io/moncycle.app/archive/4ee55999138825fd2f309fa27a69bafe6f5a0c36.zip"
sha256 = "94c3010d12f9650ea87aecde046ef0ba4102308b566de94868adc76c69c22ccf"
[resources.system_user]
@ -50,7 +49,7 @@ ram.runtime = "50M"
main.url = "/"
[resources.apt]
packages = "mariadb-server, php8.2-gd, php8.2-mysql"
packages = "mariadb-server, php8.2-gd, php8.2-mysql, php8.2-mbstring"
[resources.database]
type = "mysql"

View file

@ -6,6 +6,8 @@
# PHP APP SPECIFIC
#=================================================
YNH_COMPOSER_VERSION="2.6.5"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -18,6 +18,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1
ynh_setup_source --dest_dir="$install_dir"
ynh_exec_warn_less mkdir "$install_dir/sessions"
ynh_exec_warn_less mkdir "$install_dir/soap_cache"
ynh_exec_warn_less mkdir "$install_dir/composer"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
@ -25,11 +27,23 @@ chown -R $app:www-data "$install_dir"
pushd "$install_dir"
ynh_exec_warn_less mv ./www_data/* .
ynh_exec_warn_less ./module/install.sh
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < db/table.sql
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < db/demo.sql
popd
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL COMPOSER DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing composer dependencies..." --weight=1
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --composerversion="$YNH_COMPOSER_VERSION" --workdir="$install_dir"
# worckaround while https://github.com/chartjs/Chart.js/issues/11478 is not fixed
ynh_exec_warn_less mkdir "$install_dir/vendor/chartjs"
ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js
#=================================================
# PHP-FPM CONFIGURATION
#=================================================

View file

@ -30,6 +30,8 @@ popd
ynh_setup_source --dest_dir="$install_dir" --full_replace=1
ynh_exec_warn_less mkdir "$install_dir/sessions"
ynh_exec_warn_less mkdir "$install_dir/soap_cache"
ynh_exec_warn_less mkdir "$install_dir/composer"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
@ -38,9 +40,32 @@ chown -R $app:www-data "$install_dir"
pushd "$install_dir"
ynh_exec_warn_less mv ./www_data/* .
ynh_exec_warn_less mv /tmp/config.php .
ynh_exec_warn_less ./module/install.sh
ynh_script_progression --message="Checking if a database migration is needed"
if ynh_compare_current_package_version --comparison le --version 7.0~ynh5
then
ynh_script_progression --message="Database migration required, migrating"
ynh_add_config --template="../conf/migrate_7.0.5.sql" --destination="$install_dir/migrate.sql"
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < migrate.sql
else
ynh_script_progression --message="Database migration not required"
fi
popd
#=================================================
# SPECIFIC SETUP
#=================================================
# INSTALL COMPOSER DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing composer dependencies..." --weight=1
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --composerversion="$YNH_COMPOSER_VERSION" --workdir="$install_dir"
# worckaround while https://github.com/chartjs/Chart.js/issues/11478 is not fixed
ynh_exec_warn_less mkdir "$install_dir/vendor/chartjs"
ynh_exec_warn_less curl -o "$install_dir/vendor/chartjs"/chart.js https://cdn.jsdelivr.net/npm/chart.js
#=================================================
# PHP-FPM CONFIGURATION
#=================================================