Просмотр исходного кода

Fix sqlite_version (#7205)

* Fix sqlite_version
for https://github.com/FreshRSS/FreshRSS/pull/7161

* Fix PostgreSQL
Alexandre Alapetite 1 год назад
Родитель
Сommit
7a79717e10
3 измененных файлов с 15 добавлено и 1 удалено
  1. 5 1
      app/Models/DatabaseDAO.php
  2. 5 0
      app/Models/DatabaseDAOPGSQL.php
  3. 5 0
      app/Models/DatabaseDAOSQLite.php

+ 5 - 1
app/Models/DatabaseDAO.php

@@ -197,13 +197,17 @@ class FreshRSS_DatabaseDAO extends Minz_ModelPdo {
 		self::$staticVersion = $version;
 	}
 
+	protected function selectVersion(): string {
+		return $this->fetchValue('SELECT version()') ?? '';
+	}
+
 	public function version(): string {
 		if (self::$staticVersion !== null) {
 			return self::$staticVersion;
 		}
 		static $version = null;
 		if (!is_string($version)) {
-			$version = $this->fetchValue('SELECT version()') ?? '';
+			$version = $this->selectVersion();
 		}
 		return $version;
 	}

+ 5 - 0
app/Models/DatabaseDAOPGSQL.php

@@ -59,6 +59,11 @@ SQL;
 		];
 	}
 
+	#[\Override]
+	protected function selectVersion(): string {
+		return $this->fetchValue('SELECT version()') ?? '';
+	}
+
 	#[\Override]
 	public function size(bool $all = false): int {
 		if ($all) {

+ 5 - 0
app/Models/DatabaseDAOSQLite.php

@@ -72,6 +72,11 @@ class FreshRSS_DatabaseDAOSQLite extends FreshRSS_DatabaseDAO {
 		];
 	}
 
+	#[\Override]
+	protected function selectVersion(): string {
+		return $this->fetchValue('SELECT sqlite_version()') ?? '';
+	}
+
 	#[\Override]
 	public function size(bool $all = false): int {
 		$sum = 0;