1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/abantecart_ynh.git synced 2024-09-03 18:06:16 +02:00

Merge pull request #23 from YunoHost-Apps/testing

App Rebase
This commit is contained in:
myprivacyisgone 2022-01-20 23:40:02 +08:00 committed by GitHub
commit 9c2a7017f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 848 additions and 588 deletions

55
.github/ISSUE_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install the_app
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

136
.github/workflows/updater.sh vendored Executable file
View file

@ -0,0 +1,136 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
exit 1
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# Fetching information
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
echo "${#assets[@]} available asset(s)"
#=================================================
# UPDATE SOURCE FILES
#=================================================
# Here we use the $assets variable to get the resources published in the upstream release.
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
# Let's loop over the array of assets URLs
for asset_url in ${assets[@]}; do
echo "Handling asset at $asset_url"
# Assign the asset to a source file in conf/ directory
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
# Leave $src empty to ignore the asset
case $asset_url in
*"admin"*)
src="app"
;;
*"update"*)
src="app-upgrade"
;;
*)
src=""
;;
esac
# If $src is not empty, let's process the asset
if [ ! -z "$src" ]; then
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -1,12 +0,0 @@
---
dist: trusty
language: node_js
# Use isolated build instance
sudo: required
before_install:
- git clone https://github.com/YunoHost/package_linter /tmp/package_linter
script:
- /tmp/package_linter/package_linter.py ./

View file

