Skip to content

Commit

Permalink
Allow public folder to be specified for more flexible hosting
Browse files Browse the repository at this point in the history
  • Loading branch information
lonnieezell committed Feb 2, 2017
1 parent 135ec37 commit a0422d1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions application/Config/Paths.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,18 @@ class Paths
* system directories.
*/
public $testsDirectory = '../tests';

/*
* ---------------------------------------------------------------
* PUBLIC DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the main index.php front-controller. By default,
* this is the `public` directory, but some hosts may not
* be able to map a primary domain to a sub-directory so you
* can change this to `public_html`, for example, to comply
* with your host's needs.
*/
public $publicDirectory = 'public';
}
6 changes: 4 additions & 2 deletions system/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
* so they are available in the config files that are loaded.
*/

$public = trim($paths->publicDirectory, '/');

// Path to code root folder (just up from public)
$pos = strrpos(FCPATH, 'public'.DIRECTORY_SEPARATOR);
define('ROOTPATH', substr_replace(FCPATH, '', $pos, strlen('public'.DIRECTORY_SEPARATOR)));
$pos = strrpos(FCPATH, $public.DIRECTORY_SEPARATOR);
define('ROOTPATH', substr_replace(FCPATH, '', $pos, strlen($public.DIRECTORY_SEPARATOR)));

// The path to the "application" folder
define('APPPATH', realpath($paths->applicationDirectory).DIRECTORY_SEPARATOR);
Expand Down

0 comments on commit a0422d1

Please sign in to comment.