From abd03574145a6af2c8209259495d23622ae085ea Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Tue, 20 Sep 2016 16:25:17 +0200
Subject: [PATCH] Fix website quota issues #4176 and #4187

---
 server/plugins-available/apache2_plugin.inc.php | 13 +++++++------
 server/plugins-available/nginx_plugin.inc.php   | 13 +++++++------
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/server/plugins-available/apache2_plugin.inc.php b/server/plugins-available/apache2_plugin.inc.php
index fde079e088..83d22615b9 100644
--- a/server/plugins-available/apache2_plugin.inc.php
+++ b/server/plugins-available/apache2_plugin.inc.php
@@ -889,18 +889,19 @@ class apache2_plugin {
           $file_system = $df_output[0];
           $primitive_root = $df_output[1];
 
-		  if ( in_array($file_system , array('ext2','ext3','ext4','simfs','reiserfs'), true) ) {
-            exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null');
-            exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null');
-          } elseif ($file_system == 'xfs') {
-
-            exec("xfs_quota -x -c 'limit -g bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " $username' $primitive_root");
+		  if($file_system == 'xfs') {
+			exec("xfs_quota -x -c 'limit -g bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " $username' $primitive_root");
 
             // xfs only supports timers globally, not per user.
             exec("xfs_quota -x -c 'timer -bir -i 604800'");
 
             unset($project_uid, $username_position, $xfs_projects);
             unset($primitive_root, $df_output, $mb_hard, $mb_soft);
+		  } else {
+            if($app->system->is_installed('setquota')) {
+				exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null');
+				exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null');
+			}
           }
 		}
 
diff --git a/server/plugins-available/nginx_plugin.inc.php b/server/plugins-available/nginx_plugin.inc.php
index 7f73d08be0..f7bf24ae27 100644
--- a/server/plugins-available/nginx_plugin.inc.php
+++ b/server/plugins-available/nginx_plugin.inc.php
@@ -747,18 +747,19 @@ class nginx_plugin {
           $file_system = $df_output[0];
           $primitive_root = $df_output[1];
 
-          if ( in_array($file_system , array('ext2','ext3','ext4','simfs','reiserfs'), true) ) {
-            exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null');
-            exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null');
-          } elseif ($file_system == 'xfs') {
-
-            exec("xfs_quota -x -c 'limit -g bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " $username' $primitive_root");
+          if($file_system == 'xfs') {
+			exec("xfs_quota -x -c 'limit -g bsoft=$mb_soft" . 'm'. " bhard=$mb_hard" . 'm'. " $username' $primitive_root");
 
             // xfs only supports timers globally, not per user.
             exec("xfs_quota -x -c 'timer -bir -i 604800'");
 
             unset($project_uid, $username_position, $xfs_projects);
             unset($primitive_root, $df_output, $mb_hard, $mb_soft);
+		  } else {
+            if($app->system->is_installed('setquota')) {
+				exec('setquota -u '. $username . ' ' . $blocks_soft . ' ' . $blocks_hard . ' 0 0 -a &> /dev/null');
+				exec('setquota -T -u '.$username.' 604800 604800 -a &> /dev/null');
+			}
           }
 		}
 
-- 
GitLab