Skip to content

Commit

Permalink
Move spark serve command files
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed Apr 25, 2018
1 parent 3754c43 commit b88a1e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php namespace CodeIgniter\Commands;
<?php namespace CodeIgniter\Commands\Server;

use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;
Expand Down Expand Up @@ -31,7 +31,7 @@ public function run(array $params)
$docroot = FCPATH;

// Mimic Apache's mod_rewrite functionality with user settings
$rewrite = APPPATH . 'Config/Rewrite.php';
$rewrite = __DIR__ . '/rewrite.php';

// Call PHP's built-in webserver, making sure to set our
// base path to the public folder, and to use the rewrite file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@
* functionality so the site will operate as normal.
*/

// Avoid this file run when listing commands
if (php_sapi_name() === 'cli')
{
return;
}

// If we're serving the site locally, then we need
// to let the application know that we're in development mode
$_SERVER['CI_ENVIRONMENT'] = 'development';

$uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));

$fcpath = __DIR__ . '/../../public/';
// Front Controller path - expected to be in the default folder
$fcpath = realpath(__DIR__ . '/../../../public') . DIRECTORY_SEPARATOR;

// Full path
$path = $fcpath . ltrim($uri, '/');

// If $path is an existing file or folder within the public folder
Expand Down

0 comments on commit b88a1e6

Please sign in to comment.