mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
Update UPDATE.sh
This commit is contained in:
parent
1a8a875f20
commit
40f076cbea
@ -38,7 +38,7 @@ update_blocker() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
#update_blocker
|
update_blocker
|
||||||
|
|
||||||
echo "Starting update.."
|
echo "Starting update.."
|
||||||
|
|
||||||
@ -77,15 +77,12 @@ FUNCTIONS=(
|
|||||||
#notify user we started
|
#notify user we started
|
||||||
print_header
|
print_header
|
||||||
|
|
||||||
# /etc/openpanel/
|
|
||||||
update_configuration_files
|
|
||||||
|
|
||||||
# update docker openpanel image
|
# update docker openpanel image
|
||||||
download_new_panel
|
download_new_panel
|
||||||
|
|
||||||
# update admin from github
|
# update admin from github
|
||||||
download_new_admin
|
download_new_admin
|
||||||
|
|
||||||
# update opencli
|
# update opencli
|
||||||
opencli_update
|
opencli_update
|
||||||
|
|
||||||
@ -151,34 +148,6 @@ print_space_and_line() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
update_configuration_files() {
|
|
||||||
echo "Updating configuration files in /etc/openpanel/"
|
|
||||||
mkdir -p /etc/openpanel-${PREVIOUS_VERSION}/
|
|
||||||
cp -r /etc/openpanel/ /etc/openpanel-${PREVIOUS_VERSION}/
|
|
||||||
cd /etc/openpanel/
|
|
||||||
|
|
||||||
git stash # stash local conf
|
|
||||||
|
|
||||||
# update from gh
|
|
||||||
if git pull origin main; then
|
|
||||||
echo "Successfully pulled the latest changes."
|
|
||||||
else
|
|
||||||
echo "There were merge conflicts."
|
|
||||||
if git ls-files -u | grep -q "^"; then
|
|
||||||
echo "Conflicted files:"
|
|
||||||
git ls-files -u
|
|
||||||
else
|
|
||||||
echo "No conflicts, but pull failed for another reason."
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
git stash pop # restore local conf
|
|
||||||
mv /etc/openpanel/openadmin/config/terms /etc/openpanel/openadmin/config/terms_accepted_on_update
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
restart_admin_panel_if_needed() {
|
restart_admin_panel_if_needed() {
|
||||||
echo "Restarting OpenAdmin service.."
|
echo "Restarting OpenAdmin service.."
|
||||||
service admin restart
|
service admin restart
|
||||||
@ -318,48 +287,6 @@ verify_license() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_two_columns_to_plans() {
|
|
||||||
echo "Checking for the presence of 'email_limit' and 'ftp_limit' columns in the PLANS table of the PANEL database."
|
|
||||||
|
|
||||||
# Check if the columns exist
|
|
||||||
check_query="SHOW COLUMNS FROM plans LIKE 'email_limit';"
|
|
||||||
mysql -D "panel" -e "$check_query" | grep -q 'email_limit'
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
# Column 'email_limit' does not exist, check for 'ftp_limit'
|
|
||||||
check_query="SHOW COLUMNS FROM plans LIKE 'ftp_limit';"
|
|
||||||
mysql -D "panel" -e "$check_query" | grep -q 'ftp_limit'
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
# Neither column exists, proceed to add them
|
|
||||||
echo "Adding 'email_limit' and 'ftp_limit' columns to the PLANS table."
|
|
||||||
|
|
||||||
mysql_query="ALTER TABLE plans
|
|
||||||
ADD COLUMN email_limit int NOT NULL DEFAULT 0 AFTER websites_limit,
|
|
||||||
ADD COLUMN ftp_limit int NOT NULL DEFAULT 0 AFTER email_limit;"
|
|
||||||
|
|
||||||
mysql -D "panel" -e "$mysql_query"
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
echo "Successfully added 2 columns to the plans table."
|
|
||||||
else
|
|
||||||
echo "Error: Failed to add columns to the plans table."
|
|
||||||
echo "Please run the following MySQL query manually:"
|
|
||||||
echo "$mysql_query"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "'ftp_limit' column already exists. No columns added."
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "'email_limit' column already exists. No columns added."
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
celebrate() {
|
celebrate() {
|
||||||
|
|
||||||
print_space_and_line
|
print_space_and_line
|
||||||
|
Loading…
Reference in New Issue
Block a user