From e1631c09b5b221a5c05e9d3d22a17c2cea0dc31a Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Thu, 17 Mar 2022 16:19:43 +0800 Subject: [PATCH] fix(web): blog & phpv8 --- web/app/models/UOJContext.php | 3 ++- web/install.sh | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/web/app/models/UOJContext.php b/web/app/models/UOJContext.php index 769a719..a6c6915 100644 --- a/web/app/models/UOJContext.php +++ b/web/app/models/UOJContext.php @@ -66,7 +66,8 @@ class UOJContext { if ($domain === null) { $domain = UOJConfig::$data['web']['main']['host']; } - $domain = array_shift(explode(':', $domain)); + $domain = explode(':', $domain); + $domain = array_shift($domain); if (validateIP($domain) || $domain === 'localhost') { $domain = ''; } else { diff --git a/web/install.sh b/web/install.sh index 8f041b2..b5c191b 100644 --- a/web/install.sh +++ b/web/install.sh @@ -10,13 +10,15 @@ _judger_socket_password_=_judger_socket_password_ getAptPackage(){ printf "\n\n==> Getting environment packages\n" - #Update apt sources and install + # Update apt sources and install export DEBIAN_FRONTEND=noninteractive dpkg -s gnupg 2>/dev/null || (apt-get update && apt-get install -y gnupg) echo "deb http://ppa.launchpad.net/stesie/libv8/ubuntu bionic main" | tee /etc/apt/sources.list.d/stesie-libv8.list && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys D858A0DF - apt-get update && apt-get install -y vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring php-gd php-intl php-xsl g++ make re2c libv8-7.5-dev libyaml-dev + apt-get update && apt-get install -y git vim ntp zip unzip curl wget apache2 libapache2-mod-xsendfile libapache2-mod-php php php-dev php-pear php-zip php-mysql php-mbstring php-gd php-intl php-xsl g++ make re2c libv8-7.5-dev libyaml-dev # Install PHP extensions - printf "/opt/libv8-7.5\n\n" | pecl install v8js yaml + yes | pecl install yaml + git clone https://github.com/phpv8/v8js.git --depth=1 /tmp/pear/download/v8js-master && cd /tmp/pear/download/v8js-master + phpize && ./configure --with-php-config=/usr/bin/php-config --with-v8js=/opt/libv8-7.5 && make install && cd - } setLAMPConf(){ @@ -45,7 +47,7 @@ UOJEOF a2enmod rewrite headers && sed -i -e '172s/AllowOverride None/AllowOverride All/' /etc/apache2/apache2.conf #Create UOJ session save dir and make PHP extensions available mkdir --mode=733 /var/lib/php/uoj_sessions && chmod +t /var/lib/php/uoj_sessions - sed -i -e '865a\extension=v8js.so\nextension=yaml.so' /etc/php/7.2/apache2/php.ini + sed -i -e '912a\extension=v8js.so\nextension=yaml.so' /etc/php/7.4/apache2/php.ini } setWebConf(){