public function getMounts()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Mounted file systems');
        }

        // Get result of mount command
        try {
            $res = $this->exec->exec('mount');
        } catch (Exception $e) {
            Errors::add('Linfo Core', 'Error running `mount` command');

            return [];
        }

        // Parse it
        if (preg_match_all('/^(\S+) on (\S+) \((\w+)(?:, (.+))?\)/m', $res, $m, PREG_SET_ORDER) == 0) {
            return [];
        }

        // Store them here
        $mounts = [];

        // Deal with each entry
        foreach ($m as $mount) {

            // Should we not show this?
            if (in_array($mount[1], $this->settings['hide']['storage_devices']) || in_array($mount[3], $this->settings['hide']['filesystems'])) {
                continue;
            }

            // Get these
            $size = @disk_total_space($mount[2]);
            $free = @disk_free_space($mount[2]);
            $used = $size - $free;

            // Optionally get mount options
            if (
                $this->settings['show']['mounts_options'] &&
                !in_array($mount[3], (array) $this->settings['hide']['fs_mount_options']) &&
                isset($mount[4])
            ) {
                $mount_options = explode(', ', $mount[4]);
            } else {
                $mount_options = [];
            }

            // Might be good, go for it
            $mounts[] = array(
                'device' => $mount[1],
                'mount' => $mount[2],
                'type' => $mount[3],
                'size' => $size ,
                'used' => $used,
                'free' => $free,
                'free_percent' => ((bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false),
                'used_percent' => ((bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false),
                'options' => $mount_options,
            );
        }

        // Give it
        return $mounts;
    }
public function getMounts()
    {

        // Time?
        if (!empty($this->settings['timer'])) {
            $t = new Timer('Mounted file systems');
        }

        // Get result of mount command
        try {
            $res = $this->exec->exec('mount');
        } catch (Exception $e) {
            Errors::add('Linfo Core', 'Error running `mount` command');

            return [];
        }

        // Parse it
        if (preg_match_all('/^(\S+) on (\S+) \((\w+)(?:, (.+))?\)/m', $res, $m, PREG_SET_ORDER) == 0) {
            return [];
        }

        // Store them here
        $mounts = [];

        // Deal with each entry
        foreach ($m as $mount) {

            // Should we not show this?
            if (in_array($mount[1], $this->settings['hide']['storage_devices']) || in_array($mount[3], $this->settings['hide']['filesystems'])) {
                continue;
            }

            // Get these
            $size = @disk_total_space($mount[2]);
            $free = @disk_free_space($mount[2]);
            $used = $size - $free;

            // Optionally get mount options
            if (
                $this->settings['show']['mounts_options'] &&
                !in_array($mount[3], (array) $this->settings['hide']['fs_mount_options']) &&
                isset($mount[4])
            ) {
                $mount_options = explode(', ', $mount[4]);
            } else {
                $mount_options = [];
            }

            // Might be good, go for it
            $mounts[] = array(
                'device' => $mount[1],
                'mount' => $mount[2],
                'type' => $mount[3],
                'size' => $size ,
                'used' => $used,
                'free' => $free,
                'free_percent' => ((bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false),
                'used_percent' => ((bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false),
                'options' => $mount_options,
            );
        }

        // Give it
        return $mounts;
    }
public function getMounts ( ) { // Time? if ( ! empty ( $ this -> settings [ 'timer' ] ) ) { $ t = new Timer ( 'Mounted file systems' ) ; } // Get result of mount command try { $ res = $ this -> exec -> exec ( 'mount' ) ; } catch ( Exception $ e ) { Errors :: add ( 'Linfo Core' , 'Error running `mount` command' ) ; return [ ] ; } // Parse it if ( preg_match_all ( '/^(\S+) on (\S+) \((\w+)(?:, (.+))?\)/m' , $ res , $ m , PREG_SET_ORDER ) == 0 ) { return [ ] ; } // Store them here $ mounts = [ ] ; // Deal with each entry foreach ( $ m as $ mount ) { // Should we not show this? if ( in_array ( $ mount [ 1 ] , $ this -> settings [ 'hide' ] [ 'storage_devices' ] ) || in_array ( $ mount [ 3 ] , $ this -> settings [ 'hide' ] [ 'filesystems' ] ) ) { continue ; } // Get these $ size = @ disk_total_space ( $ mount [ 2 ] ) ; $ free = @ disk_free_space ( $ mount [ 2 ] ) ; $ used = $ size - $ free ; // Optionally get mount options if ( $ this -> settings [ 'show' ] [ 'mounts_options' ] && ! in_array ( $ mount [ 3 ] , ( array ) $ this -> settings [ 'hide' ] [ 'fs_mount_options' ] ) && isset ( $ mount [ 4 ] ) ) { $ mount_options = explode ( ', ' , $ mount [ 4 ] ) ; } else { $ mount_options = [ ] ; } // Might be good, go for it $ mounts [ ] = array ( 'device' => $ mount [ 1 ] , 'mount' => $ mount [ 2 ] , 'type' => $ mount [ 3 ] , 'size' => $ size , 'used' => $ used , 'free' => $ free , 'free_percent' => ( ( bool ) $ free != false && ( bool ) $ size != false ? round ( $ free / $ size , 2 ) * 100 : false ) , 'used_percent' => ( ( bool ) $ used != false && ( bool ) $ size != false ? round ( $ used / $ size , 2 ) * 100 : false ) , 'options' => $ mount_options , ) ; } // Give it return $ mounts ; }
Get mounted file systems
Get mounted file systems