*/ class LangRepository { public function __construct(protected IDBConnection $db) { $this->db = $db; } public function getUsedLangs(): array { $qb = $this->db->getQueryBuilder(); $qb->select($qb->createFunction('DISTINCT configvalue')) ->where('configkey=:configkey and appid=:appid and configvalue<>:configvalue') ->setParameters([ 'configkey' => 'lang', 'appid' => 'core', 'configvalue' => 'en', ]) ->from('preferences') ; // Nextcloud >=33+ if (method_exists($qb, 'executeQuery')) { $stmt = $qb->executeQuery(); } else { $stmt = $qb->execute(); } $langs = ['en']; foreach ($stmt->fetchAll() as $result) { $langs[] = $result['configvalue']; } return $langs; } }