Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Match any non-whitespace character in filesystem pattern
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr authored and backportbot[bot] committed Aug 26, 2020
commit fd9ced6350b8ce41ffe8ee83dd648e15ea602027
2 changes: 1 addition & 1 deletion lib/OperatingSystems/DefaultOs.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function getDiskInfo(): array {
}

$matches = [];
$pattern = '/^(?<Filesystem>[\w\/-]+)\s*(?<Type>\w+)\s*(?<Blocks>\d+)\s*(?<Used>\d+)\s*(?<Available>\d+)\s*(?<Capacity>\d+%)\s*(?<Mounted>[\w\/-]+)$/m';
$pattern = '/^(?<Filesystem>[\S]+)\s*(?<Type>\w+)\s*(?<Blocks>\d+)\s*(?<Used>\d+)\s*(?<Available>\d+)\s*(?<Capacity>\d+%)\s*(?<Mounted>[\w\/-]+)$/m';

$result = preg_match_all($pattern, $disks, $matches);
if ($result === 0 || $result === false) {
Expand Down
1 change: 1 addition & 0 deletions tests/data/df_tp
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ tmpfs tmpfs 4084000 0 4084000
vagrant vboxsf 958123168 614831132 343292036 65% /vagrant
home_vagrant_code vboxsf 958123168 614831132 343292036 65% /home/vagrant/code
tmpfs tmpfs 816800 0 816800 0% /run/user/1000
nfs.example.com:/export nfs4 14820 0 1230 0% /nfs
8 changes: 8 additions & 0 deletions tests/lib/DefaultOsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ public function testGetDiskInfo(): void {
'percent' => '65%',
'mount' => '/home/vagrant/code',
],
[
'device' => 'nfs.example.com:/export',
'fs' => 'nfs4',
'used' => 0,
'available' => 1259520,
'percent' => '0%',
'mount' => '/nfs',
]
];

$this->assertSame($disks, $this->os->getDiskInfo());
Expand Down