Skip to content

Commit 5eb219e

Browse files
authored
Merge pull request #4745 from samsonasik/use-variable-paths-config
Use variable for Config/Paths config to reduce repetitive definition
2 parents 1c4872c + d60a5b7 commit 5eb219e

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

public/index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717

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

2324
$paths = new Config\Paths();
2425

spark

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ if (strpos(PHP_SAPI, 'cgi') === 0)
3333
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
3434

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

3940
$paths = new Config\Paths();
4041

user_guide_src/source/general/managing_apps.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ they can find the ``Paths`` configuration file:
2323

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

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

2929

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

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

3636

0 commit comments

Comments
 (0)