diff --git a/README.md b/README.md index a378d23..df6c799 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Make it easy to monitor menstrual cycles and apply natural methods. Billings. Sy - automatic sending of cycles by email - no data sales/no advertising -**Shipped version:** 7.0~ynh5 +**Shipped version:** 7.0~ynh6 **Demo:** https://tableau.moncycle.app/connexion.php?email1=demo@moncycle.app&mdp=demo diff --git a/README_fr.md b/README_fr.md index a01128c..cf5c3ea 100644 --- a/README_fr.md +++ b/README_fr.md @@ -36,7 +36,7 @@ Rendre facile le suivi des cycles menstruels et l’application des méthodes na - pas de vente de données/pas de publicité -**Version incluse :** 7.0~ynh5 +**Version incluse :** 7.0~ynh6 **Démo :** https://tableau.moncycle.app/connexion.php?email1=demo@moncycle.app&mdp=demo diff --git a/conf/config.php b/conf/config.php index 3bfef15..c12e1ad 100644 --- a/conf/config.php +++ b/conf/config.php @@ -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__"); diff --git a/conf/migrate_7.0.5.sql b/conf/migrate_7.0.5.sql new file mode 100644 index 0000000..6e7fef4 --- /dev/null +++ b/conf/migrate_7.0.5.sql @@ -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; \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 1a00e86..a48fa91 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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(/|$) { diff --git a/manifest.toml b/manifest.toml index c3a1ece..a7d8eb0 100644 --- a/manifest.toml +++ b/manifest.toml @@ -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"] @@ -38,8 +38,8 @@ ram.runtime = "50M" [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] @@ -49,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" diff --git a/scripts/_common.sh b/scripts/_common.sh index 1e47ce7..68a2ae1 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,6 +6,8 @@ # PHP APP SPECIFIC #================================================= +YNH_COMPOSER_VERSION="2.6.5" + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index e5bd13b..c248549 100755 --- a/scripts/install +++ b/scripts/install @@ -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index bba3f33..f938b44 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 #=================================================