@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> {one line to give the program's name and a brief idea of what it does.}
Copyright (C) <year> <name of author> Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode: notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author> {project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.

View file

@ -1,13 +1,54 @@
# abantecart_ynh <!--
Plateforme pour la création de site Ecommerce / Business solution provider N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
## FONCTIONNE / WORK <br> # Abantecart for YunoHost
#### N'UTILSER QUE POUR TEST OU DEVELOPPEMENT !! / USE ONLY FOR TEST OR DEVELOPPMENT !!
<br>
<br>
## Upgrade this package:
`sudo yunohost app upgrade --verbose abantecart -u https://github.com/YunoHost-Apps/abantecart_ynh`
<br>
<br>
level/niveau=2 (Installation et supression)
[![Integration level](https://dash.yunohost.org/integration/abantecart.svg)](https://dash.yunohost.org/appci/app/abantecart) ![](https://ci-apps.yunohost.org/ci/badges/abantecart.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/abantecart.maintain.svg)
[![Install Abantecart with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=abantecart)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Abantecart quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
AbanteCart is a free open source ecommerce platform to power online retail. AbanteCart is a ready to run web application as well as reliable foundation to build custom eCommerce solutions. AbanteCart ecommerce platform is designed to fit a wide variety of online businesses and applications, as well as can be configured or customized to perform very specific business requirements. Chosen by many shop owners launching their business online for the first time, AbanteCart is also picked by developers looking for a user-friendly interface and powerful features set.
**Shipped version:** 1.3.2~ynh1
**Demo:** https://www.abantecart.com/shopping-cart-demo
## Screenshots
![](./doc/screenshots/dashboard.png)
## Disclaimers / important information
### Important points to read before installing
- Instead of upgrading via Yunohost, you should refer to [this guide](https://abantecart.atlassian.net/wiki/spaces/AD/pages/5275676/Upgrade+manually)
## Documentation and resources
* Official app website: https://www.abantecart.com/
* Official user documentation: https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313
* Official admin documentation: https://docs.abantecart.com/
* Upstream app code repository: https://github.com/abantecart/abantecart-src
* YunoHost documentation for this app: https://yunohost.org/app_abantecart
* Report a bug: https://github.com/YunoHost-Apps/abantecart_ynh/issues
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
or
sudo yunohost app upgrade abantecart -u https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

50
README_fr.md Normal file
View file

@ -0,0 +1,50 @@
# Abantecart pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/abantecart.svg)](https://dash.yunohost.org/appci/app/abantecart) ![](https://ci-apps.yunohost.org/ci/badges/abantecart.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/abantecart.maintain.svg)
[![Installer Abantecart avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=abantecart)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Abantecart rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
AbanteCart is a free open source ecommerce platform to power online retail. AbanteCart is a ready to run web application as well as reliable foundation to build custom eCommerce solutions. AbanteCart ecommerce platform is designed to fit a wide variety of online businesses and applications, as well as can be configured or customized to perform very specific business requirements. Chosen by many shop owners launching their business online for the first time, AbanteCart is also picked by developers looking for a user-friendly interface and powerful features set.
**Version incluse :** 1.3.2~ynh1
**Démo :** https://www.abantecart.com/shopping-cart-demo
## Captures d'écran
![](./doc/screenshots/dashboard.png)
## Avertissements / informations importantes
### Important points to read before installing
- Instead of upgrading via Yunohost, you should refer to [this guide](https://abantecart.atlassian.net/wiki/spaces/AD/pages/5275676/Upgrade+manually)
## Documentations et ressources
* Site officiel de l'app : https://www.abantecart.com/
* Documentation officielle utilisateur : https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313
* Documentation officielle de l'admin : https://docs.abantecart.com/
* Dépôt de code officiel de l'app : https://github.com/abantecart/abantecart-src
* Documentation YunoHost pour cette app : https://yunohost.org/app_abantecart
* Signaler un bug : https://github.com/YunoHost-Apps/abantecart_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
ou
sudo yunohost app upgrade abantecart -u https://github.com/YunoHost-Apps/abantecart_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,38 +1,25 @@
;; Nom du test ;; Test complet
auto_remove=1
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) admin="john"
is_public=1 (PUBLIC|public=1|private=0) password="1Strong-Password"
admin_name="john" (USER) is_public=1
admin_pass="08jtiig45f88r7" (PASSWORD)
admin_email="abc@example.com"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=1 setup_sub_dir=0
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=0 upgrade=1
backup_restore=0 upgrade=1 from_commit=acdb6cfdf31a2f02baf5bbcbb5cc0cdaf0a3ac69
multi_instance=1 backup_restore=1
wrong_user=1 multi_instance=0
wrong_path=1 change_url=0
incorrect_path=1 ;;; Options
corrupt_source=1 Email=
fail_download_source=1 Notification=none
port_already_use=0 ;;; Upgrade options
final_path_already_use=1 ; commit=CommitHash
;;; Levels name=Name and date of the commit.
Level 1=auto manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&
Level 2=auto
Level 3=auto
Level 4=na
Level 5=auto
Level 6=auto
Level 7=auto
Level 8=0
Level 9=0
Level 10=0

9
conf/app.src Normal file → Executable file
View file

@ -1,6 +1,5 @@
SOURCE_URL=https://github.com/abantecart/abantecart-src/archive/1.2.15.tar.gz SOURCE_URL=https://github.com/abantecart/abantecart-src/archive/refs/tags/1.3.2.zip
SOURCE_SUM=f4106d1977259e4a08254387c6e2b7a6eb640d419568e79f5cf3394cec96989d SOURCE_SUM=631fd1032e5a32e3041c56e78048d611bcf28ef07bae1ac75bb467190f18f014
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_EXTRACT=true
SOURCE_FILENAME=

95
conf/nginx.conf Normal file → Executable file
View file

@ -1,70 +1,25 @@
#--MULTISITE--if (!-e $request_filename) {
#--MULTISITE--rewrite /wp-admin$ $scheme://$host$uri/ permanent;
#--MULTISITE--rewrite ^__PATH__(/[^/]+)?(/wp-.*) __PATH__$2 last;
#--MULTISITE--rewrite ^__PATH__(/[^/]+)?(/.*\.php)$ __PATH__$2 last;
#--MULTISITE--}
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
alias __FINALPATH__/; # Path to source
alias __FINALPATH__/www/;
# Default indexes and catch-all
index index.php; index index.php;
try_files $uri $uri/ __PATH__/index.php?$args; if (!-e $request_filename) {
rewrite ^(.+)$ __PATH__/index.php?q=$1 last;
# Prevent useless logs
location = __PATH__/favicon.ico {
log_not_found off;
access_log off;
}
location = __PATH__/robots.txt {
allow all;
log_not_found off;
access_log off;
} }
# Make sure files with the following extensions do not get loaded by nginx because nginx would client_max_body_size 30m;
# display the source code, and these files can contain PASSWORDS!
location ~* __PATH__/\.(engine|inc|info|install|make|module|profile|test|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)$|^(\..*|Entries.*|Repository|Root|Tag|Template)$|\.php_ {
deny all;
}
### Retina images handler. Check cookie and looking for file with @2x at the end of name
location ~* ^__PATH__/(.*)\.(jpg|jpeg|png|gif)$ {
set $hidpi_uri $1@2x.png;
if ($http_cookie !~ 'HTTP_IS_RETINA=1') {
break;
}
try_files $hidpi_uri $uri =404;
}
location ~* __PATH__/\.(jpg|jpeg|png|gif|css|js|ico)$ {
expires max;
log_not_found off;
}
#rewrite for images for retina-displays
location ~ __PATH__/ {
if (!-e $request_filename){
rewrite ^/(.*)\?*$ __PATH__/index.php?_route_=$1 last;
}
}
# Deny access to hidden files and directories
location ~ ^__PATH__/(.+/|)\.(?!well-known\/) {
deny all;
}
location __PATH__/admin/ {
location ~ .*\.(php)?$ {
deny all;
return 403;
}
}
location ~ __PATH__/(system/logs|resources/download) {
deny all;
return 403;
}
# Execute and serve PHP files
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock; fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;
@ -72,7 +27,29 @@ location __PATH__/ {
fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param SCRIPT_FILENAME $request_filename;
} }
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location ~* \.(jpg|jpeg|png|gif|css|js|ico|webp)$ {
expires max;
log_not_found off;
}
location ~ /(system/logs|resources/download) {
deny all;
return 403;
}
location /admin/ {
location ~ .*\.(php)?$ {
deny all;
return 403;
}
}
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; include conf.d/yunohost_panel.conf.inc;
} }

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port; ; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket. ; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory. ; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog. ; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD) ; Default Value: 511 (-1 on FreeBSD and OpenBSD)
@ -419,6 +419,7 @@ chdir = __FINALPATH__
;php_admin_value[memory_limit] = 32M ;php_admin_value[memory_limit] = 32M
; Common values to change to increase file upload limit ; Common values to change to increase file upload limit
; php_admin_value[upload_max_filesize] = 50M
; php_admin_value[post_max_size] = 50M ; php_admin_value[post_max_size] = 50M
; php_admin_flag[mail.add_x_header] = Off ; php_admin_flag[mail.add_x_header] = Off
@ -427,17 +428,3 @@ chdir = __FINALPATH__
; php_admin_value[max_input_time] = 300 ; php_admin_value[max_input_time] = 300
; php_admin_value[memory_limit] = 256M ; php_admin_value[memory_limit] = 256M
; php_admin_flag[short_open_tag] = On ; php_admin_flag[short_open_tag] = On
php_admin_value[output_buffering] = 4096;
php_admin_flag[magic_quotes_gpc] = Off;
php_admin_flag[register_globals] = Off;
php_admin_value[default_charset] = UTF-8;
php_admin_value[memory_limit] = 128M;
php_admin_value[max_execution_time] = 18000;
php_admin_value[upload_max_filesize] = 100M;
php_admin_value[safe_mode] = Off;
php_admin_value[mysql.connect_timeout] = 20;
php_admin_flag[session.use_cookies] = On;
php_admin_flag[session.use_trans_sid] = Off;
php_admin_value[session.gc_maxlifetime] = 12000000;
php_admin_value[apc.enabled] = 0;

25
config_panel.toml Normal file
View file

@ -0,0 +1,25 @@
version = "1.0"
[main]
name = "Abantecart configuration"
[main.php_fpm_config]
name = "PHP-FPM configuration"
[main.php_fpm_config.fpm_footprint]
ask = "Memory footprint of the service?"
choices = ["low", "medium", "high", "specific"]
default = "low"
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
[main.php_fpm_config.free_footprint]
ask = "Memory footprint of the service?"
type = "number"
default = "0"
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
[main.php_fpm_config.fpm_usage]
ask = "Expected usage of the service?"
choices = ["low", "medium", "high"]
default = "low"
help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
AbanteCart is a free open source ecommerce platform to power online retail. AbanteCart is a ready to run web application as well as reliable foundation to build custom eCommerce solutions. AbanteCart ecommerce platform is designed to fit a wide variety of online businesses and applications, as well as can be configured or customized to perform very specific business requirements. Chosen by many shop owners launching their business online for the first time, AbanteCart is also picked by developers looking for a user-friendly interface and powerful features set.

3
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,3 @@
### Important points to read before installing
- Instead of upgrading via Yunohost, you should refer to [this guide](https://abantecart.atlassian.net/wiki/spaces/AD/pages/5275676/Upgrade+manually)

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 KiB

View file

@ -1,83 +1,57 @@
{ {
"name": "Abantecart",
"id": "abantecart", "id": "abantecart",
"name": "Abantecart",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Create a E-commerce Website", "en": "Open source ecommerce platform to power online retail",
"fr": "Créer un site ecommerce" "fr": "Plateforme de commerce électronique pour la vente au détail en ligne"
}, },
"version": "1.2.12", "version": "1.3.2~ynh1",
"license": "free", "url": "https://www.abantecart.com/",
"url": "abantecart.com", "upstream": {
"license": "OSL-3.0",
"website": "https://www.abantecart.com/",
"demo": "https://www.abantecart.com/shopping-cart-demo",
"admindoc": "https://docs.abantecart.com/",
"userdoc": "https://abantecart.atlassian.net/wiki/spaces/AD/overview?homepageId=3506313",
"code": "https://github.com/abantecart/abantecart-src"
},
"license": "OSL-3.0",
"maintainer": { "maintainer": {
"name": "frju365", "name": "",
"email": "win10@tutanota.com" "email": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.0.0" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": false,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"ask": {
"en": "Choose a domain for Abantecart",
"fr": "Choisissez un domaine pour Abantecart"
},
"example": "domain.org"
}, },
{ {
"name": "path", "name": "admin",
"type": "path", "type": "user",
"ask": { "help": {
"en": "Choose a path for Abantecart", "en": "Access admin page via https://<domain.tld>/<admin>/"
"fr": "Choisissez un chemin pour Abantecart" }
}, },
"example": "/abantecart", {
"default": "/abantecart" "name": "password",
"type": "password",
"optional": false
}, },
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true "default": true
},
{
"name": "admin_name",
"type": "user",
"ask": {
"en": "Choose the Abantecart administrator (must be an existing YunoHost user)",
"fr": "Choisissez l'administrateur de Abantecart (doit être un utilisateur YunoHost existant)"
},
"example": "homer"
},
{
"name": "admin_pass",
"type": "password",
"ask": {
"en": "Set the password for the Admin user ≥ 8 character (without special caracters)",
"fr": "Définissez le mot de passe pour l'Administrateur. ≥ cinq charactères"
},
"example": "myreallystrengthpassword"
},
{
"name": "admin_email",
"type": "email",
"ask": {
"fr": "Votre adresse mail.",
"en": "Your Email adress."
},
"exemple": "abc@efg.hi"
} }
] ]
} }

