Skip to content

Commit 87ae749

Browse files
authored
Refactor (#8552)
1 parent cc4b944 commit 87ae749

File tree

2 files changed

+14
-29
lines changed

2 files changed

+14
-29
lines changed

ct/projectsend.sh

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,28 @@ function update_script() {
2727
msg_error "No ${APP} Installation Found!"
2828
exit
2929
fi
30-
RELEASE=$(curl -fsSL https://api.github.com/repos/projectsend/projectsend/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
31-
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
30+
31+
if check_for_gh_release "projectsend" "projectsend/projectsend"; then
3232
msg_info "Stopping Service"
3333
systemctl stop apache2
3434
msg_ok "Stopped Service"
3535

36-
msg_info "Updating ${APP} to v${RELEASE}"
37-
cd /opt
38-
curl -fsSL "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip" -o $(basename "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip")
39-
$STD unzip -o "projectsend-r${RELEASE}.zip" -d projectsend
36+
php_ver=$(php -v | head -n 1 | awk '{print $2}')
37+
if [[ ! $php_ver == "8.4"* ]]; then
38+
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_MODULE="pdo,mysql,gettext,fileinfo" setup_php
39+
fi
40+
41+
mv /opt/projectsend/includes/sys.config.php /opt/sys.config.php
42+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "projectsend" "projectsend/projectsend" "prebuild" "latest" "/opt/projectsend" "projectsend-r*.zip"
43+
mv /opt/sys.config.php /opt/projectsend/includes/sys.config.php
4044
chown -R www-data:www-data /opt/projectsend
4145
chmod -R 775 /opt/projectsend
42-
echo "${RELEASE}" >/opt/${APP}_version.txt
43-
msg_ok "Updated $APP to v${RELEASE}"
4446

4547
msg_info "Starting Service"
4648
systemctl start apache2
4749
msg_ok "Started Service"
4850

49-
msg_info "Cleaning up"
50-
rm -rf "/opt/projectsend-r${RELEASE}.zip"
51-
msg_ok "Cleaned"
5251
msg_ok "Updated Successfully"
53-
else
54-
msg_ok "No update required. ${APP} is already at v${RELEASE}"
5552
fi
5653
exit
5754
}

install/projectsend-install.sh

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@ setting_up_container
1313
network_check
1414
update_os
1515

16-
msg_info "Installing Dependencies"
17-
$STD apt install -y \
18-
apache2 \
19-
libapache2-mod-php \
20-
php8.2-{pdo,mysql,mbstring,gettext,fileinfo,gd,xml,zip}
21-
msg_ok "Installed Dependencies"
22-
16+
PHP_VERSION="8.4" PHP_APACHE="YES" PHP_MODULE="pdo,mysql,gettext,fileinfo" setup_php
2317
setup_mariadb
18+
fetch_and_deploy_gh_release "projectsend" "projectsend/projectsend" "prebuild" "latest" "/opt/projectsend" "projectsend-r*.zip"
2419

2520
msg_info "Setting up MariaDB"
2621
DB_NAME=projectsend
@@ -37,12 +32,7 @@ $STD mariadb -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUS
3732
} >>~/projectsend.creds
3833
msg_ok "Set up MariaDB"
3934

40-
msg_info "Installing projectsend"
41-
RELEASE=$(curl -fsSL https://api.github.com/repos/projectsend/projectsend/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
42-
cd /opt
43-
curl -fsSL "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip" -o "projectsend-r${RELEASE}.zip"
44-
mkdir projectsend
45-
$STD unzip "projectsend-r${RELEASE}.zip" -d projectsend
35+
msg_info "Installing ProjectSend"
4636
mv /opt/projectsend/includes/sys.config.sample.php /opt/projectsend/includes/sys.config.php
4737
chown -R www-data:www-data /opt/projectsend
4838
chmod -R 775 /opt/projectsend
@@ -55,8 +45,7 @@ sed -i -e "s/^\(memory_limit = \).*/\1 256M/" \
5545
-e "s/^\(post_max_size = \).*/\1 256M/" \
5646
-e "s/^\(upload_max_filesize = \).*/\1 256M/" \
5747
-e "s/^\(max_execution_time = \).*/\1 300/" \
58-
/etc/php/8.2/apache2/php.ini
59-
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
48+
/etc/php/8.4/apache2/php.ini
6049
msg_ok "Installed projectsend"
6150

6251
msg_info "Creating Service"
@@ -84,7 +73,6 @@ motd_ssh
8473
customize
8574

8675
msg_info "Cleaning up"
87-
rm -rf "/opt/projectsend-r${RELEASE}.zip"
8876
$STD apt -y autoremove
8977
$STD apt -y autoclean
9078
$STD apt -y clean

0 commit comments

Comments
 (0)