#!/bin/bash

export PATH=/opt/plesk/php/7.4/bin:$PATH;

cd /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy
sudo git pull

echo "$(tput setab 2)beta-pro-buddy has been PULLED$(tput sgr 0)"

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/app
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/app /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/client
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/client /var/www/vhosts/spawntree.de//probuddy.spawntree.de/httpdocs/src

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin/AHDMN
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/admin/AHDMN /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin/libs
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/admin/libs /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin/services
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/admin/services /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin/boot.php
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/admin/boot.php /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/admin

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/dependencies
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/dependencies /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server/cli
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/server/cli /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server/control
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/server/control /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server/core
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/server/core /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server/job
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/server/job /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server/template
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/server/template /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server/utils
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/server/utils /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server/shared
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/src/server/shared /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/src/server

rm -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/tools
cp -rf /var/www/vhosts/spawntree.de/probuddy.spawntree.de/git_repositories/beta-probuddy/tools /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs

echo "$(tput setab 2)Files have been copied$(tput sgr 0)"


cd /var/www/vhosts/spawntree.de/probuddy.spawntree.de/httpdocs/
sudo chmod 777 -R *

echo "$(tput setab 7)$(tput setaf 1)THINK ABOUT POSSIBLE PATCHES!"

echo "You have updated beta-pro-buddy!$(tput sgr 0)"