View file

@ -1 +1,19 @@
#!/bin/bash #!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
#=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

View file

@ -6,12 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then source ../settings/scripts/_common.sh
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -24,45 +19,47 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# STANDARD BACKUP STEPS # DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#================================================= #=================================================
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
ynh_backup "$final_path" ynh_backup --src_path="$final_path"
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# BACKUP THE PHP-FPM CONFIGURATION # BACKUP THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_backup "/etc/php5/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db "$db_name" > db.sql ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# SPECIFIC BACKUP # END OF SCRIPT
#=================================================
# BACKUP LOGROTATE
#================================================= #=================================================
ynh_backup "/etc/logrotate.d/$app" ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,87 +0,0 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK THE SYNTAX OF THE PATHS
#=================================================
test -n "$old_path" || old_path="/"
test -n "$new_path" || new_path="/"
new_path=$(ynh_normalize_url_path $new_path)
old_path=$(ynh_normalize_url_path $old_path)
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
ynh_backup_if_checksum_is_different "$nginx_conf_path"
# Replace locations starting with old_path
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
ynh_replace_string "location\( \(=\|~\|~\*\|\^~\)\)\? $old_path" "location\1 $new_path" "$nginx_conf_path"
# Replace path in "return" directives
ynh_replace_string "return \([[:digit:]]\{3\}\) $old_path" "return \1 $new_path" "$nginx_conf_path"
# Calculate and store the nginx config file checksum
ynh_store_file_checksum "$nginx_conf_path"
fi
# Change the domain for nginx
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum "$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
systemctl reload nginx

