@@ -733,34 +733,34 @@ function update($event_name, $data) {
733733 } // end copy error docs
734734
735735 // Set the quota for the user, but only for vhosts, not vhostsubdomains or vhostalias
736- if ($ username != '' && $ app ->system ->is_user ($ username ) && $ data ['new ' ]['type ' ] == 'vhost ' ) {
736+ if ($ username != '' && $ app ->system ->is_user ($ username ) && $ data ['new ' ]['type ' ] == 'vhost ' ) {
737737 if ($ data ['new ' ]['hd_quota ' ] > 0 ) {
738738 $ blocks_soft = $ data ['new ' ]['hd_quota ' ] * 1024 ;
739739 $ blocks_hard = $ blocks_soft + 1024 ;
740- $ mb_hard = $ mb_soft + 1 ;
740+ $ mb_hard = $ mb_soft + 1 ;
741741 } else {
742742 $ mb_soft = $ mb_hard = $ blocks_soft = $ blocks_hard = 0 ;
743743 }
744-
745- // get the primitive folder for document_root and the filesystem, will need it later.
746- $ df_output =explode (" " , exec ("df -T $ document_root|awk 'END{print \$2, \$NF}' " ));
747- $ file_system = $ df_output [0 ];
748- $ primitive_root = $ df_output [1 ];
749744
750- if ($ file_system == 'xfs ' ) {
751- exec ("xfs_quota -x -c 'limit -u bsoft= $ mb_soft " . 'm ' . " bhard= $ mb_hard " . 'm ' . " $ username' $ primitive_root " );
745+ // get the primitive folder for document_root and the filesystem, will need it later.
746+ $ df_output =explode (" " , exec ("df -T " . escapeshellarg ($ data ['new ' ]['document_root ' ]) . "|awk 'END{print \$2, \$NF}' " ));
747+ $ file_system = $ df_output [0 ];
748+ $ primitive_root = $ df_output [1 ];
752749
753- // xfs only supports timers globally, not per user.
754- exec ( " xfs_quota -x -c 'timer -bir -i 604800' $ primitive_root" );
750+ if ( $ file_system == ' xfs ' ) {
751+ exec ( " xfs_quota -x -c " . escapeshellarg ( " limit -u bsoft= $ mb_soft " . ' m ' . " bhard= $ mb_hard " . ' m ' . " " . $ data [ ' new ' ][ ' system_group ' ]) . " " . escapeshellarg ( $ primitive_root) );
755752
756- unset($ project_uid , $ username_position , $ xfs_projects );
757- unset($ primitive_root , $ df_output , $ mb_hard , $ mb_soft );
758- } else {
759- if ($ app ->system ->is_installed ('setquota ' )) {
760- exec ('setquota -u ' . $ username . ' ' . $ blocks_soft . ' ' . $ blocks_hard . ' 0 0 -a &> /dev/null ' );
761- exec ('setquota -T -u ' .$ username .' 604800 604800 -a &> /dev/null ' );
753+ // xfs only supports timers globally, not per user.
754+ exec ("xfs_quota -x -c 'timer -bir -i 604800' " . escapeshellarg ($ primitive_root ));
755+
756+ unset($ project_uid , $ username_position , $ xfs_projects );
757+ unset($ primitive_root , $ df_output , $ mb_hard , $ mb_soft );
758+ } else {
759+ if ($ app ->system ->is_installed ('setquota ' )) {
760+ exec ('setquota -u ' . $ username . ' ' . $ blocks_soft . ' ' . $ blocks_hard . ' 0 0 -a &> /dev/null ' );
761+ exec ('setquota -T -u ' .$ username .' 604800 604800 -a &> /dev/null ' );
762+ }
762763 }
763- }
764764 }
765765
766766 if ($ this ->action == 'insert ' || $ data ["new " ]["system_user " ] != $ data ["old " ]["system_user " ]) {
0 commit comments