Skip to content

Commit

Permalink
Merge pull request #39846 from nextcloud/pgSQLCheckRemove
Browse files Browse the repository at this point in the history
Remove check for very old PGsql version
  • Loading branch information
kesselb authored Aug 13, 2023
2 parents 6fcd00a + 7306960 commit 51a73d8
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions lib/private/legacy/OC_Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
use OC\Files\SetupManager;
use OCP\Files\Template\ITemplateManager;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IGroupManager;
use OCP\IURLGenerator;
use OCP\IUser;
Expand Down Expand Up @@ -715,51 +714,12 @@ public static function checkServer(\OC\SystemConfig $config) {
}
}

$errors = array_merge($errors, self::checkDatabaseVersion());

// Cache the result of this function
\OC::$server->getSession()->set('checkServer_succeeded', count($errors) == 0);

return $errors;
}

/**
* Check the database version
*
* @return array errors array
*/
public static function checkDatabaseVersion() {
$l = \OC::$server->getL10N('lib');
$errors = [];
$dbType = \OC::$server->getSystemConfig()->getValue('dbtype', 'sqlite');
if ($dbType === 'pgsql') {
// check PostgreSQL version
// TODO latest postgresql 8 released was 8 years ago, maybe remove the
// check completely?
try {
/** @var IDBConnection $connection */
$connection = \OC::$server->get(IDBConnection::class);
$result = $connection->executeQuery('SHOW SERVER_VERSION');
$data = $result->fetch();
$result->closeCursor();
if (isset($data['server_version'])) {
$version = $data['server_version'];
if (version_compare($version, '9.0.0', '<')) {
$errors[] = [
'error' => $l->t('PostgreSQL >= 9 required.'),
'hint' => $l->t('Please upgrade your database version.')
];
}
}
} catch (\Doctrine\DBAL\Exception $e) {
$logger = \OC::$server->getLogger();
$logger->warning('Error occurred while checking PostgreSQL version, assuming >= 9');
$logger->logException($e);
}
}
return $errors;
}

/**
* Check for correct file permissions of data directory
*
Expand Down

0 comments on commit 51a73d8

Please sign in to comment.