migrated a few functions to new Settings class and removed unused function createAWStatsVhost(), refs #1325

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-12-15 13:05:19 +01:00
parent 558108008a
commit 52aaedd33a
15 changed files with 85 additions and 177 deletions

View File

@@ -15,38 +15,34 @@
*
*/
function getFilesystemQuota()
{
global $settings, $theme;
if ($settings['system']['diskquota_enabled'])
{
# Fetch all quota in the desired partition
exec($settings['system']['diskquota_repquota_path'] . " -np " . escapeshellarg($settings['system']['diskquota_customer_partition']), $repquota);
function getFilesystemQuota() {
if (Settings::Get('system.diskquota_enabled')) {
// Fetch all quota in the desired partition
exec(Settings::Get('system.diskquota_repquota_path') . " -np " . escapeshellarg(Settings::Get('system.diskquota_customer_partition')), $repquota);
$usedquota = array();
foreach ($repquota as $tmpquota)
{
# Let's see if the line matches a quota - line
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches))
{
# It matches - put it into an array with userid as key (for easy lookup later)
foreach ($repquota as $tmpquota) {
// Let's see if the line matches a quota - line
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches)) {
// It matches - put it into an array with userid as key (for easy lookup later)
$usedquota[$matches[1]] = array(
'block' => array(
'used' => $matches[2],
'soft' => $matches[3],
'hard' => $matches[4],
'grace' => $matches[5]
),
'used' => $matches[2],
'soft' => $matches[3],
'hard' => $matches[4],
'grace' => $matches[5]
),
'file' => array(
'used' => $matches[6],
'soft' => $matches[7],
'hard' => $matches[8],
'grace' => $matches[9]
),
'used' => $matches[6],
'soft' => $matches[7],
'hard' => $matches[8],
'grace' => $matches[9]
),
);
}
}
return $usedquota;
}
return false;