95
scripts/config Normal file
View file

@ -0,0 +1,95 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__fpm_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
echo "specific"
else
echo "$current_fpm_footprint"
fi
}
get__free_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
echo "$current_fpm_footprint"
else
echo "0"
fi
}
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
fi
}
set__free_footprint() {
if [ "$fpm_footprint" = "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$free_footprint"
fi
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_validate() {
_ynh_app_config_validate
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then
# If fpm_footprint is set to 'specific', use $free_footprint value.
if [ "$fpm_footprint" = "specific" ]
then
fpm_footprint=$free_footprint
fi
if [ "$fpm_footprint" == "0" ]
then
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
exit 0
fi
fi
}
ynh_app_config_apply() {
_ynh_app_config_apply
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
}
ynh_app_config_run $1

View file

@ -20,168 +20,141 @@ ynh_abort_if_errors
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url="/"
password=$YNH_APP_ARG_PASSWORD
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
admin_name=$YNH_APP_ARG_ADMIN_NAME admin=$YNH_APP_ARG_ADMIN
admin_pass=$YNH_APP_ARG_ADMIN_PASS phpversion=$YNH_PHP_VERSION
admin_email=$YNH_APP_ARG_ADMIN_EMAIL email=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME
src_version=$(ynh_app_upstream_version)
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=2
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Normalize the url path syntax
path_url=$(ynh_normalize_url_path $path_url)
# Check web path availability
ynh_webpath_available $domain $path_url
# Register (book) web path # Register (book) web path
ynh_webpath_register $app $domain $path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_install_app_dependencies php-mysql php-zip php-gd
#=================================================
# Check password strength
#=================================================
[[ ${#admin_pass} -gt 8 ]] || ynh_die \
"The password is too weak, it must be longer than 8 characters"
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..."
user="$app" ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set "$app" is_public "$is_public" ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set "$app" admin_pass "$admin_pass" ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set "$app" admin_name "$admin_name" ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set "$app" admin_email "$admin_email" ynh_app_setting_set --app=$app --key=src_version --value=$src_version
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=3
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/git_src"
ln -s $final_path/git_src/public_html $final_path/www
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
# If your app uses a MySQL database, you can use these lines to bootstrap ynh_script_progression --message="Creating a MySQL database..." --weight=2
# a database, an associated user and save the password in app settings
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set $app db_name $db_name db_user=$db_name
ynh_mysql_setup_db $db_name $db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # CREATE A MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Configuring a MySQL database..." --weight=2
ynh_app_setting_set $app final_path $final_path cat $final_path/www/install/cli_install.php
# Download, check integrity, uncompress and patch the source from app.src php_installer=$final_path/www/install/cli_install.php
ynh_setup_source "$final_path" php $php_installer install \
#=================================================
# SPECIFIC SETUP
#=================================================
# Cleaning
#=================================================
ynh_secure_remove $final_path/tests
ynh_secure_remove $final_path/install.txt
mv $final_path/public_html/* $final_path/
ynh_secure_remove $final_path/public_html
pushd $final_path
chmod 0755 system/config.php
chmod 0755 system/
chmod 0755 system/cache/
chmod 0755 system/logs/
chmod 0755 image/
chmod 0755 image/thumbnails/
chmod 0755 download/
chmod 0755 extensions/
mkdir -p admin/system/backup/
chmod 0755 admin/system/backup/
chmod 0755 resources/
popd
#=================================================
# CLI installation
#=================================================
pushd $final_path/install/
php cli_install.php install \
--db_host=localhost \ --db_host=localhost \
--db_user=$db_name \ --db_user=$db_name \
--db_password=$db_pwd \ --db_password=$db_pwd \
--db_name=$db_name \ --db_name=$db_name \
--db_driver=amysqli \ --db_driver=amysqli \
--db_port=3306 \ --db_prefix=ac_ \
--username=$admin_name \ --username=$admin \
--password=$admin_pass \ --admin_path=$admin \
--email=$admin_email \ --password=$password \
--http_server=https://$domain$path_url \ --email=$email \
--db_prefix=_ac_ \ --http_server=https://$domain
--admin_path=ab_admin
popd ynh_secure_remove $final_path/www/install
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
find $final_path/www -type d -exec chmod 755 {} \;
find $final_path/www -type f -exec chmod 644 {} \;
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
# Create a system user
ynh_system_user_create $app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated php-fpm config # If the app is private, set the usage to low, otherwise to high.
ynh_add_fpm_config if [ $is_public -eq 0 ]
then
usage=low
else
usage=high
fi
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$usage --footprint=low
#================================================= #=================================================
# Set permissions # GENERIC FINALIZATION
#=================================================
# file owned by www-data before checking permissions
chown $app:$app $final_path -R
#=================================================
# SETUP LOGROTATE
#=================================================
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..."
if [ $is_public -eq 0 ]
then # Remove the public access
ynh_app_setting_delete $app skipped_uris
fi
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway. ynh_permission_update --permission="main" --add="visitors"
ynh_app_setting_set $app unprotected_uris "/"
fi fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..."
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,63 +12,60 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#=================================================
# REMOVE DEPENDENCIES
#=================================================
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # REMOVE THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=2
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_user $db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
# Remove the dedicated nginx config
ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # REMOVE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
# Remove the dedicated php-fpm config # Remove the dedicated PHP-FPM config
ynh_remove_fpm_config ynh_remove_fpm_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the app-specific logrotate config ynh_remove_nginx_config
ynh_remove_logrotate
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user # Delete a system user
ynh_system_user_delete $app ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -6,12 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
if [ ! -e _common.sh ]; then source ../settings/scripts/_common.sh
# Get the _common.sh file if it's not in the current directory
cp ../settings/scripts/_common.sh ./_common.sh
chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -24,74 +19,95 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." --weight=2
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get $app db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pass=$(ynh_app_setting_get $app db_pass) db_user=$db_name
password=$(ynh_app_setting_get --app=$app --key=password)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2
ynh_webpath_available $domain $path_url \ test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|| ynh_die "Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die "There is already a directory: $final_path "
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
#================================================= #=================================================
db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql 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_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================
# RESTORE USER RIGHTS # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=2
# Restore permissions on app files ynh_system_user_create --username=$app --home_dir="$final_path"
chown -R $app:$app $final_path
if [ -n "$password" ]
then
# Add the password to this user
chpasswd <<< "${app}:${password}"
fi
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
find $final_path/www -type d -exec chmod 755 {} \;
find $final_path/www -type f -exec chmod 644 {} \;
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=2
ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file "/etc/php/7.0/fpm/conf.d/20-$app.ini"
#================================================= # Recreate a dedicated PHP-FPM config
# SPECIFIC RESTORATION ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
# Define and install dependencies
ynh_install_app_dependencies php-mysql
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_restore_file "/etc/logrotate.d/$app"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
systemctl reload php7.0-fpm ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -12,135 +12,136 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get $app path_url) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get $app final_path) admin=$(ynh_app_setting_get --app=$app --key=admin)
admin_name=$(ynh_app_setting_get $app admin_name) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
admin_pass=$(ynh_app_setting_get $app admin_pass) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
admin_email=$(ynh_app_setting_get $app admin_email) src_version=$(ynh_app_setting_get --app=$app --key=src_version)
db_user=$(ynh_app_setting_get $app db_user)
phpversion=$YNH_PHP_VERSION
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # CHECK VERSION
#================================================= #=================================================
# Fix is_public as a boolean value upgrade_type=$(ynh_check_app_version_changed)
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set $app is_public 1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set $app is_public 0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z $db_name ]; then
db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name
fi
# If final_path doesn't exist, create it
if [ -z $final_path ]; then
final_path=/var/www/$app
ynh_app_setting_set $app final_path $final_path
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# CHECK THE PATH # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Normalize the URL path syntax # If fpm_footprint doesn't exist, create it
path_url=$(ynh_normalize_url_path $path_url) if [ -z "$fpm_footprint" ]; then
fpm_footprint=low
#================================================= ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
# STANDARD UPGRADE STEPS fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # If fpm_usage doesn't exist, create it
#================================================= if [ -z "$fpm_usage" ]; then
fpm_usage=low
# Download, check integrity, uncompress and patch the source from app.src ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
ynh_setup_source "$final_path" fi
# Cleaning legacy permissions
ynh_secure_remove $final_path/tests if ynh_legacy_permissions_exists; then
ynh_secure_remove $final_path/install.txt ynh_legacy_permissions_delete_all
mv $final_path/public_html/* $final_path/
ynh_secure_remove $final_path/public_html ynh_app_setting_delete --app=$app --key=is_public
#=================================================
# NGINX CONFIGURATION
#=================================================
# Create a dedicated nginx config
ynh_add_nginx_config
if [ "$path_url" != "/" ]
then
ynh_replace_string "^#sub_path_only" "" "/etc/nginx/conf.d/$domain.d/$app.conf"
fi fi
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a system user # Create a dedicated user (if not existing)
ynh_system_user_create $app ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/git_src"
fi
ynh_secure_remove $final_path/www/install
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
find $final_path/www -type d -exec chmod 755 {} \;
find $final_path/www -type f -exec chmod 644 {} \;
ln -s $final_path/git_src/public_html $final_path/www
#=================================================
# MYSQL CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading MySQL configuration..." --weight=1
# Update MySQL entries
upgrade_mysql_dir="../sources/patches/mysql/from_$src_version.sql"
if [ -f "$upgrade_mysql_dir" ]; then
ynh_mysql_execute_file_as_root --file=$upgrade_mysql_dir --database=$db_name
cat $upgrade_mysql_dir
fi
updated_src_version=$(ynh_app_upstream_version)
ynh_app_setting_set --app=$app --key=src_version --value=$updated_src_version
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#================================================= #=================================================
# PHP-FPM CONFIGURATION # PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated php-fpm config # Create a dedicated PHP-FPM config
ynh_add_fpm_config ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
#=================================================
# SETUP LOGROTATE
#=================================================
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
# Set right permissions for curl installation
chown -R $app:$app $final_path
#=================================================
# SETUP SSOWAT
#=================================================
if [ $is_public -eq 0 ]
then # Remove the public access
ynh_app_setting_delete $app skipped_uris
fi
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set $app unprotected_uris "/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
systemctl reload nginx ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last

View file

@ -0,0 +1,11 @@
-- Extracted from abantecart_1.3.2_upgrade_only.tar.gz
-- Upstream 1.3.1 >> 1.3.2
-- Yunohost 1.3.1~ynh1 >> 1.3.2~ynh1
ALTER TABLE `ac_order_products`
ADD COLUMN `weight` DECIMAL(15,4) NOT NULL DEFAULT 0.0 AFTER `cost`,
ADD COLUMN `weight_iso_code` VARCHAR(5) NOT NULL DEFAULT '' AFTER `weight`,
ADD COLUMN `width` DECIMAL(15,4) NOT NULL DEFAULT 0 AFTER `weight_iso_code`,
ADD COLUMN `length` DECIMAL(15,4) NOT NULL DEFAULT 0 AFTER `width`,
ADD COLUMN `height` DECIMAL(15,4) NOT NULL DEFAULT 0 AFTER `length`,
ADD COLUMN `length_iso_code` VARCHAR(5) NOT NULL DEFAULT '' AFTER `height`;