library.sh: Simplify clear_opcache

Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
Tobias Knöppler 2023-01-20 19:05:41 +01:00
parent a5f777ae86
commit f121aac809
No known key found for this signature in database
GPG Key ID: 3510056072886A8F
9 changed files with 22 additions and 26 deletions

View File

@ -125,9 +125,7 @@ is_active_app unattended-upgrades && run_app unattended-upgrades || true
# mark as successful
mv "${new_cfg}" "${old_cfg}"
install_template "php/opcache.ini.sh" "/etc/php/${php_ver_new}/mods-available/opcache.ini" --defaults
service "php${php_ver_new}-fpm" stop
clear_opcache
service "php${php_ver_new}-fpm" start
source /usr/local/etc/library.sh # refresh NCPCFG RELEASE PHPVER
run_app nc-limits

View File

@ -185,9 +185,7 @@ find nextcloud/ -type d -exec chmod 750 {} \;
find nextcloud/ -type f -exec chmod 640 {} \;
# Clear PHP opcache
service "php${PHPVER}-fpm" stop
clear_opcache
service "php${PHPVER}-fpm" start
# upgrade
####################

View File

@ -78,7 +78,6 @@ EOF
service redis-server restart
update-rc.d redis-server enable
clear_opcache
service php${PHPVER}-fpm restart
# service to randomize passwords on first boot
mkdir -p /usr/lib/systemd/system

View File

@ -11,11 +11,8 @@
configure()
{
echo "Stopping php..."
service "php${PHPVER}-fpm" stop
echo "Clearing opcache..."
clear_opcache
echo "Starting php..."
service "php${PHPVER}-fpm" start
}
install() { :; }

View File

@ -170,7 +170,9 @@ apt-get install --no-install-recommends -y wget ca-certificates; \
# install nextcloudpiset_app_param nc-datadir.sh DATADIR '/data-ro/ncdata' \
source /usr/local/etc/library.sh; \
cd /tmp/ncp-build/; \
install_app ncp.sh; \
branch=master; \
[[ "$ncp_ver" == "v0.0.0" ]] || branch="$ncp_ver"; \
BRANCH="$branch" install_app ncp.sh; \
mv /usr/local/etc/ncp-config.d/nc-init-copy.cfg /usr/local/etc/ncp-config.d/nc-init.cfg; \
run_app_unsafe bin/ncp/CONFIG/nc-init.sh; \
@ -185,13 +187,22 @@ rm /usr/local/etc/ncp-config.d/nc-datadir.cfg; \
sed -i 's|data-ro|data|' /data-ro/nextcloud/config/config.php; \
# fix default paths
echo "Update data-ro"; \
sed -i 's|/media/USBdrive|/data/backups|' /usr/local/etc/ncp-config.d/nc-backup.cfg; \
sed -i 's|/media/USBdrive|/data/backups|' /usr/local/etc/ncp-config.d/nc-backup-auto.cfg; \
sed -i 's|/data-ro|/data|' /etc/mysql/mariadb.conf.d/90-ncp.cnf; \
echo "DEBUGGING:"; \
cat /etc/mysql/mariadb.conf.d/90-ncp.cnf; \
ls -l /usr/local/bin/; \
# cleanup all NCP extras
run_app_unsafe post-inst.sh; \
echo "DEBUGGING:"; \
cat /etc/mysql/mariadb.conf.d/90-ncp.cnf; \
ls -l /usr/local/bin/; \
# specific cleanup
cd /; rm -r /tmp/ncp-build; \
rm /usr/local/etc/ncp-config.d/nc-init.cfg; \

View File

@ -9,15 +9,6 @@ cleanup()
exit
}
grep '/data-ro' /etc/mysql/mariadb.conf.d/90-ncp.cnf > /dev/null 2>&1 && {
echo "WARNING: Looks like you have been affected by a critical bug in NCP that can cause data loss. We're trying" \
"to fix this now, but if you encounter any issues, please check" \
"https://github.com/nextcloud/nextcloudpi/issues/1577#issuecomment-1260830341" \
"It is likely that you will have to restore a backup"
chown -R mysql:mysql /data/database || true
}
sed -i 's|/data-ro|/data|' "/etc/mysql/mariadb.conf.d/90-ncp.cnf" || true
trap cleanup SIGTERM
# if an empty volume is mounted to /data, pre-populate it

View File

@ -26,7 +26,6 @@ if [[ -f /usr/local/bin/ncp-docker-hook ]]; then
fi
echo "Starting PHP-fpm"
clear_opcache
php-fpm"${PHPVER}"
echo "Starting Apache"

View File

@ -3,7 +3,7 @@
source /usr/local/etc/library.sh
# INIT NCP CONFIG (first run)
[[ "$1" == "start" ]] && {
[[ "$1" == "start" ]] && [[ -d /data/ncp ]] && {
echo "Install default configurations for new ncp apps"
rsync --ignore-existing -a --out-format="%n" /usr/local/etc/ncp-config.d/*.cfg /data/ncp/ | awk '{ print " > " $0 }'
}
@ -25,11 +25,13 @@ persistent_cfg /etc/cron.weekly
}
persistent_cfg /usr/local/bin /data/bin
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER}/mods-available/opcache.ini"
install_template "php/90-ncp.ini.sh" "/etc/php/${PHPVER}/fpm/conf.d/90-ncp.ini"
install_template "php/pool.d.www.conf.sh" "/etc/php/${PHPVER}/fpm/pool.d/www.conf"
#install_template "mysql/91-ncp.cnf.sh" "/etc/mysql/mariadb.conf.d/91-ncp.cnf"
install_template "ncp-metrics.cfg.sh" "/usr/local/etc/ncp-metrics.cfg"
[[ "$1" == "start" ]] && {
install_template "php/opcache.ini.sh" "/etc/php/${PHPVER}/mods-available/opcache.ini"
install_template "php/90-ncp.ini.sh" "/etc/php/${PHPVER}/fpm/conf.d/90-ncp.ini"
install_template "php/pool.d.www.conf.sh" "/etc/php/${PHPVER}/fpm/pool.d/www.conf"
#install_template "mysql/91-ncp.cnf.sh" "/etc/mysql/mariadb.conf.d/91-ncp.cnf"
install_template "ncp-metrics.cfg.sh" "/usr/local/etc/ncp-metrics.cfg"
}
touch /var/log/ncp.log
tail -f -n0 "/var/log/ncp.log" &

View File

@ -604,6 +604,7 @@ function clear_opcache() {
rm -rf "${data_dir:-/var/www/data}/.opcache"/*
echo "Done."
}
service php${PHPVER}-fpm reload
}
# License