Просмотр исходного кода

Merge pull request #1143 from hestiacp/staging/fixes

Staging/fixes
Jaap Marcus 5 лет назад
Родитель
Сommit
b1a1f30801
4 измененных файлов с 22 добавлено и 4 удалено
  1. 2 0
      CHANGELOG.md
  2. 9 0
      bin/v-backup-user
  3. 2 2
      install/upgrade/versions/1.3.0.sh
  4. 9 2
      web/login/index.php

+ 2 - 0
CHANGELOG.md

@@ -41,6 +41,8 @@ All notable changes to this project will be documented in this file.
 - Fixed an issue with Restore Failed on Domains with Mail Setups using SSL (#1069)
 - Fixed an issue with PHPMyAdmin button (#1078)
 - Changed WordPress name in Webapp installer (#1074)
+- Add a free disk space validation during backup routine (#1115)
+
 
 ## [1.2.3] - Service Release
 ### Features

+ 9 - 0
bin/v-backup-user

@@ -55,6 +55,15 @@ start_time=$(date '+%s')
 subj="$user → backup failed"
 email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
 
+# Validate available disk space (take usage * 2, due to the backup handling)
+let u_disk=$(grep "U_DISK=" $HESTIA/data/users/$user/user.conf |cut -f 2 -d \')*2
+let v_disk=$(($(stat -f --format="%a*%S" $BACKUP)))/1024/1024
+
+if [ "$u_disk" -gt "$v_disk" ]; then
+    echo "not enough diskspace available to perform the backup." |$SENDMAIL -s "$subj" $email $notify
+    check_result $E_LIMIT "not enough diskspace available to perform the backup."
+fi
+
 if [ -z "$BACKUP_TEMP" ]; then
     BACKUP_TEMP=$BACKUP
 fi

+ 2 - 2
install/upgrade/versions/1.3.0.sh

@@ -34,11 +34,11 @@ if [ "$FTP_SYSTEM" == "proftpd" ]; then
     if [ -e  /etc/proftpd/proftpd.conf ]; then
         rm /etc/proftpd/proftpd.conf
     fi
-    if [ -e  /etc/proftpd/tlss.conf ]; then
+    if [ -e  /etc/proftpd/tls.conf ]; then
         rm /etc/proftpd/tls.conf
     fi
     
     cp -f $HESTIA_INSTALL_DIR/proftpd/proftpd.conf /etc/proftpd/
     cp -f $HESTIA_INSTALL_DIR/proftpd/tls.conf /etc/proftpd/
     
-fi
+fi

+ 9 - 2
web/login/index.php

@@ -98,7 +98,7 @@ function authenticate_user(){
                 if ($data[$_POST['user']]['TWOFA'] != '') {
                    if (empty($_POST['twofa'])){
                        return false;
-                   }else{
+                   } else {
                         $v_twofa = $_POST['twofa'];
                         exec(HESTIA_CMD ."v-check-user-2fa ".$v_user." ".$v_twofa, $output, $return_var);
                         unset($output);
@@ -148,6 +148,13 @@ function authenticate_user(){
                 }
             }
         }
+    } else {
+        unset($_POST);
+        unset($_GET);
+        unset($_SESSION);
+        session_destroy();
+        session_start();
+        return false;
     }
 }
 
@@ -190,4 +197,4 @@ if (empty($_POST['user'])) {
 } else {
     require_once('../templates/login.html');
 }
-?>
+?>