Subversion Repositories ALCASAR

Rev

Rev 2788 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2788 rexy 1
<?php
2
/**
3
 * DiskDevice TO class
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI_TO
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   SVN: $Id: class.DiskDevice.inc.php 252 2009-06-17 13:06:44Z bigmichi1 $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 /**
16
 * DiskDevice TO class
17
 *
18
 * @category  PHP
19
 * @package   PSI_TO
20
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
21
 * @copyright 2009 phpSysInfo
22
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
23
 * @version   Release: 3.0
24
 * @link      http://phpsysinfo.sourceforge.net
25
 */
26
class DiskDevice
27
{
28
    /**
29
     * name of the disk device
30
     *
31
     * @var String
32
     */
33
    private $_name = "";
34
 
35
    /**
36
     * type of the filesystem on the disk device
37
     *
38
     * @var String
39
     */
40
    private $_fsType = "";
41
 
42
    /**
43
     * diskspace that is free in bytes
44
     *
45
     * @var Integer
46
     */
47
    private $_free = 0;
48
 
49
    /**
50
     * diskspace that is used in bytes
51
     *
52
     * @var Integer
53
     */
54
    private $_used = 0;
55
 
56
    /**
57
     * total diskspace
58
     *
59
     * @var Integer
60
     */
61
    private $_total = 0;
62
 
63
    /**
64
     * mount point of the disk device if available
65
     *
66
     * @var String
67
     */
68
    private $_mountPoint = null;
69
 
70
    /**
71
     * additional options of the device, like mount options
72
     *
73
     * @var String
74
     */
75
    private $_options = null;
76
 
77
    /**
78
     * inodes usage in percent if available
79
     *
2976 rexy 80
     * @var Integer
2788 rexy 81
     */
82
    private $_percentInodesUsed = null;
83
 
84
    /**
85
     * ignore mode
86
     *
2976 rexy 87
     * @var Integer
2788 rexy 88
     */
89
    private $_ignore = 0;
90
 
91
    /**
92
     * Returns PercentUsed calculated when function is called from internal values
93
     *
94
     * @see DiskDevice::$_total
95
     * @see DiskDevice::$_used
96
     *
97
     * @return Integer
98
     */
99
    public function getPercentUsed()
100
    {
101
        if ($this->_total > 0) {
2976 rexy 102
            return 100 - min(floor($this->_free / $this->_total * 100), 100);
2788 rexy 103
        } else {
104
            return 0;
105
        }
106
    }
107
 
108
    /**
109
     * Returns $_PercentInodesUsed.
110
     *
111
     * @see DiskDevice::$_PercentInodesUsed
112
     *
113
     * @return Integer
114
     */
115
    public function getPercentInodesUsed()
116
    {
117
        return $this->_percentInodesUsed;
118
    }
119
 
120
    /**
121
     * Sets $_PercentInodesUsed.
122
     *
123
     * @param Integer $percentInodesUsed inodes percent
124
     *
125
     * @see DiskDevice::$_PercentInodesUsed
126
     *
127
     * @return Void
128
     */
129
    public function setPercentInodesUsed($percentInodesUsed)
130
    {
131
        $this->_percentInodesUsed = $percentInodesUsed;
132
    }
133
 
134
    /**
135
     * Returns $_free.
136
     *
137
     * @see DiskDevice::$_free
138
     *
139
     * @return Integer
140
     */
141
    public function getFree()
142
    {
143
        return $this->_free;
144
    }
145
 
146
    /**
147
     * Sets $_free.
148
     *
149
     * @param Integer $free free bytes
150
     *
151
     * @see DiskDevice::$_free
152
     *
153
     * @return Void
154
     */
155
    public function setFree($free)
156
    {
157
        $this->_free = $free;
158
    }
159
 
160
    /**
161
     * Returns $_fsType.
162
     *
163
     * @see DiskDevice::$_fsType
164
     *
165
     * @return String
166
     */
167
    public function getFsType()
168
    {
169
        return $this->_fsType;
170
    }
171
 
172
    /**
173
     * Sets $_fsType.
174
     *
175
     * @param String $fsType filesystemtype
176
     *
177
     * @see DiskDevice::$_fsType
178
     *
179
     * @return Void
180
     */
181
    public function setFsType($fsType)
182
    {
183
        $this->_fsType = $fsType;
184
    }
185
 
186
    /**
187
     * Returns $_mountPoint.
188
     *
189
     * @see DiskDevice::$_mountPoint
190
     *
191
     * @return String
192
     */
193
    public function getMountPoint()
194
    {
195
        return $this->_mountPoint;
196
    }
197
 
198
    /**
199
     * Sets $_mountPoint.
200
     *
201
     * @param String $mountPoint mountpoint
202
     *
203
     * @see DiskDevice::$_mountPoint
204
     *
205
     * @return Void
206
     */
207
    public function setMountPoint($mountPoint)
208
    {
209
        $this->_mountPoint = $mountPoint;
210
    }
211
 
212
    /**
213
     * Returns $_name.
214
     *
215
     * @see DiskDevice::$_name
216
     *
217
     * @return String
218
     */
219
    public function getName()
220
    {
221
        return $this->_name;
222
    }
223
 
224
    /**
225
     * Sets $_name.
226
     *
227
     * @param String $name device name
228
     *
229
     * @see DiskDevice::$_name
230
     *
231
     * @return Void
232
     */
233
    public function setName($name)
234
    {
235
        $this->_name = $name;
236
    }
237
 
238
    /**
239
     * Returns $_options.
240
     *
241
     * @see DiskDevice::$_options
242
     *
243
     * @return String
244
     */
245
    public function getOptions()
246
    {
247
        return $this->_options;
248
    }
249
 
250
    /**
251
     * Sets $_options.
252
     *
253
     * @param String $options additional options
254
     *
255
     * @see DiskDevice::$_options
256
     *
257
     * @return Void
258
     */
259
    public function setOptions($options)
260
    {
261
        $this->_options = $options;
262
    }
263
 
264
    /**
265
     * Returns $_total.
266
     *
267
     * @see DiskDevice::$_total
268
     *
269
     * @return Integer
270
     */
271
    public function getTotal()
272
    {
273
        return $this->_total;
274
    }
275
 
276
    /**
277
     * Sets $_total.
278
     *
279
     * @param Integer $total total bytes
280
     *
281
     * @see DiskDevice::$_total
282
     *
283
     * @return Void
284
     */
285
    public function setTotal($total)
286
    {
287
        $this->_total = $total;
288
    }
289
 
290
    /**
291
     * Returns $_used.
292
     *
293
     * @see DiskDevice::$_used
294
     *
295
     * @return Integer
296
     */
297
    public function getUsed()
298
    {
299
        return $this->_used;
300
    }
301
 
302
    /**
303
     * Sets $_used.
304
     *
305
     * @param Integer $used used bytes
306
     *
307
     * @see DiskDevice::$_used
308
     *
309
     * @return Void
310
     */
311
    public function setUsed($used)
312
    {
313
        $this->_used = $used;
314
    }
315
 
316
    /**
317
     * Returns $_ignore.
318
     *
319
     * @see DiskDevice::$_ignore
320
     *
321
     * @return Integer
322
     */
323
    public function getIgnore()
324
    {
325
        return $this->_ignore;
326
    }
327
 
328
    /**
329
     * Sets $_ignore.
330
     *
331
     * @see DiskDevice::$_ignore
332
     *
333
     * @return Void
334
     */
335
    public function setIgnore($ignore)
336
    {
337
        $this->_ignore = $ignore;
338
    }
339
}