mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-26 03:57:51 +00:00
Chore(tools): Added phpcs & fixed x-quota-usage
This commit is contained in:
@@ -8,6 +8,9 @@ indent_style = space
|
|||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.php]
|
||||||
|
indent_size = 4
|
||||||
|
|
||||||
[.git{ignore,modules}]
|
[.git{ignore,modules}]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = 1
|
indent_size = 1
|
||||||
|
|||||||
8
.phpcs.xml
Normal file
8
.phpcs.xml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="PHP_CodeSniffer">
|
||||||
|
<description>PHP_CodeSniffer configuration</description>
|
||||||
|
<rule ref="PSR12">
|
||||||
|
<exclude name="PSR12.Operators.OperatorSpacing"/>
|
||||||
|
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
||||||
BIN
local/bin/phpcs
Executable file
BIN
local/bin/phpcs
Executable file
Binary file not shown.
@@ -8,24 +8,16 @@ $quota = '';
|
|||||||
$output = [];
|
$output = [];
|
||||||
$fsCharLenght = 0;
|
$fsCharLenght = 0;
|
||||||
|
|
||||||
if ($debug) {
|
$quota = shell_exec("quota -w");
|
||||||
$quota = "Disk quotas for user viir (uid 2913):
|
|
||||||
Filesystem blocks quota limit grace files quota limit grace
|
|
||||||
10.0.0.89:/www/webroots/2 8277615 52428800 52428800 0 0 0
|
|
||||||
10.0.0.179:/users1/users/2 1999431 52428800 52428800 0 0 0
|
|
||||||
10.0.0.90:/siilo/2 24835106 524288000 524288000 0 0 0";
|
|
||||||
} else {
|
|
||||||
// $quota = system("quota -w");
|
|
||||||
$quota = shell_exec("quota -w");
|
|
||||||
}
|
|
||||||
|
|
||||||
function pad($i, $n = 3, $p = ' ') {
|
function pad($i, $n = 3, $p = ' ')
|
||||||
|
{
|
||||||
return str_pad($i, $n, $p, STR_PAD_LEFT);
|
return str_pad($i, $n, $p, STR_PAD_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($quota)) {
|
if (empty($quota)) {
|
||||||
var_dump($quota);
|
var_dump($quota);
|
||||||
die("quota was empty\n");
|
die("quota was empty\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
$quota = explode("\n", $quota);
|
$quota = explode("\n", $quota);
|
||||||
@@ -57,8 +49,8 @@ foreach ($quota as $lineNum => $line) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($output)) {
|
if (!empty($output)) {
|
||||||
|
$header = sprintf(
|
||||||
$header = sprintf("%s | %s | %s | %s",
|
"%s | %s | %s | %s",
|
||||||
str_pad("Mount", $fsCharLenght),
|
str_pad("Mount", $fsCharLenght),
|
||||||
'Usage%',
|
'Usage%',
|
||||||
'Used/Total',
|
'Used/Total',
|
||||||
@@ -82,4 +74,3 @@ if (!empty($output)) {
|
|||||||
|
|
||||||
echo "\n\n";
|
echo "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user