diff options
author | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-04-17 21:46:29 +0300 |
---|---|---|
committer | Daniel Kesselberg <mail@danielkesselberg.de> | 2020-04-18 12:06:48 +0300 |
commit | 8487657cc105c43fcf620a38ef8990be2016c3ce (patch) | |
tree | eaf4457d3af33983fa4d46c4d002bd6bf0b81029 /lib | |
parent | f690c1423c79b2f38e5c98bf3c46475e6fce2e86 (diff) |
Fix code style for existing files
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Controller/ApiController.php | 2 | ||||
-rw-r--r-- | lib/Controller/PageController.php | 6 | ||||
-rw-r--r-- | lib/DatabaseStatistics.php | 6 | ||||
-rw-r--r-- | lib/OperatingSystems/DefaultOs.php | 1 | ||||
-rw-r--r-- | lib/Os.php | 1 | ||||
-rw-r--r-- | lib/PhpStatistics.php | 1 | ||||
-rw-r--r-- | lib/SessionStatistics.php | 4 | ||||
-rw-r--r-- | lib/Settings/AdminSection.php | 1 | ||||
-rw-r--r-- | lib/Settings/AdminSettings.php | 29 | ||||
-rw-r--r-- | lib/StorageStatistics.php | 5 | ||||
-rw-r--r-- | lib/SystemStatistics.php | 7 |
11 files changed, 21 insertions, 42 deletions
diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 33be7a0..2db227e 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -94,7 +94,6 @@ class ApiController extends OCSController { * @return DataResponse */ public function info() { - return new DataResponse([ 'nextcloud' => [ 'system' => $this->systemStatistics->getSystemStatistics(), @@ -108,7 +107,6 @@ class ApiController extends OCSController { ], 'activeUsers' => $this->sessionStatistics->getSessionStatistics() ]); - } /** diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index e5455df..d85e45b 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -23,11 +23,8 @@ namespace OCA\ServerInfo\Controller; use OCP\AppFramework\Http\JSONResponse; use OCP\IRequest; -use OCP\AppFramework\Http\TemplateResponse; -use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Controller; use OCA\ServerInfo\SystemStatistics; -use OCP\IURLGenerator; class PageController extends Controller { @@ -56,13 +53,10 @@ class PageController extends Controller { * @return JSONResponse */ public function update() { - $data = [ 'system' => $this->systemStatistics->getSystemStatistics() ]; return new JSONResponse($data); } - - } diff --git a/lib/DatabaseStatistics.php b/lib/DatabaseStatistics.php index a604a34..b7694b4 100644 --- a/lib/DatabaseStatistics.php +++ b/lib/DatabaseStatistics.php @@ -22,7 +22,6 @@ namespace OCA\ServerInfo; - use OCP\IConfig; use OCP\IDBConnection; @@ -123,8 +122,7 @@ class DatabaseStatistics { $result->closeCursor(); if ($row['proname'] === 'pg_database_size') { $database = $this->config->getSystemValue('dbname'); - if (strpos($database, '.') !== false) - { + if (strpos($database, '.') !== false) { list($database, ) = explode('.', $database); } $sql = "SELECT oid @@ -166,6 +164,4 @@ class DatabaseStatistics { } return $version; } - - } diff --git a/lib/OperatingSystems/DefaultOs.php b/lib/OperatingSystems/DefaultOs.php index b11ebe0..f0b5dd3 100644 --- a/lib/OperatingSystems/DefaultOs.php +++ b/lib/OperatingSystems/DefaultOs.php @@ -19,6 +19,7 @@ */ namespace OCA\ServerInfo\OperatingSystems; + /** * Class Ubuntu * @@ -186,5 +186,4 @@ class Os { $data = $this->backend->getNetworkInterfaces(); return $data; } - } diff --git a/lib/PhpStatistics.php b/lib/PhpStatistics.php index 031ddea..e05e78a 100644 --- a/lib/PhpStatistics.php +++ b/lib/PhpStatistics.php @@ -22,7 +22,6 @@ namespace OCA\ServerInfo; - use bantu\IniGetWrapper\IniGetWrapper; /** diff --git a/lib/SessionStatistics.php b/lib/SessionStatistics.php index 949be74..05ea1fe 100644 --- a/lib/SessionStatistics.php +++ b/lib/SessionStatistics.php @@ -22,9 +22,7 @@ namespace OCA\ServerInfo; - use OCP\AppFramework\Utility\ITimeFactory; -use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; /** @@ -76,7 +74,6 @@ class SessionStatistics { * @return int */ private function getNumberOfActiveUsers($offset) { - $query = $this->connection->getQueryBuilder(); $query->select('uid') ->from('authtoken') @@ -91,5 +88,4 @@ class SessionStatistics { return count($activeUsers); } - } diff --git a/lib/Settings/AdminSection.php b/lib/Settings/AdminSection.php index 1b0a552..ab6ac20 100644 --- a/lib/Settings/AdminSection.php +++ b/lib/Settings/AdminSection.php @@ -22,7 +22,6 @@ namespace OCA\ServerInfo\Settings; - use OCP\IL10N; use OCP\IURLGenerator; use OCP\Settings\IIconSection; diff --git a/lib/Settings/AdminSettings.php b/lib/Settings/AdminSettings.php index 03bfeb2..c209166 100644 --- a/lib/Settings/AdminSettings.php +++ b/lib/Settings/AdminSettings.php @@ -102,20 +102,20 @@ class AdminSettings implements ISettings { public function getForm() { $monitoringEndPoint = $this->urlGenerator->getAbsoluteURL('ocs/v2.php/apps/serverinfo/api/v1/info'); $params = [ - 'hostname' => $this-> os -> getHostname(), - 'osname' => $this-> os -> getOSName(), - 'memory' => $this-> os -> getMemory(), - 'cpu' => $this-> os -> getCPUName(), - 'diskinfo' => $this-> os -> getDiskInfo(), - 'networkinfo' => $this-> os -> getNetworkInfo(), - 'networkinterfaces' => $this-> os -> getNetworkInterfaces(), - 'ocs' => $monitoringEndPoint, - 'storage' => $this->storageStatistics->getStorageStatistics(), - 'shares' => $this->shareStatistics->getShareStatistics(), - 'php' => $this->phpStatistics->getPhpStatistics(), - 'database' => $this->databaseStatistics->getDatabaseStatistics(), - 'activeUsers' => $this->sessionStatistics->getSessionStatistics(), - 'system' => $this->systemStatistics->getSystemStatistics() + 'hostname' => $this-> os -> getHostname(), + 'osname' => $this-> os -> getOSName(), + 'memory' => $this-> os -> getMemory(), + 'cpu' => $this-> os -> getCPUName(), + 'diskinfo' => $this-> os -> getDiskInfo(), + 'networkinfo' => $this-> os -> getNetworkInfo(), + 'networkinterfaces' => $this-> os -> getNetworkInterfaces(), + 'ocs' => $monitoringEndPoint, + 'storage' => $this->storageStatistics->getStorageStatistics(), + 'shares' => $this->shareStatistics->getShareStatistics(), + 'php' => $this->phpStatistics->getPhpStatistics(), + 'database' => $this->databaseStatistics->getDatabaseStatistics(), + 'activeUsers' => $this->sessionStatistics->getSessionStatistics(), + 'system' => $this->systemStatistics->getSystemStatistics() ]; return new TemplateResponse('serverinfo', 'settings-admin', $params); @@ -138,5 +138,4 @@ class AdminSettings implements ISettings { public function getPriority() { return 0; } - } diff --git a/lib/StorageStatistics.php b/lib/StorageStatistics.php index ed8079a..ce5586b 100644 --- a/lib/StorageStatistics.php +++ b/lib/StorageStatistics.php @@ -89,9 +89,9 @@ class StorageStatistics { ->from('storages'); if ($type === 'home') { $query->where($query->expr()->like('id', $query->createNamedParameter('home::%'))); - } else if ($type === 'local') { + } elseif ($type === 'local') { $query->where($query->expr()->like('id', $query->createNamedParameter('local::%'))); - } else if ($type === 'other') { + } elseif ($type === 'other') { $query->where($query->expr()->notLike('id', $query->createNamedParameter('home::%'))); $query->andWhere($query->expr()->notLike('id', $query->createNamedParameter('local::%'))); } @@ -100,5 +100,4 @@ class StorageStatistics { $result->closeCursor(); return (int) $row['num_entries']; } - } diff --git a/lib/SystemStatistics.php b/lib/SystemStatistics.php index 159858a..09346bb 100644 --- a/lib/SystemStatistics.php +++ b/lib/SystemStatistics.php @@ -104,7 +104,7 @@ class SystemStatistics { exec("/usr/sbin/swapinfo", $return, $status); if ($status === 0 && count($return) > 1) { $line = preg_split("/[\s]+/", $return[1]); - if(count($line) > 3) { + if (count($line) > 3) { $swapTotal = (int)$line[3]; $swapFree = $swapTotal - (int)$line[2]; } @@ -133,7 +133,7 @@ class SystemStatistics { // the last value is a empty string after explode, skip it $values = array_slice($array, 0, count($array) - 1); $data = []; - foreach($values as $value) { + foreach ($values as $value) { list($k, $v) = preg_split('/[\s:]+/', $value); $data[$k] = $v; } @@ -172,7 +172,7 @@ class SystemStatistics { $info['num_installed'] = \count($apps); // iteriate through all installed apps. - foreach($apps as $appId) { + foreach ($apps as $appId) { // check if there is any new version available for that specific app $newVersion = $this->installer->isUpdateAvailable($appId); if ($newVersion) { @@ -222,5 +222,4 @@ class SystemStatistics { 'loadavg' => $loadavg ]; } - } |