summaryrefslogtreecommitdiff
path: root/lib/lib_install.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-04-17 08:30:21 +0200
committerGravatar GitHub <noreply@github.com> 2023-04-17 08:30:21 +0200
commitf3760f138dcbaf7a2190336a0378cf1b2190c9f5 (patch)
tree6fac8fbf9efd7aa74a8e3970ab70ccf85287b2cd /lib/lib_install.php
parent41fa4e746df8c2e2399ed753b4994ca85cb21358 (diff)
Complete PHPStan Level 6 (#5305)
* Complete PHPStan Level 6 Fix https://github.com/FreshRSS/FreshRSS/issues/4112 And initiate PHPStan Level 7 * PHPStan Level 6 for tests * Use phpstan/phpstan-phpunit * Update to PHPStan version 1.10 * Fix mixed bug * Fix mixed return bug * Fix paginator bug * Fix FreshRSS_UserConfiguration * A couple more Minz_Configuration bug fixes * A few trivial PHPStan Level 7 fixes * A few more simple PHPStan Level 7 * More files passing PHPStan Level 7 Add interface to replace removed class from https://github.com/FreshRSS/FreshRSS/pull/5251 * A few more PHPStan Level 7 preparations * A few last details
Diffstat (limited to 'lib/lib_install.php')
-rw-r--r--lib/lib_install.php12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/lib_install.php b/lib/lib_install.php
index 18f4a732a..23c902440 100644
--- a/lib/lib_install.php
+++ b/lib/lib_install.php
@@ -1,7 +1,7 @@
<?php
-Minz_Configuration::register('default_system', join_path(FRESHRSS_PATH, 'config.default.php'));
-Minz_Configuration::register('default_user', join_path(FRESHRSS_PATH, 'config-user.default.php'));
+FreshRSS_SystemConfiguration::register('default_system', join_path(FRESHRSS_PATH, 'config.default.php'));
+FreshRSS_UserConfiguration::register('default_user', join_path(FRESHRSS_PATH, 'config-user.default.php'));
/** @return array<string,string> */
function checkRequirements(string $dbType = ''): array {
@@ -76,7 +76,7 @@ function checkRequirements(string $dbType = ''): array {
}
function generateSalt(): string {
- return sha1(uniqid('' . mt_rand(), true).implode('', stat(__FILE__)));
+ return sha1(uniqid('' . mt_rand(), true).implode('', stat(__FILE__) ?: []));
}
function initDb(): string {
@@ -88,10 +88,14 @@ function initDb(): string {
$db['pdo_options'][PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$conf->db = $db; //TODO: Remove this Minz limitation "Indirect modification of overloaded property"
+ if (empty($db['type'])) {
+ $db['type'] = 'sqlite';
+ }
+
//Attempt to auto-create database if it does not already exist
if ($db['type'] !== 'sqlite') {
Minz_ModelPdo::$usesSharedPdo = false;
- $dbBase = isset($db['base']) ? $db['base'] : '';
+ $dbBase = $db['base'] ?? '';
//For first connection, use default database for PostgreSQL, empty database for MySQL / MariaDB:
$db['base'] = $db['type'] === 'pgsql' ? 'postgres' : '';
$conf->db = $db;