Skip to content

Commit f92665b

Browse files
committed
Use variable for Config/Paths config to reduce repetitive definition
1 parent 59e34a1 commit f92665b

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ 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+
// This is the line that might need to be changed, depending on your folder structure.
34+
$pathsConfig = FCPATH . '../app/Config/Paths.php';
3435
// ^^^ Change this if you move your application folder
3536

3637

0 commit comments

Comments
 (0)