mirror of
https://github.com/YunoHost-Apps/wordpress_ynh.git
synced 2024-09-03 20:36:10 +02:00
v2
This commit is contained in:
parent
9fa44c86d5
commit
5d4009c210
10 changed files with 16 additions and 700 deletions
72
CHANGELOG.md
72
CHANGELOG.md
|
@ -1,72 +0,0 @@
|
|||
Changelog
|
||||
=========
|
||||
|
||||
## Unreleased
|
||||
- Nothing for now...
|
||||
|
||||
## [5.6~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115) - 2020-12-09
|
||||
|
||||
#### Changed
|
||||
* [Update to 5.6](https://github.com/YunoHost-Apps/wordpress_ynh/pull/115/commits/2d72bf87c3e2e674e967058472586b31e0cb5c62)
|
||||
|
||||
## [5.5.0~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/108) - 2020-08-15
|
||||
|
||||
#### Fixed
|
||||
- [Fix typo](https://github.com/YunoHost-Apps/wordpress_ynh/pull/106)
|
||||
|
||||
#### Changed
|
||||
* [Update to 5.5.0](https://github.com/YunoHost-Apps/wordpress_ynh/commit/942ca57cbeb339d27454b32ba73c34006aa1c510)
|
||||
- [Update link to hardening Wordpress guide](https://github.com/YunoHost-Apps/wordpress_ynh/pull/97)
|
||||
|
||||
|
||||
## [5.4.0~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85) - 2020-05-02
|
||||
|
||||
#### Added
|
||||
* [Add action and config-panel feature](https://github.com/YunoHost-Apps/wordpress_ynh/pull/79)
|
||||
* [Add changelog](https://github.com/YunoHost-Apps/wordpress_ynh/pull/82)
|
||||
* [New reset actions](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/10a1fe6bf94a8b2eed2386b614771a51e093d958)
|
||||
* [Add an action to remove maintenance mode](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/373685d5736eba2b42495867eb4119db9991a60d)
|
||||
|
||||
#### Fixed
|
||||
- [fix config is_public](https://github.com/YunoHost-Apps/wordpress_ynh/pull/84)
|
||||
|
||||
#### Changed
|
||||
* [Use ynh_get_scalable_phpfpm](https://github.com/YunoHost-Apps/wordpress_ynh/pull/80)
|
||||
* [Update to 5.3.2](https://github.com/YunoHost-Apps/wordpress_ynh/pull/81)
|
||||
* [Update to 5.4.0](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/00a1a6e7dd5c814f5084c11c2810f886a32bdf61)
|
||||
- [Remove php template](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/9eb618f88afd8294a0c3c8e0573a055038ec5423)
|
||||
- [Fix buster install](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/5e68805ed1afa47778f7cd4823f636e417594c5a)
|
||||
- [specify php version to use](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/59baee2ef9d85e3284ecf47fc3c7bd16a3c08ac3)
|
||||
- [Always show YunoHost tile](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/1b63bd778af287f605314b0383e5bd21f25b8007)
|
||||
- [Replace wp-fail2ban by wp-fail2ban-redux](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/3faae6b27694ed363d4c3605c4718963eb3d994f)
|
||||
- [Add new badges](https://github.com/YunoHost-Apps/wordpress_ynh/pull/85/commits/063a5404691d54b50b88a52addfd5e3d6de5ebd0)
|
||||
|
||||
|
||||
## [5.3~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/77) - 2019-12-26
|
||||
|
||||
#### Fixed
|
||||
- [Get the database prefix before modifying data](https://github.com/YunoHost-Apps/wordpress_ynh/pull/77/commits/75d6e64c758443a06ca6bfd42a75291806618f03)
|
||||
|
||||
#### Changed
|
||||
* [Upgrade to 5.3](https://github.com/YunoHost-Apps/wordpress_ynh/pull/77/commits/7d6f1e0048ebac0c1fef06a8789192f33a8220eb)
|
||||
- [Increase memory limit to support some plugin](https://github.com/YunoHost-Apps/wordpress_ynh/pull/77/commits/e5b1bb7e3449e9be49e9e60eaf3d986072a30f06)
|
||||
|
||||
|
||||
## [5.2~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/65) - 2019-06-05
|
||||
|
||||
#### Fixed
|
||||
- [Force upgrade with a cron](https://github.com/YunoHost-Apps/wordpress_ynh/pull/63/commits/7e4808ebc3318b3b6096729a28260fc936af4e78)
|
||||
|
||||
#### Changed
|
||||
* [Upgrade to wordpress 5.2](https://github.com/YunoHost-Apps/wordpress_ynh/pull/63/commits/21b087ea6ebb499124745384771bfb0ddd866f11)
|
||||
- [Global upgrade of the package](https://github.com/YunoHost-Apps/wordpress_ynh/pull/64/commits/87e36e665c56dfbe110f44a35a4ccc9724e89a75)
|
||||
|
||||
|
||||
## [5.0.3~ynh1](https://github.com/YunoHost-Apps/wordpress_ynh/pull/56) - 2019-03-12
|
||||
|
||||
#### Added
|
||||
- [Progress bar](https://github.com/YunoHost-Apps/wordpress_ynh/pull/56/commits/d140c510ea068f654ebefdd66c4e51ad3aa85067)
|
||||
|
||||
#### Changed
|
||||
- [Update to last packaging standard](https://github.com/YunoHost-Apps/wordpress_ynh/pull/56/commits/bb64ee0d9b8883db13da35c252ed10899559f016)
|
||||
* [Update to wordpress 5.0.3](https://github.com/YunoHost-Apps/wordpress_ynh/pull/56/commits/04e76b93af5724fe23d19da2bc05e0f728398d43)
|
|
@ -1,87 +0,0 @@
|
|||
{
|
||||
"name": "WordPress",
|
||||
"id": "wordpress",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Create a beautiful blog or website easily",
|
||||
"fr": "Logiciel de création de blog ou de site Web"
|
||||
},
|
||||
"version": "6.2~ynh1",
|
||||
"url": "https://wordpress.org/",
|
||||
"upstream": {
|
||||
"license": "GPL-2.0",
|
||||
"website": "https://wordpress.org/",
|
||||
"admindoc": "https://codex.wordpress.org/",
|
||||
"code": "https://core.trac.wordpress.org/browser",
|
||||
"cpe": "cpe:2.3:a:wordpress:wordpress"
|
||||
},
|
||||
"license": "GPL-2.0",
|
||||
"maintainer": {
|
||||
"name": "kay0u",
|
||||
"email": "pierre@kayou.io"
|
||||
},
|
||||
"previous_maintainers": [
|
||||
{
|
||||
"name": "Maniack Crudelis",
|
||||
"email": "maniackc_dev@crudelis.fr"
|
||||
}
|
||||
],
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.0.9"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php8.0-fpm",
|
||||
"mysql"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/blog",
|
||||
"default": "/blog"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": [
|
||||
"en_US",
|
||||
"fr_FR"
|
||||
],
|
||||
"default": "en_US"
|
||||
},
|
||||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose the WordPress administrator (must be an existing YunoHost user)",
|
||||
"fr": "Administrateur du site (doit être un utilisateur YunoHost existant)"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "multisite",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Enable multisite option?",
|
||||
"fr": "Activer l'option multisite ?"
|
||||
},
|
||||
"default": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
|
@ -18,22 +18,20 @@ cpe = "???" # FIXME: optional but recommended if relevant, this is meant to cont
|
|||
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.0.9"
|
||||
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
|
||||
yunohost = ">= 11.1.18"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
|
||||
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
|
||||
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
|
||||
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
|
||||
ldap = true
|
||||
sso = true
|
||||
disk = "50M"
|
||||
ram.build = "50M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "path"
|
||||
default = "/blog"
|
||||
|
||||
|
@ -49,7 +47,6 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
|||
default = "en_US"
|
||||
|
||||
[install.admin]
|
||||
# this is a generic question - ask strings are automatically handled by Yunohost's core
|
||||
type = "user"
|
||||
|
||||
[install.multisite]
|
||||
|
@ -63,13 +60,18 @@ ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requiremen
|
|||
url = "https://downloads.wordpress.org/release/wordpress-6.2.zip"
|
||||
sha256 = "0078e0483d3447a465f71d6bbdab5c799cad2e57c221ec1d639d235b0ffced55"
|
||||
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
admin.url = "/wp-login.php"
|
||||
admin.additional_urls="/wp-admin.php"
|
||||
admin.allowed = "admins"
|
||||
|
||||
[resources.apt]
|
||||
packages = "mariadb-server php8.0-mysql php8.0-curl php8.0-json php8.0-mbstring php8.0-xml php8.0-zip php8.0-gd php8.0-soap php8.0-ssh2 php8.0-tokenizer php8.0-ldap"
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
||||
|
|
|
@ -4,155 +4,10 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
#REMOVEME? YNH_PHP_VERSION="8.0"
|
||||
|
||||
#REMOVEME? pkg_dependencies="php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-soap php${YNH_PHP_VERSION}-ssh2 php${YNH_PHP_VERSION}-tokenizer php${YNH_PHP_VERSION}-ldap"
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
#=================================================
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin --app_message=app_message [--recipients=recipients] [--type=type]
|
||||
# | arg: -m --app_message= - The file with the content to send to the administrator.
|
||||
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||
# example: "root admin@domain"
|
||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||
# example: "root admin@domain user1 user2"
|
||||
# | arg: -t, --type= - Type of mail, could be 'backup', 'change_url', 'install', 'remove', 'restore', 'upgrade'
|
||||
ynh_send_readme_to_admin() {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= [t]=type= )
|
||||
local app_message
|
||||
local recipients
|
||||
local type
|
||||
# Manage arguments with getopts
|
||||
|
||||
ynh_handle_getopts_args "$@"
|
||||
app_message="${app_message:-}"
|
||||
recipients="${recipients:-root}"
|
||||
type="${type:-install}"
|
||||
|
||||
# Get the value of admin_mail_html
|
||||
#REMOVEME? admin_mail_html=$(ynh_app_setting_get $app admin_mail_html)
|
||||
admin_mail_html="${admin_mail_html:-0}"
|
||||
|
||||
# Retrieve the email of users
|
||||
find_mails () {
|
||||
local list_mails="$1"
|
||||
local mail
|
||||
local recipients=" "
|
||||
# Read each mail in argument
|
||||
for mail in $list_mails
|
||||
do
|
||||
# Keep root or a real email address as it is
|
||||
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
else
|
||||
# But replace an user name without a domain after by its email
|
||||
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "$recipients"
|
||||
}
|
||||
recipients=$(find_mails "$recipients")
|
||||
|
||||
# Subject base
|
||||
local mail_subject="☁️🆈🅽🅷☁️: \`$app\`"
|
||||
|
||||
# Adapt the subject according to the type of mail required.
|
||||
if [ "$type" = "backup" ]; then
|
||||
mail_subject="$mail_subject has just been backup."
|
||||
elif [ "$type" = "change_url" ]; then
|
||||
mail_subject="$mail_subject has just been moved to a new URL!"
|
||||
elif [ "$type" = "remove" ]; then
|
||||
mail_subject="$mail_subject has just been removed!"
|
||||
elif [ "$type" = "restore" ]; then
|
||||
mail_subject="$mail_subject has just been restored!"
|
||||
elif [ "$type" = "upgrade" ]; then
|
||||
mail_subject="$mail_subject has just been upgraded!"
|
||||
else # install
|
||||
mail_subject="$mail_subject has just been installed!"
|
||||
fi
|
||||
|
||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||
|
||||
Specific information for the application $app.
|
||||
|
||||
$(if [ -n "$app_message" ]
|
||||
then
|
||||
cat "$app_message"
|
||||
else
|
||||
echo "...No specific information..."
|
||||
fi)
|
||||
|
||||
---
|
||||
Automatic diagnosis data from YunoHost
|
||||
|
||||
__PRE_TAG1__$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')__PRE_TAG2__"
|
||||
|
||||
# Store the message into a file for further modifications.
|
||||
echo "$mail_message" > mail_to_send
|
||||
|
||||
# If a html email is required. Apply html tags to the message.
|
||||
if [ "$admin_mail_html" -eq 1 ]
|
||||
then
|
||||
# Insert 'br' tags at each ending of lines.
|
||||
ynh_replace_string "$" "<br>" mail_to_send
|
||||
|
||||
# Insert starting HTML tags
|
||||
sed --in-place '1s@^@<!DOCTYPE html>\n<html>\n<head></head>\n<body>\n@' mail_to_send
|
||||
|
||||
# Keep tabulations
|
||||
ynh_replace_string " " "\ \ " mail_to_send
|
||||
ynh_replace_string "\t" "\ \ " mail_to_send
|
||||
|
||||
# Insert url links tags
|
||||
ynh_replace_string "__URL_TAG1__\(.*\)__URL_TAG2__\(.*\)__URL_TAG3__" "<a href=\"\2\">\1</a>" mail_to_send
|
||||
|
||||
# Insert pre tags
|
||||
ynh_replace_string "__PRE_TAG1__" "<pre>" mail_to_send
|
||||
ynh_replace_string "__PRE_TAG2__" "<\pre>" mail_to_send
|
||||
|
||||
# Insert finishing HTML tags
|
||||
echo -e "\n</body>\n</html>" >> mail_to_send
|
||||
|
||||
# Otherwise, remove tags to keep a plain text.
|
||||
else
|
||||
# Remove URL tags
|
||||
ynh_replace_string "__URL_TAG[1,3]__" "" mail_to_send
|
||||
ynh_replace_string "__URL_TAG2__" ": " mail_to_send
|
||||
|
||||
# Remove PRE tags
|
||||
ynh_replace_string "__PRE_TAG[1-2]__" "" mail_to_send
|
||||
fi
|
||||
|
||||
# Define binary to use for mail command
|
||||
if [ -e /usr/bin/bsd-mailx ]
|
||||
then
|
||||
local mail_bin=/usr/bin/bsd-mailx
|
||||
else
|
||||
local mail_bin=/usr/bin/mail.mailutils
|
||||
fi
|
||||
|
||||
if [ "$admin_mail_html" -eq 1 ]
|
||||
then
|
||||
content_type="text/html"
|
||||
else
|
||||
content_type="text/plain"
|
||||
fi
|
||||
|
||||
# Send the email to the recipients
|
||||
cat mail_to_send | $mail_bin -a "Content-Type: $content_type; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
ynh_maintenance_mode_ON () {
|
||||
# Load value of $path and $domain from the config if their not set
|
||||
if [ -z $path ]; then
|
||||
|
@ -232,143 +87,6 @@ ynh_maintenance_mode_OFF () {
|
|||
systemctl reload nginx
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
# Create a changelog for an app after an upgrade from the file CHANGELOG.md.
|
||||
#
|
||||
# usage: ynh_app_changelog [--format=markdown/html/plain] [--output=changelog_file] --changelog=changelog_source]
|
||||
# | arg: -f --format= - Format in which the changelog will be printed
|
||||
# markdown: Default format.
|
||||
# html: Turn urls into html format.
|
||||
# plain: Plain text changelog
|
||||
# | arg: -o --output= - Output file for the changelog file (Default ./changelog)
|
||||
# | arg: -c --changelog= - CHANGELOG.md source (Default ../CHANGELOG.md)
|
||||
#
|
||||
# The changelog is printed into the file ./changelog and ./changelog_lite
|
||||
ynh_app_changelog () {
|
||||
# Declare an array to define the options of this helper.
|
||||
local legacy_args=foc
|
||||
declare -Ar args_array=( [f]=format= [o]=output= [c]=changelog= )
|
||||
local format
|
||||
local output
|
||||
local changelog
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
format=${format:-markdown}
|
||||
output=${output:-changelog}
|
||||
changelog=${changelog:-../CHANGELOG.md}
|
||||
|
||||
local original_changelog="$changelog"
|
||||
local temp_changelog="changelog_temp"
|
||||
local final_changelog="$output"
|
||||
|
||||
if [ ! -n "$original_changelog" ]
|
||||
then
|
||||
echo "No changelog available..." > "$final_changelog"
|
||||
echo "No changelog available..." > "${final_changelog}_lite"
|
||||
return 0
|
||||
fi
|
||||
|
||||
#REMOVEME? local current_version=$(ynh_read_manifest --manifest="/etc/yunohost/apps/$YNH_APP_INSTANCE_NAME/manifest.json" --manifest_key="version")
|
||||
local update_version=$(ynh_read_manifest --manifest="../manifest.json" --manifest_key="version")
|
||||
|
||||
# Get the line of the version to update to into the changelog
|
||||
local update_version_line=$(grep --max-count=1 --line-number "^## \[$update_version" "$original_changelog" | cut -d':' -f1)
|
||||
# If there's no entry for this version yet into the changelog
|
||||
# Get the first available version
|
||||
if [ -z "$update_version_line" ]
|
||||
then
|
||||
update_version_line=$(grep --max-count=1 --line-number "^##" "$original_changelog" | cut -d':' -f1)
|
||||
fi
|
||||
|
||||
# Get the length of the complete changelog.
|
||||
local changelog_length=$(wc --lines "$original_changelog" | awk '{print $1}')
|
||||
# Cut the file before the version to update to.
|
||||
tail --lines=$(( $changelog_length - $update_version_line + 1 )) "$original_changelog" > "$temp_changelog"
|
||||
|
||||
# Get the length of the troncated changelog.
|
||||
changelog_length=$(wc --lines "$temp_changelog" | awk '{print $1}')
|
||||
# Get the line of the current version into the changelog
|
||||
# Keep only the last line found
|
||||
local current_version_line=$(grep --line-number "^## \[$current_version" "$temp_changelog" | cut -d':' -f1 | tail --lines=1)
|
||||
# If there's no entry for this version into the changelog
|
||||
# Get the last available version
|
||||
if [ -z "$current_version_line" ]
|
||||
then
|
||||
current_version_line=$(grep --line-number "^##" "$original_changelog" | cut -d':' -f1 | tail --lines=1)
|
||||
fi
|
||||
# Cut the file before the current version.
|
||||
# Then grep the previous version into the changelog to get the line number of the previous version
|
||||
local previous_version_line=$(tail --lines=$(( $changelog_length - $current_version_line )) \
|
||||
"$temp_changelog" | grep --max-count=1 --line-number "^## " | cut -d':' -f1)
|
||||
# If there's no previous version into the changelog
|
||||
# Go until the end of the changelog
|
||||
if [ -z "$previous_version_line" ]
|
||||
then
|
||||
previous_version_line=$changelog_length
|
||||
fi
|
||||
|
||||
# Cut the file after the previous version to keep only the changelog between the current version and the version to update to.
|
||||
head --lines=$(( $current_version_line + $previous_version_line - 1 )) "$temp_changelog" | tee "$final_changelog"
|
||||
|
||||
if [ "$format" = "html" ]
|
||||
then
|
||||
# Replace markdown links by html links
|
||||
ynh_replace_string --match_string="\[\(.*\)\](\(.*\)))" --replace_string="<a href=\"\2\">\1</a>)" --target_file="$final_changelog"
|
||||
ynh_replace_string --match_string="\[\(.*\)\](\(.*\))" --replace_string="<a href=\"\2\">\1</a>" --target_file="$final_changelog"
|
||||
elif [ "$format" = "plain" ]
|
||||
then
|
||||
# Change title format.
|
||||
ynh_replace_string --match_string="^##.*\[\(.*\)\](\(.*\)) - \(.*\)$" --replace_string="## \1 (\3) - \2" --target_file="$final_changelog"
|
||||
# Change modifications lines format.
|
||||
ynh_replace_string --match_string="^\([-*]\).*\[\(.*\)\]\(.*\)" --replace_string="\1 \2 \3" --target_file="$final_changelog"
|
||||
fi
|
||||
# else markdown. As the file is already in markdown, nothing to do.
|
||||
|
||||
# Keep only important changes into the changelog
|
||||
# Remove all minor changes
|
||||
sed '/^-/d' "$final_changelog" > "${final_changelog}_lite"
|
||||
# Remove all blank lines (to keep a clear workspace)
|
||||
sed --in-place '/^$/d' "${final_changelog}_lite"
|
||||
# Add a blank line at the end
|
||||
echo "" >> "${final_changelog}_lite"
|
||||
|
||||
# Clean titles if there's no significative changes
|
||||
local line
|
||||
local previous_line=""
|
||||
while read line <&3
|
||||
do
|
||||
if [ -n "$previous_line" ]
|
||||
then
|
||||
# Remove the line if it's a title or a blank line, and the previous one was a title as well.
|
||||
if ( [ "${line:0:1}" = "#" ] || [ ${#line} -eq 0 ] ) && [ "${previous_line:0:1}" = "#" ]
|
||||
then
|
||||
ynh_replace_special_string --match_string="${previous_line//[/.}" --replace_string="" --target_file="${final_changelog}_lite"
|
||||
fi
|
||||
fi
|
||||
previous_line="$line"
|
||||
done 3< "${final_changelog}_lite"
|
||||
|
||||
# Remove all blank lines again
|
||||
sed --in-place '/^$/d' "${final_changelog}_lite"
|
||||
|
||||
# Restore changelog format with blank lines
|
||||
ynh_replace_string --match_string="^##.*" --replace_string="\n\n&\n" --target_file="${final_changelog}_lite"
|
||||
# Remove the 2 first blank lines
|
||||
sed --in-place '1,2d' "${final_changelog}_lite"
|
||||
# Add a blank line at the end
|
||||
echo "" >> "${final_changelog}_lite"
|
||||
|
||||
# If changelog are empty, add an info
|
||||
if [ $(wc --words "$final_changelog" | awk '{print $1}') -eq 0 ]
|
||||
then
|
||||
echo "No changes from the changelog..." > "$final_changelog"
|
||||
fi
|
||||
if [ $(wc --words "${final_changelog}_lite" | awk '{print $1}') -eq 0 ]
|
||||
then
|
||||
echo "No significative changes from the changelog..." > "${final_changelog}_lite"
|
||||
fi
|
||||
}
|
||||
|
||||
#=================================================
|
||||
|
||||
|
|
|
@ -10,25 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
#REMOVEME? ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
|
|
@ -9,44 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=2
|
||||
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$db_name
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Removing the MySQL database..." --weight=2
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
#REMOVEME? ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=4
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
#REMOVEME? ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=2
|
||||
|
||||
# Remove the app directory securely
|
||||
#REMOVEME? ynh_secure_remove --file="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -81,16 +43,6 @@ ynh_script_progression --message="Removing various files..." --weight=1
|
|||
# Remove a cron file
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=3
|
||||
|
||||
# Delete a system user
|
||||
#REMOVEME? ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -10,56 +10,12 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
# Exit if an error occurs during the execution of the script
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..." --weight=3
|
||||
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#REMOVEME? db_user=$db_name
|
||||
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
#REMOVEME? admin_wordpress=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
|
||||
#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
#REMOVEME? test ! -d $install_dir \
|
||||
|| ynh_die --message="There is already a directory: $install_dir "
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Activating maintenance mode..." --weight=1
|
||||
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -90,14 +46,6 @@ ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
|
|||
ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
|
||||
ynh_systemd_action --action=restart --service_name=fail2ban
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=5
|
||||
|
||||
# Define and install dependencies
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -119,10 +67,8 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Restoring the MySQL database..." --weight=3
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=3
|
||||
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
#REMOVEME? 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
|
||||
|
||||
#=================================================
|
||||
|
@ -145,24 +91,9 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Disabling maintenance mode..." --weight=8
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
||||
# Get main domain and buid the url of the admin panel of the app.
|
||||
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
|
||||
|
||||
echo "You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
|
||||
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
|
||||
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/wordpress_ynh__URL_TAG3__." > mail_to_send
|
||||
|
||||
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin_wordpress" --type=restore
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
113
scripts/upgrade
113
scripts/upgrade
|
@ -9,57 +9,15 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=5
|
||||
|
||||
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
||||
#REMOVEME? language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
#REMOVEME? admin_wordpress=$(ynh_app_setting_get --app=$app --key=admin)
|
||||
#REMOVEME? multisite=$(ynh_app_setting_get --app=$app --key=multisite)
|
||||
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
||||
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#REMOVEME? overwrite_nginx=$(ynh_app_setting_get --app=$app --key=overwrite_nginx)
|
||||
#REMOVEME? overwrite_phpfpm=$(ynh_app_setting_get --app=$app --key=overwrite_phpfpm)
|
||||
#REMOVEME? admin_mail_html=$(ynh_app_setting_get --app=$app --key=admin_mail_html)
|
||||
|
||||
#REMOVEME? fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
|
||||
#REMOVEME? fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint)
|
||||
#REMOVEME? fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
|
||||
|
||||
#REMOVEME? phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=15
|
||||
|
||||
# Backup the current version of the app
|
||||
#REMOVEME? ynh_backup_before_upgrade
|
||||
#REMOVEME? ynh_clean_setup () {
|
||||
# Restore it if the upgrade fails
|
||||
#REMOVEME? ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
#REMOVEME? ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ACTIVATE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Activating maintenance mode..." --weight=2
|
||||
|
||||
ynh_maintenance_mode_ON
|
||||
|
||||
|
@ -170,26 +128,6 @@ $wpcli_alias plugin is-installed wp-fail2ban-redux || $wpcli_alias plugin instal
|
|||
# Remove old ldap plugin
|
||||
$wpcli_alias plugin is-installed simple-ldap-login && $wpcli_alias plugin deactivate $plugin_network simple-ldap-login && $wpcli_alias plugin uninstall simple-ldap-login
|
||||
|
||||
# Cleaning legacy permissions
|
||||
#REMOVEME? if ynh_legacy_permissions_exists; then
|
||||
#REMOVEME? ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#REMOVEME? if ! ynh_permission_exists --permission="admin"; then
|
||||
# Create the required permissions
|
||||
#REMOVEME? ynh_permission_create --permission="admin" --url="/wp-login.php" --additional_urls="/wp-admin.php" --allowed=$admin_wordpress
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -201,13 +139,6 @@ then
|
|||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
||||
|
||||
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -234,15 +165,13 @@ ynh_backup_if_checksum_is_different --file="$install_dir/wp-config.php"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring multisite..." --weight=2
|
||||
|
||||
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
||||
if [ $multisite -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="#--MULTISITE--" --replace_string="" --target_file=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
db_prefix=$(grep '^$table_prefix' "$install_dir/wp-config.php" | sed "s/.*'\(.*\)'.*/\1/" )
|
||||
|
||||
|
@ -329,56 +258,18 @@ ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=9
|
|||
# Create a dedicated Fail2Ban config
|
||||
ynh_add_fail2ban_config --logpath="/var/log/auth.log" --failregex="Authentication (attempt for unknown user|failure for) .* from <HOST>" --max_retry=5
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
# REMOVE WP-CLI.PHAR
|
||||
#=================================================
|
||||
|
||||
#REMOVEME? ynh_secure_remove --file=$install_dir/wp-cli.phar
|
||||
ynh_secure_remove --file=$install_dir/wp-cli.phar
|
||||
|
||||
#=================================================
|
||||
# DEACTIVE MAINTENANCE MODE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Disabling maintenance mode..." --weight=5
|
||||
|
||||
ynh_maintenance_mode_OFF
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
||||
# Get main domain and buid the url of the admin panel of the app.
|
||||
admin_panel="https://$(grep portal_domain /etc/ssowat/conf.json | cut -d'"' -f4)/yunohost/admin/#/apps/$app"
|
||||
|
||||
# If a html email is required. Apply html to the changelog.
|
||||
if [ "$admin_mail_html" -eq 1 ]; then
|
||||
format=html
|
||||
else
|
||||
format=plain
|
||||
fi
|
||||
ynh_app_changelog --format=$format
|
||||
|
||||
echo "Please manually trigger updates to major versions in the WordPress admin area.
|
||||
You can also activate the automatic update in the Companion Auto Update plugin settings.
|
||||
|
||||
You can configure this app easily by using the experimental __URL_TAG1__config-panel feature__URL_TAG2__$admin_panel/config-panel__URL_TAG3__.
|
||||
You can also find some specific actions for this app by using the experimental __URL_TAG1__action feature__URL_TAG2__$admin_panel/actions__URL_TAG3__.
|
||||
|
||||
If you're facing an issue or want to improve this app, please open a new issue in this __URL_TAG1__project__URL_TAG2__https://github.com/YunoHost-Apps/wordpress_ynh__URL_TAG3__.
|
||||
|
||||
---
|
||||
|
||||
Changelog since your last upgrade:
|
||||
$(cat changelog)" > mail_to_send
|
||||
|
||||
ynh_send_readme_to_admin --app_message="mail_to_send" --recipients="$admin_wordpress" --type=upgrade
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue