From a35a1849b7e18f2a6cf0bbf6355b5e84e65831fa Mon Sep 17 00:00:00 2001 From: hosh1 Date: Sun, 10 Aug 2025 02:32:15 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20index.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 58 ++++++++++++------------------------------------------ 1 file changed, 13 insertions(+), 45 deletions(-) diff --git a/install.sh b/install.sh index bde71cb..659c3de 100644 --- a/install.sh +++ b/install.sh @@ -314,55 +314,23 @@ echo ""; EOF } -if ! curl -f -s --max-time 10 --head "$DOWNLOAD_URL" >/dev/null 2>&1; then - create_fallback_index -else - find "$WEBROOT" -type f ! -name "db_config.php" -delete 2>/dev/null || true - - if curl -f -L --max-time 30 -o "$TEMP_DOWNLOAD" "$DOWNLOAD_URL" 2>/dev/null; then - - FILE_TYPE=$(file -b "$TEMP_DOWNLOAD" 2>/dev/null || echo "unknown") - - if file "$TEMP_DOWNLOAD" | grep -qi "zip\|archive"; then - if unzip -q "$TEMP_DOWNLOAD" -d "$WEBROOT" 2>/dev/null; then - true - else - unzip -o "$TEMP_DOWNLOAD" -d "$WEBROOT" >/dev/null 2>&1 || create_fallback_index - fi - - elif file "$TEMP_DOWNLOAD" | grep -qi "gzip"; then - if gunzip -c "$TEMP_DOWNLOAD" > "$WEBROOT/index.php" 2>/dev/null; then - true - else - create_fallback_index - fi - - elif head -n 1 "$TEMP_DOWNLOAD" | grep -q "/dev/null; then - cp "$TEMP_DOWNLOAD" "$WEBROOT/downloaded_file" - rm -f "$TEMP_DOWNLOAD" - fi - +find "$WEBROOT" -type f ! -name "db_config.php" -delete 2>/dev/null || true + +if curl -f -L --max-time 30 -o "$WEBROOT/index.php" "$DOWNLOAD_URL" 2>/dev/null; then + if ! head -n 1 "$WEBROOT/index.php" | grep -q "/dev/null; then create_fallback_index + log_error "Скачанный файл не является PHP-скриптом, создана резервная страница" + else + log_success "Файл index.php успешно загружен" fi +else + create_fallback_index + log_error "Не удалось загрузить файл с $DOWNLOAD_URL, создана резервная страница" fi +chown $WEBSERVER_USER:$WEBSERVER_USER "$WEBROOT/index.php" +chmod 644 "$WEBROOT/index.php" + cat > "$WEBROOT/.htaccess" << 'EOF' Require all denied