Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use variable for Config/Paths config to reduce repetitive definition #4745

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

// Load our paths config file
// This is the line that might need to be changed, depending on your folder structure.
require realpath(FCPATH . '../app/Config/Paths.php') ?: FCPATH . '../app/Config/Paths.php';
$pathsConfig = FCPATH . '../app/Config/Paths.php';
// ^^^ Change this if you move your application folder
require realpath($pathsConfig) ?: $pathsConfig;

$paths = new Config\Paths();

Expand Down
3 changes: 2 additions & 1 deletion spark
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ if (strpos(PHP_SAPI, 'cgi') === 0)
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);

// Load our paths config file
require realpath('app/Config/Paths.php') ?: 'app/Config/Paths.php';
$pathsConfig = 'app/Config/Paths.php';
// ^^^ Change this line if you move your application folder
require realpath($pathsConfig) ?: $pathsConfig;

$paths = new Config\Paths();

Expand Down
6 changes: 3 additions & 3 deletions user_guide_src/source/general/managing_apps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ they can find the ``Paths`` configuration file:

- ``/spark`` runs command line apps; the path is specified on or about line 36::

require realpath('app/Config/Paths.php') ?: 'app/Config/Paths.php';
// ^^^ Change this if you move your application folder
$pathsConfig = 'app/Config/Paths.php';
// ^^^ Change this line if you move your application folder


- ``/public/index.php`` is the front controller for your webapp; the config
path is specified on or about line 20::

require realpath(FCPATH . '../app/Config/Paths.php') ?: FCPATH . '../app/Config/Paths.php';
$pathsConfig = FCPATH . '../app/Config/Paths.php';
// ^^^ Change this if you move your application folder


Expand Down