Skip to content

Commit 39e94ef

Browse files
committed
fix(oracle): Add a warning for Oracle 11
Signed-off-by: Joas Schilling <[email protected]>
1 parent fbff470 commit 39e94ef

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

apps/settings/lib/SetupChecks/SupportedDatabase.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ class SupportedDatabase implements ISetupCheck {
2222
private const MAX_MYSQL = '8.4';
2323
private const MIN_POSTGRES = '14';
2424
private const MAX_POSTGRES = '18';
25+
private const MIN_ORACLE = '12.2';
26+
private const MAX_ORACLE = '26';
2527

2628
public function __construct(
2729
private IL10N $l10n,
@@ -107,7 +109,29 @@ public function run(): SetupResult {
107109
);
108110
}
109111
} elseif ($databasePlatform === IDBConnection::PLATFORM_ORACLE) {
110-
$version = 'Oracle';
112+
$result = $this->connection->executeQuery('SELECT VERSION FROM PRODUCT_COMPONENT_VERSION');
113+
$version = $result->fetchOne();
114+
$result->closeCursor();
115+
$versionLower = strtolower($version);
116+
// we only care about X.Y not X.Y.Z differences
117+
[$major, $minor, ] = explode('.', $versionLower);
118+
$versionConcern = $major . '.' . $minor;
119+
if (version_compare($versionConcern, self::MIN_ORACLE, '<') || version_compare($versionConcern, self::MAX_ORACLE, '>')) {
120+
$extendedWarning = '';
121+
if (version_compare($versionConcern, self::MIN_ORACLE, '<')) {
122+
$extendedWarning = "\n" . $this->l10n->t('Nextcloud %d does not support your current version, so be sure to update the database before updating your Nextcloud Server.', [33]);
123+
}
124+
return SetupResult::warning(
125+
$this->l10n->t(
126+
'Oracle version "%1$s" detected. Oracle >=%2$s and <=%3$s is suggested for best performance, stability and functionality with this version of Nextcloud.',
127+
[
128+
$version,
129+
self::MIN_ORACLE,
130+
self::MAX_ORACLE,
131+
])
132+
. $extendedWarning
133+
);
134+
}
111135
} elseif ($databasePlatform === IDBConnection::PLATFORM_SQLITE) {
112136
return SetupResult::warning(
113137
$this->l10n->t('SQLite is currently being used as the backend database. For larger installations we recommend that you switch to a different database backend. This is particularly recommended when using the desktop client for file synchronisation. To migrate to another database use the command line tool: "occ db:convert-type".'),

0 commit comments

Comments
 (0)