aboutsummaryrefslogtreecommitdiff
path: root/cli/do-install.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2019-09-29 16:22:50 +0200
committerGravatar GitHub <noreply@github.com> 2019-09-29 16:22:50 +0200
commite3e5954394f4523850c78e80e496f1b916622677 (patch)
tree2e20d9091735e1da1de85e273e19635f58111e0f /cli/do-install.php
parentec4307c1a64a0f60648fdd7d0a2eb819bbf12965 (diff)
PDO refactoring for code simplification (#2522)
* PDO refactor * Automatic prefix when using the syntax `_tableName` * Uniformity: MySQL is now PDO::ATTR_EMULATE_PREPARES = false just like SQLite and PostgreSQL, with consequences such as only one statement per query * Use PDO methods exec(), query(), prepare() + execute() in a more efficient way * Remove auto-update SQL code for versions older than FreshRSS 1.5 (3 years old) * The name of the default category is set in PHP instead of in the DB (simplies SQL and allows changing the name according to the FreshRSS language) * Rename `->bd` to `->pdo` (less of a frenshism, and more informative) * Fix some requests, which were not compatible with MySQL prepared statements * Whitespace * Fix syntax for PostgreSQL sequences + MySQL install * Minor formatting * Fix lastInsertId for PostgreSQL * Use PHP 5.6+ const Take advantage of https://github.com/FreshRSS/FreshRSS/pull/2527 https://www.php.net/manual/en/migration56.new-features.php * A bit of forgotten PHP 5.6 simplification for cURL * Forgotten $s * Mini fix custom user config https://github.com/FreshRSS/FreshRSS/pull/2490/files#r326290346 * More work on install.php but not finished * install.php working * More cleaning of PDO in install * Even more simplification Take advantage of PDO->exec() to run multiple statements * Disallow changing the name of the default category https://github.com/FreshRSS/FreshRSS/pull/2522#discussion_r326967724
Diffstat (limited to 'cli/do-install.php')
-rwxr-xr-xcli/do-install.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/cli/do-install.php b/cli/do-install.php
index fd5aa4a3c..dea5d235e 100755
--- a/cli/do-install.php
+++ b/cli/do-install.php
@@ -3,7 +3,7 @@
require(__DIR__ . '/_cli.php');
if (!file_exists(DATA_PATH . '/do-install.txt')) {
- fail('FreshRSS looks to be already installed! Please use `./cli/reconfigure.php` instead.');
+ fail('FreshRSS seems to be already installed! Please use `./cli/reconfigure.php` instead.');
}
$params = array(
@@ -82,10 +82,9 @@ if (file_put_contents(join_path(DATA_PATH, 'config.php'),
fail('FreshRSS could not write configuration file!: ' . join_path(DATA_PATH, 'config.php'));
}
-$config['db']['default_user'] = $config['default_user'];
-if (!checkDb($config['db'])) {
+if (!checkDb()) {
@unlink(join_path(DATA_PATH, 'config.php'));
- fail('FreshRSS database error: ' . (empty($config['db']['error']) ? 'Unknown error' : $config['db']['error']));
+ fail('FreshRSS database error: ' . (empty($_SESSION['bd_error']) ? 'Unknown error' : $_SESSION['bd_error']));
}
echo '• Remember to create the default user: ', $config['default_user'] , "\n",