Make user settings available in SQLite (needed for #1813)

This commit is contained in:
Bernd Bestel 2022-03-29 19:44:01 +02:00
parent acebed5aae
commit 91b984d52d
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300

View File

@ -2,6 +2,8 @@
namespace Grocy\Services; namespace Grocy\Services;
use Grocy\Services\UsersService;
class DatabaseService class DatabaseService
{ {
private static $DbConnection = null; private static $DbConnection = null;
@ -73,6 +75,11 @@ class DatabaseService
return (false !== mb_ereg($pattern, $value)) ? 1 : 0; return (false !== mb_ereg($pattern, $value)) ? 1 : 0;
}); });
$pdo->sqliteCreateFunction('grocy_user_setting', function ($value) {
$usersService = new UsersService();
return $usersService->GetUserSetting(GROCY_USER_ID, $value);
});
self::$DbConnectionRaw = $pdo; self::$DbConnectionRaw = $pdo;
} }