Navigation Menu

Skip to content

Commit

Permalink
use dedicated data directory in root project for sqlite default lcoaiton
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Jun 23, 2020
1 parent d0ec768 commit 241c01e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 18 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Expand Up @@ -60,9 +60,6 @@ writable/session/*
writable/uploads/*
!writable/uploads/index.html

writable/data/*
!writable/data/index.html

writable/debugbar/*

php_errors.log
Expand Down
6 changes: 6 additions & 0 deletions data/.htaccess
@@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
5 changes: 4 additions & 1 deletion system/Database/SQLite3/Connection.php
Expand Up @@ -85,10 +85,13 @@ public function connect(bool $persistent = false)
}
try
{
$dataPath = ROOTPATH . 'data';
! is_dir($dataPath) && mkdir($dataPath, 0777, true);

$this->database = ($this->database === ':memory:')
? $this->database
: (strpos($this->database, DIRECTORY_SEPARATOR) === false
? WRITEPATH . 'data' . DIRECTORY_SEPARATOR . $this->database
? $dataPath . DIRECTORY_SEPARATOR . $this->database
: $this->database);

return (! $this->password)
Expand Down
4 changes: 2 additions & 2 deletions user_guide_src/source/changelogs/v4.0.4.rst
Expand Up @@ -5,11 +5,11 @@ Release Date: Unreleased

**4.0.4 release of CodeIgniter4**

The location for the SQLite3 database has changed and by default will be now located in a ``writable/data`` folder instead of the ``public`` folder.
The location for the SQLite3 database has changed and by default will be now located in a ``./data`` folder instead of the ``public`` folder.

Enhancements:


Bugs Fixed:

- Fixed location for the SQLite3 database which by default will be now located in a ``writable/data`` folder instead of the ``public`` folder.
- Fixed location for the SQLite3 database which by default will be now located in a ``./data`` folder instead of the ``public`` folder.
2 changes: 1 addition & 1 deletion user_guide_src/source/database/configuration.rst
Expand Up @@ -38,7 +38,7 @@ prototype::
The name of the class property is the connection name, and can be used
while connecting to specify a group name.

.. note:: The default location of the SQLite3 database is in the ``writable/data/`` folder.
.. note:: The default location of the SQLite3 database is in the ``./data/`` folder.
If you want to change the location, you must set the full path to the new folder.

Some database drivers (such as PDO, PostgreSQL, Oracle, ODBC) might
Expand Down
11 changes: 0 additions & 11 deletions writable/data/index.html

This file was deleted.

0 comments on commit 241c01e

Please sign in to comment.