Skip to content

Commit 36c6360

Browse files
baldheadmrsombre
authored andcommitted
Getting disk usage details (#54)
Getting disk usage details functionality added
1 parent 0e2fff7 commit 36c6360

File tree

4 files changed

+81
-0
lines changed

4 files changed

+81
-0
lines changed

src/Api/Operator/Webspace.php

+11
Original file line numberDiff line numberDiff line change
@@ -91,4 +91,15 @@ public function getAll()
9191
return $this->_getItems(Struct\GeneralInfo::class, 'gen_info');
9292
}
9393

94+
/**
95+
* @param string $field
96+
* @param integer|string $value
97+
* @return Struct\DiskUsage
98+
*/
99+
public function getDiskUsage($field, $value)
100+
{
101+
$items = $this->_getItems(Struct\DiskUsage::class, 'disk_usage', $field, $value);
102+
return reset($items);
103+
}
104+
94105
}

src/Api/Struct/Site/GeneralInfo.php

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ class GeneralInfo extends \PleskX\Api\Struct
1414
/** @var string */
1515
public $guid;
1616

17+
/** @var string */
18+
public $status;
19+
1720
/** @var string */
1821
public $description;
1922

@@ -22,6 +25,7 @@ public function __construct($apiResponse)
2225
$this->_initScalarProperties($apiResponse, [
2326
'name',
2427
'ascii-name',
28+
'status',
2529
'guid',
2630
'description',
2731
]);

src/Api/Struct/Webspace/DiskUsage.php

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
// Copyright 1999-2019. Plesk International GmbH.
3+
// Author: Frederic Leclercq
4+
5+
namespace PleskX\Api\Struct\Webspace;
6+
7+
class DiskUsage extends \PleskX\Api\Struct
8+
{
9+
/** @var integer */
10+
public $httpdocs;
11+
12+
/** @var integer */
13+
public $httpsdocs;
14+
15+
/** @var integer */
16+
public $subdomains;
17+
18+
/** @var integer */
19+
public $anonftp;
20+
21+
/** @var integer */
22+
public $logs;
23+
24+
/** @var integer */
25+
public $dbases;
26+
27+
/** @var integer */
28+
public $mailboxes;
29+
30+
/** @var integer */
31+
public $maillists;
32+
33+
/** @var integer */
34+
public $domaindumps;
35+
36+
/** @var integer */
37+
public $configs;
38+
39+
/** @var integer */
40+
public $chroot;
41+
42+
public function __construct($apiResponse)
43+
{
44+
$this->_initScalarProperties($apiResponse, [
45+
'httpdocs',
46+
'httpsdocs',
47+
'subdomains',
48+
'anonftp',
49+
'logs',
50+
'dbases',
51+
'mailboxes',
52+
'maillists',
53+
'domaindumps',
54+
'configs',
55+
'chroot',
56+
]);
57+
}
58+
}

tests/WebspaceTest.php

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ public function testGetLimitDescriptor()
1818
$this->assertNotEmpty($descriptor->limits);
1919
}
2020

21+
public function testGetDiskUsage()
22+
{
23+
$webspace = static::_createWebspace();
24+
$diskusage = static::$_client->webspace()->getDiskUsage('id', $webspace->id);
25+
26+
$this->assertObjectHasAttribute('httpdocs', $diskusage);
27+
}
28+
2129
public function testGetPhysicalHostingDescriptor()
2230
{
2331
$descriptor = static::$_client->webspace()->getPhysicalHostingDescriptor();

0 commit comments

Comments
 (0)