From 211068ce504c48ee95e742a12ec04f16f3988c6c Mon Sep 17 00:00:00 2001 From: Maryana Rozhankivska Date: Thu, 21 Aug 2014 17:17:36 +0300 Subject: [PATCH] vendor dir is not accessible before install, sqlite db dir write check moved into db class --- check_setup.php | 5 ----- inc/poche/Database.class.php | 4 ++++ index.php | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) mode change 100644 => 100755 check_setup.php diff --git a/check_setup.php b/check_setup.php old mode 100644 new mode 100755 index 7e378b153..cf02c34ba --- a/check_setup.php +++ b/check_setup.php @@ -5,11 +5,6 @@ if (! is_writable('cache')) { die('The directory "cache" must be writeable by your web server user'); } -// Check if /db is writeable -if (! is_writable('db') && STORAGE === 'sqlite') { - die('The directory "db" must be writeable by your web server user'); -} - // install folder still present, need to install wallabag if (is_dir('install')) { require('install/index.php'); diff --git a/inc/poche/Database.class.php b/inc/poche/Database.class.php index 2c80b64b5..dfd7ae349 100755 --- a/inc/poche/Database.class.php +++ b/inc/poche/Database.class.php @@ -23,6 +23,10 @@ class Database { { switch (STORAGE) { case 'sqlite': + // Check if /db is writeable + if ( !is_writable(STORAGE_SQLITE) || !is_writable(dirname(STORAGE_SQLITE))) { + die('An error occured: "db" directory must be writeable for your web server user!'); + } $db_path = 'sqlite:' . STORAGE_SQLITE; $this->handle = new PDO($db_path); break; diff --git a/index.php b/index.php index f191d7e71..39990d55a 100755 --- a/index.php +++ b/index.php @@ -10,8 +10,8 @@ define ('POCHE', '1.8.0'); require 'check_essentials.php'; -require_once 'inc/poche/global.inc.php'; require 'check_setup.php'; +require_once 'inc/poche/global.inc.php'; // Start session Session::$sessionName = 'wallabag';