MOON
Server: Apache/2.2.31 (Unix) mod_ssl/2.2.31 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4
System: Linux csr818.wilogic.com 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64
User: digitals (531)
PHP: 5.4.45
Disabled: NONE
Upload Files
File: //proc/self/root/scripts.20110531.215904.25158/getfreemount.pl
#!/usr/bin/perl
# cpanel - getfreemount.pl                        Copyright(c) 2010 cPanel, Inc.
#                                                           All rights Reserved.
# copyright@cpanel.net                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

BEGIN { unshift @INC, '/usr/local/cpanel'; }

use Cpanel::Config ();

## case 34397 deprecation: delete this file completely
sub getmntpoint {
    my $wwwacct_ref = Cpanel::Config::loadwwwacctconf();
    my $homedir     = $wwwacct_ref->{'HOMEDIR'};
    my $homematch   = $wwwacct_ref->{'HOMEMATCH'};

    $disk = `df`;

    my $max = 0;
    my $mnt = "/";
    my (@DISK) = split( /\n/, $disk );
    my $addline = '';
    foreach $line (@DISK) {
        if ( $line !~ /[\s|\t]+/ ) {
            $addline = $line;
            $addline =~ s/\n//g;
            next;
        }
        if ( $line =~ m/^\/dev/ || $addline ne "" ) {
            $line =~ s/\n//g;

            $line =~ m/ (\d*)\s*\d*\%\s*(\S+)$/;
            my $free  = $1;
            my $mount = $2;

            my $assess = 1;
            if ( ( $mount eq "/" ) && ( $homedir eq 0 ) ) {
                $assess = 0;
            }
            $free = int($free);
            $max  = int($max);

            if ( ( $max < $free ) && ( $assess eq 1 ) && ( $mount =~ /$homematch/ || $mount eq "/" ) ) {
                $max = $free;
                if ( $mount eq "/" ) {
                    $mount = $homedir;
                }
                $mnt = $mount;
            }
        }
    }

    if ( $mnt eq "" || $mnt eq "/" ) { $mnt = '/home'; }
    return $mnt;
}

1;