Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/serverinfo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-11-19 17:12:06 +0300
committerJulius Härtl <jus@bitgrid.net>2020-11-24 10:52:02 +0300
commit208ae1aec88df99ec1e59f371749a450d99757d0 (patch)
tree8d0997207a4bfb68290c2e5c4b5fcd40c1e2b045
parentb707dc348ab134d7d03f6fb92228c6c4838aa377 (diff)
Properly fetch oracle database information
Signed-off-by: Julius Härtl <jus@bitgrid.net>
-rw-r--r--lib/DatabaseStatistics.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/DatabaseStatistics.php b/lib/DatabaseStatistics.php
index b7694b4..afdd039 100644
--- a/lib/DatabaseStatistics.php
+++ b/lib/DatabaseStatistics.php
@@ -22,6 +22,7 @@
namespace OCA\ServerInfo;
+use Doctrine\DBAL\DBALException;
use OCP\IConfig;
use OCP\IDBConnection;
@@ -60,7 +61,7 @@ class DatabaseStatistics {
$sql = 'SELECT sqlite_version() AS version';
break;
case 'oci':
- $sql = 'SELECT version FROM v$instance';
+ $sql = 'SELECT VERSION FROM PRODUCT_COMPONENT_VERSION';
break;
case 'mysql':
case 'pgsql':
@@ -68,11 +69,14 @@ class DatabaseStatistics {
$sql = 'SELECT VERSION() AS version';
break;
}
- $result = $this->connection->executeQuery($sql);
- $row = $result->fetch();
- $result->closeCursor();
- if ($row) {
- return $this->cleanVersion($row['version']);
+ try {
+ $result = $this->connection->executeQuery($sql);
+ $version = $result->fetchColumn();
+ $result->closeCursor();
+ if ($version) {
+ return $this->cleanVersion($version);
+ }
+ } catch (DBALException $e) {
}
return 'N/A';
}
@@ -143,7 +147,7 @@ class DatabaseStatistics {
$sql = 'SELECT SUM(bytes) as dbsize
FROM user_segments';
$result = $this->connection->executeQuery($sql);
- $database_size = ($row = $result->fetch()) ? $row['dbsize'] : false;
+ $database_size = ($row = $result->fetchColumn()) ? (int)$row : false;
$result->closeCursor();
break;
}