Skip to content

Commit

Permalink
Merge pull request #3789 from AllskyTeam/3710-upgrade-issue-with-sess…
Browse files Browse the repository at this point in the history
…ions

3710 upgrade issue with sessions
  • Loading branch information
EricClaeys authored Aug 4, 2024
2 parents b415d98 + dca119b commit 935b930
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
22 changes: 22 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,28 @@ set_permissions()
sudo find "${ALLSKY_WEBSITE}" -type d -exec chmod 775 '{}' \;
sudo find "${ALLSKY_WEBSITE}" -type f -exec chmod 664 '{}' \;
sudo chgrp --recursive "${WEBSERVER_GROUP}" "${ALLSKY_WEBSITE}"

# Get the session handler type from th ephp ini file
SESSION_HANDLER="$( get_php_setting "session.save_handler" )"
# We need to make changes if the handler is using the filesystem
if [[ ${SESSION_HANDLER} == "files" ]]; then
# Get the path to the php sessions
SESSION_PATH="$( get_php_setting "session.save_path" )"

# Loop over all files in the session folder and if any are not owned by the
# web server user then changs ALL of the php sessions to be owned by the
# web server user
sudo find "${SESSION_PATH}" -type f -print0 | while read -r -d $'\0' SESSION_FILE
do
OWNER="$( sudo stat -c '%U' "${SESSION_FILE}" )"
if [[ ${OWNER} != "${WEBSERVER_OWNER}" ]]; then
display_msg --log info "Found php sessions with wrong owner - fixing them"
sudo chown -R "${WEBSERVER_OWNER}":"${WEBSERVER_OWNER}" "${SESSION_PATH}"
break
fi
done
fi

}


Expand Down
10 changes: 10 additions & 0 deletions scripts/installUpgradeFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -971,3 +971,13 @@ function get_computer()
echo "${MODEL}, ${GB} GB"
}


####
# Get a value from the php ini file, using php rather than parsing the ini
# files directly. This does assume that both the cli and cgi settings files
# work in the same way.
#
get_php_setting() {
local SETTING="${1}"
php -r "echo ini_get('${SETTING}');"
}

0 comments on commit 935b930

Please sign in to comment.