aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRubén Calvo <rubencm@gmail.com>2017-06-15 16:56:19 +0200
committerRubén Calvo <rubencm@gmail.com>2017-06-15 16:56:19 +0200
commite6bdba7da1069c71e9b3c148266d0cd90b6cf1a4 (patch)
treecca27574e1df7938f8ee6630a4bad364d6f7def2
parenteafbaf4c3059a4932f5e74e1124388594aad6117 (diff)
downloadforums-e6bdba7da1069c71e9b3c148266d0cd90b6cf1a4.tar
forums-e6bdba7da1069c71e9b3c148266d0cd90b6cf1a4.tar.gz
forums-e6bdba7da1069c71e9b3c148266d0cd90b6cf1a4.tar.bz2
forums-e6bdba7da1069c71e9b3c148266d0cd90b6cf1a4.tar.xz
forums-e6bdba7da1069c71e9b3c148266d0cd90b6cf1a4.zip
[ticket/15243] Check permissions before installing with SQLite
PHPBB3-15243
-rw-r--r--phpBB/language/en/install.php1
-rw-r--r--phpBB/phpbb/install/helper/database.php9
2 files changed, 10 insertions, 0 deletions
diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php
index 1ee2fa525c..f7d9f58d43 100644
--- a/phpBB/language/en/install.php
+++ b/phpBB/language/en/install.php
@@ -199,6 +199,7 @@ $lang = array_merge($lang, array(
'INST_ERR_DB_NO_NAME' => 'No database name specified.',
'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.',
'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.',
+ 'INST_ERR_DB_NO_WRITABLE' => 'Both the database and the directory containing it must be writable.',
'INST_ERR_DB_NO_ERROR' => 'No error message given.',
'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.',
'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.',
diff --git a/phpBB/phpbb/install/helper/database.php b/phpBB/phpbb/install/helper/database.php
index 192f0a3654..59b86a8ca7 100644
--- a/phpBB/phpbb/install/helper/database.php
+++ b/phpBB/phpbb/install/helper/database.php
@@ -336,6 +336,15 @@ class database
);
}
+ // Check if SQLite database is writable
+ if ($dbms_info['SCHEMA'] === 'sqlite'
+ && (!$this->filesystem->is_writable($dbhost) || !$this->filesystem->is_writable(pathinfo($dbhost, PATHINFO_DIRNAME))))
+ {
+ $errors[] = array(
+ 'title' =>'INST_ERR_DB_NO_WRITABLE',
+ );
+ }
+
// Try to connect to db
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, false, true)))
{