1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ttrss_ynh.git synced 2024-10-01 13:34:46 +02:00

Merge pull request #59 from YunoHost-Apps/testing

Testing
This commit is contained in:
JimboJoe 2019-04-09 18:53:27 +02:00 committed by GitHub
commit d8a7e801c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 82 additions and 9 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://git.tt-rss.org/git/tt-rss/archive/153cb6d30510f9804fe596ac6777bc2f35111ae2.tar.gz
SOURCE_SUM=1413d5d2ce6e4dfd63f4c69bb79f6e18287313756329eaf61928ce25085ebc13
SOURCE_URL=https://git.tt-rss.org/git/tt-rss/archive/19.2.tar.gz
SOURCE_SUM=6a4bfa9d0706bdcdd342f1a4e89e160b7bccb9396dcdfa52da2dd6bb6b5e5ec9
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

@ -8,13 +8,13 @@
},
"url": "http://tt-rss.org",
"license": "GPL-3.0-only",
"version": "153cb6d30510f9804fe596ac6777bc2f35111ae2",
"version": "19.2~ynh1",
"maintainer": {
"name": "titoko",
"email": "titoko@titoko.fr"
},
"requirements": {
"yunohost": ">= 2.7.12"
"yunohost": ">= 3.2.0"
},
"multi_instance": true,
"services": [

View file

@ -19,7 +19,6 @@
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
- **CI succeeded** :
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20-BRANCH-%20(Official)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20-BRANCH-%20(Official)/) *Please replace '-BRANCH-' in this link for a PR from a local branch.*
or
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-%20(Official_fork)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-%20(Official_fork)/) *Replace '-NUM-' by the PR number in this link for a PR from a forked repository.*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/ttrss_ynh%20PR-NUM-/)
*Please replace '-NUM-' in this link by the PR number.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.

View file

@ -14,3 +14,29 @@ ynh_delete_file_checksum () {
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
ynh_app_setting_delete $app $checksum_setting_name
}
ynh_smart_mktemp () {
local min_size="${1:-300}"
# Transform the minimum size from megabytes to kilobytes
min_size=$(( $min_size * 1024 ))
# Check if there's enough free space in a directory
is_there_enough_space () {
local free_space=$(df --output=avail "$1" | sed 1d)
test $free_space -ge $min_size
}
if is_there_enough_space /tmp; then
local tmpdir=/tmp
elif is_there_enough_space /var; then
local tmpdir=/var
elif is_there_enough_space /; then
local tmpdir=/
elif is_there_enough_space /home; then
local tmpdir=/home
else
ynh_die "Insufficient free space to continue..."
fi
echo "$(sudo mktemp --directory --tmpdir="$tmpdir")"
}

View file

@ -64,6 +64,17 @@ ynh_remove_fpm_config
ynh_remove_systemd_config
#=================================================
# REMOVE SERVICE FROM ADMIN PANEL
#=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q $app
then
echo "Remove $app service"
yunohost service remove $app
fi
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
# source _common.sh
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
@ -40,6 +40,10 @@ fi
ynh_backup_before_upgrade # Backup the current version of the app
ynh_clean_setup () {
# Delete any created temporary folder
if [ -v tmpdir ] && [ -d $tmpdir ]; then
ynh_secure_remove $tmpdir
fi
ynh_restore_upgradebackup # restore it if the upgrade fails
}
ynh_abort_if_errors # Active trap pour arrêter le script si une erreur est détectée.
@ -64,8 +68,11 @@ path_url=$(ynh_normalize_url_path $path_url)
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# Create a temporary directory
tmpdir="$(ynh_smart_mktemp 10)"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source "$final_path"
ynh_setup_source "$tmpdir"
#=================================================
# NGINX CONFIGURATION
@ -99,6 +106,14 @@ ynh_add_fpm_config
# CONFIGURE TTRSS
#=================================================
# Backup the config file in the temp dir
cp -a "$final_path/config.php" "$tmpdir/config.php"
# Replace the old ttrss by the new one
ynh_secure_remove "$final_path"
mv "$tmpdir" "$final_path"
ynh_secure_remove "$tmpdir"
# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different "$final_path/config.php"
@ -126,6 +141,7 @@ sudo -u $app php ${final_path}/update.php --update-schema
# Set permissions to app files
chown -R root: $final_path
chmod 0755 $final_path
chown -R $app $final_path/{cache,feed-icons,lock}
#=================================================

View file

@ -0,0 +1,21 @@
--- /include/functions.php
+++ /include/functions.php
@@ -825,6 +825,18 @@
}
} else {
+ /* We need to check that the "REMOTE_USER" and "uid" are same.
+ * If it has changed it's probably that the user logged out and
+ * was authenticated with a other username.
+ * In this case we need to reauthenticate the user
+ */
+ if (AUTH_AUTO_LOGIN && $_SERVER["REMOTE_USER"] != $_SESSION["uid"]) {
+ if (authenticate_user(null, null)) {
+ $_SESSION["ref_schema_version"] = get_schema_version(true);
+ } else {
+ authenticate_user(null, null, true);
+ }
+ }
/* bump login timestamp */
$sth = $pdo->prepare("UPDATE ttrss_users SET last_login = NOW() WHERE id = ?");
$sth->execute([$_SESSION['uid']]);