Skip to content

Commit

Permalink
chore: tweak the files so that their contents are as same as possible.
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed May 7, 2022
1 parent ed4157e commit 71f15b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
10 changes: 4 additions & 6 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

use Config\Services;

// Path to the front controller (this file)
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR);

Expand All @@ -15,13 +13,13 @@
*/

// Ensure the current directory is pointing to the front controller's directory
chdir(__DIR__);
chdir(FCPATH);

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

// Load our paths config file
require $pathsConfig;

$paths = new Config\Paths();
Expand All @@ -40,7 +38,7 @@
* the application run, and does all of the dirty work to get
* the pieces all working together.
*/
$app = Services::codeigniter();
$app = Config\Services::codeigniter();
$app->initialize();
$context = is_cli() ? 'php-cli' : 'web';
$app->setContext($context);
Expand Down
22 changes: 11 additions & 11 deletions spark
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@
* this class mainly acts as a passthru to the framework itself.
*/

use Config\Services;

/**
* @var bool
*
* @deprecated No longer in use. `CodeIgniter` has `$context` property.
*/
define('SPARKED', true);

// Path to the front controller
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);

/*
*---------------------------------------------------------------
* BOOTSTRAP THE APPLICATION
Expand All @@ -39,30 +40,29 @@ define('SPARKED', true);
* and fires up an environment-specific bootstrapping.
*/

// Ensure the current directory is pointing to the front controller's directory
chdir(FCPATH);

// Refuse to run when called from php-cgi
if (strpos(PHP_SAPI, 'cgi') === 0) {
exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
}

// Path to the front controller
define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);

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

// Load our paths config file
require $pathsConfig;

$paths = new Config\Paths();

// Ensure the current directory is pointing to the front controller's directory
chdir(FCPATH);

// Location of the framework bootstrap file.
$bootstrap = rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php';

require $bootstrap;

$app = Services::codeigniter();
$app = Config\Services::codeigniter();
$app->initialize();
$app->setContext('spark');

Expand Down

0 comments on commit 71f15b7

Please sign in to comment.