Rename BASEPATH constant to SYSTEMPATH

This commit is contained in:
Natan Felles 2018-12-07 17:44:44 -02:00
parent b28e1abab1
commit 10d50a824e
No known key found for this signature in database
GPG Key ID: 59CC6FA82E1E87FD
22 changed files with 121 additions and 120 deletions

View File

@ -1,6 +1,6 @@
<?php namespace Config; <?php namespace Config;
require_once BASEPATH . 'Config/AutoloadConfig.php'; require_once SYSTEMPATH . 'Config/AutoloadConfig.php';
/** /**
* ------------------------------------------------------------------- * -------------------------------------------------------------------

View File

@ -22,9 +22,9 @@ $routes = Services::routes(true);
// Load the system's routing file first, so that the app and ENVIRONMENT // Load the system's routing file first, so that the app and ENVIRONMENT
// can override as needed. // can override as needed.
if (file_exists(BASEPATH . 'Config/Routes.php')) if (file_exists(SYSTEMPATH . 'Config/Routes.php'))
{ {
require BASEPATH . 'Config/Routes.php'; require SYSTEMPATH . 'Config/Routes.php';
} }
/** /**

View File

@ -3,7 +3,7 @@
use CodeIgniter\Config\Services as CoreServices; use CodeIgniter\Config\Services as CoreServices;
use CodeIgniter\Config\BaseConfig; use CodeIgniter\Config\BaseConfig;
require_once BASEPATH . 'Config/Services.php'; require_once SYSTEMPATH . 'Config/Services.php';
/** /**
* Services Configuration file. * Services Configuration file.

View File

@ -27,5 +27,5 @@ class Toolbar extends BaseConfig
\CodeIgniter\Debug\Toolbar\Collectors\Events::class, \CodeIgniter\Debug\Toolbar\Collectors\Events::class,
]; ];
public $maxHistory = 20; public $maxHistory = 20;
public $viewsPath = BASEPATH . 'Debug/Toolbar/Views/'; public $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
} }

View File

@ -339,7 +339,7 @@ class FileLocator
{ {
$paths = [ $paths = [
APPPATH, APPPATH,
BASEPATH, SYSTEMPATH,
]; ];
foreach ($paths as $path) foreach ($paths as $path)

View File

@ -182,7 +182,7 @@ class CodeIgniter
if (CI_DEBUG) if (CI_DEBUG)
{ {
require_once BASEPATH . 'ThirdParty/Kint/kint.php'; require_once SYSTEMPATH . 'ThirdParty/Kint/kint.php';
} }
} }

View File

@ -585,7 +585,7 @@ if (! function_exists('helper'))
$appHelper = $path; $appHelper = $path;
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
} }
elseif (strpos($path, BASEPATH) === 0) elseif (strpos($path, SYSTEMPATH) === 0)
{ {
$systemHelper = $path; $systemHelper = $path;
} }
@ -694,7 +694,7 @@ if (! function_exists('csrf_field'))
*/ */
function csrf_field(string $id = null) function csrf_field(string $id = null)
{ {
return '<input type="hidden"' . (!empty($id) ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_token() . '" value="' . csrf_hash() . '" />'; return '<input type="hidden"' . (! empty($id) ? ' id="' . esc($id, 'attr') . '"' : '') . ' name="' . csrf_token() . '" value="' . csrf_hash() . '" />';
} }
} }

View File

@ -88,7 +88,7 @@ class AutoloadConfig
* `]; * `];
*/ */
$this->psr4 = [ $this->psr4 = [
'CodeIgniter' => realpath(BASEPATH), 'CodeIgniter' => realpath(SYSTEMPATH),
]; ];
if (isset($_SERVER['CI_ENVIRONMENT']) && $_SERVER['CI_ENVIRONMENT'] === 'testing') if (isset($_SERVER['CI_ENVIRONMENT']) && $_SERVER['CI_ENVIRONMENT'] === 'testing')
@ -113,78 +113,78 @@ class AutoloadConfig
* ]; * ];
*/ */
$this->classmap = [ $this->classmap = [
'CodeIgniter\CodeIgniter' => BASEPATH . 'CodeIgniter.php', 'CodeIgniter\CodeIgniter' => SYSTEMPATH . 'CodeIgniter.php',
'CodeIgniter\CLI\CLI' => BASEPATH . 'CLI/CLI.php', 'CodeIgniter\CLI\CLI' => SYSTEMPATH . 'CLI/CLI.php',
'CodeIgniter\Cache\CacheFactory' => BASEPATH . 'Cache/CacheFactory.php', 'CodeIgniter\Cache\CacheFactory' => SYSTEMPATH . 'Cache/CacheFactory.php',
'CodeIgniter\Cache\CacheInterface' => BASEPATH . 'Cache/CacheInterface.php', 'CodeIgniter\Cache\CacheInterface' => SYSTEMPATH . 'Cache/CacheInterface.php',
'CodeIgniter\Cache\Handlers\DummyHandler' => BASEPATH . 'Cache/Handlers/DummyHandler.php', 'CodeIgniter\Cache\Handlers\DummyHandler' => SYSTEMPATH . 'Cache/Handlers/DummyHandler.php',
'CodeIgniter\Cache\Handlers\FileHandler' => BASEPATH . 'Cache/Handlers/FileHandler.php', 'CodeIgniter\Cache\Handlers\FileHandler' => SYSTEMPATH . 'Cache/Handlers/FileHandler.php',
'CodeIgniter\Cache\Handlers\MemcachedHandler' => BASEPATH . 'Cache/Handlers/MemcachedHandler.php', 'CodeIgniter\Cache\Handlers\MemcachedHandler' => SYSTEMPATH . 'Cache/Handlers/MemcachedHandler.php',
'CodeIgniter\Cache\Handlers\PredisHandler' => BASEPATH . 'Cache/Handlers/PredisHandler.php', 'CodeIgniter\Cache\Handlers\PredisHandler' => SYSTEMPATH . 'Cache/Handlers/PredisHandler.php',
'CodeIgniter\Cache\Handlers\RedisHandler' => BASEPATH . 'Cache/Handlers/RedisHandler.php', 'CodeIgniter\Cache\Handlers\RedisHandler' => SYSTEMPATH . 'Cache/Handlers/RedisHandler.php',
'CodeIgniter\Cache\Handlers\WincacheHandler' => BASEPATH . 'Cache/Handlers/WincacheHandler.php', 'CodeIgniter\Cache\Handlers\WincacheHandler' => SYSTEMPATH . 'Cache/Handlers/WincacheHandler.php',
'CodeIgniter\Controller' => BASEPATH . 'Controller.php', 'CodeIgniter\Controller' => SYSTEMPATH . 'Controller.php',
'CodeIgniter\Config\AutoloadConfig' => BASEPATH . 'Config/Autoload.php', 'CodeIgniter\Config\AutoloadConfig' => SYSTEMPATH . 'Config/Autoload.php',
'CodeIgniter\Config\BaseConfig' => BASEPATH . 'Config/BaseConfig.php', 'CodeIgniter\Config\BaseConfig' => SYSTEMPATH . 'Config/BaseConfig.php',
'CodeIgniter\Config\Database' => BASEPATH . 'Config/Database.php', 'CodeIgniter\Config\Database' => SYSTEMPATH . 'Config/Database.php',
'CodeIgniter\Config\Database\Connection' => BASEPATH . 'Config/Database/Connection.php', 'CodeIgniter\Config\Database\Connection' => SYSTEMPATH . 'Config/Database/Connection.php',
'CodeIgniter\Config\Database\Connection\MySQLi' => BASEPATH . 'Config/Database/Connection/MySQLi.php', 'CodeIgniter\Config\Database\Connection\MySQLi' => SYSTEMPATH . 'Config/Database/Connection/MySQLi.php',
'CodeIgniter\Config\DotEnv' => BASEPATH . 'Config/DotEnv.php', 'CodeIgniter\Config\DotEnv' => SYSTEMPATH . 'Config/DotEnv.php',
'CodeIgniter\Database\BaseBuilder' => BASEPATH . 'Database/BaseBuilder.php', 'CodeIgniter\Database\BaseBuilder' => SYSTEMPATH . 'Database/BaseBuilder.php',
'CodeIgniter\Database\BaseConnection' => BASEPATH . 'Database/BaseConnection.php', 'CodeIgniter\Database\BaseConnection' => SYSTEMPATH . 'Database/BaseConnection.php',
'CodeIgniter\Database\BaseResult' => BASEPATH . 'Database/BaseResult.php', 'CodeIgniter\Database\BaseResult' => SYSTEMPATH . 'Database/BaseResult.php',
'CodeIgniter\Database\Config' => BASEPATH . 'Database/Config.php', 'CodeIgniter\Database\Config' => SYSTEMPATH . 'Database/Config.php',
'CodeIgniter\Database\ConnectionInterface' => BASEPATH . 'Database/ConnectionInterface.php', 'CodeIgniter\Database\ConnectionInterface' => SYSTEMPATH . 'Database/ConnectionInterface.php',
'CodeIgniter\Database\Database' => BASEPATH . 'Database/Database.php', 'CodeIgniter\Database\Database' => SYSTEMPATH . 'Database/Database.php',
'CodeIgniter\Database\Query' => BASEPATH . 'Database/Query.php', 'CodeIgniter\Database\Query' => SYSTEMPATH . 'Database/Query.php',
'CodeIgniter\Database\QueryInterface' => BASEPATH . 'Database/QueryInterface.php', 'CodeIgniter\Database\QueryInterface' => SYSTEMPATH . 'Database/QueryInterface.php',
'CodeIgniter\Database\ResultInterface' => BASEPATH . 'Database/ResultInterface.php', 'CodeIgniter\Database\ResultInterface' => SYSTEMPATH . 'Database/ResultInterface.php',
'CodeIgniter\Database\Migration' => BASEPATH . 'Database/Migration.php', 'CodeIgniter\Database\Migration' => SYSTEMPATH . 'Database/Migration.php',
'CodeIgniter\Database\MigrationRunner' => BASEPATH . 'Database/MigrationRunner.php', 'CodeIgniter\Database\MigrationRunner' => SYSTEMPATH . 'Database/MigrationRunner.php',
'CodeIgniter\Debug\Exceptions' => BASEPATH . 'Debug/Exceptions.php', 'CodeIgniter\Debug\Exceptions' => SYSTEMPATH . 'Debug/Exceptions.php',
'CodeIgniter\Debug\Timer' => BASEPATH . 'Debug/Timer.php', 'CodeIgniter\Debug\Timer' => SYSTEMPATH . 'Debug/Timer.php',
'CodeIgniter\Debug\Iterator' => BASEPATH . 'Debug/Iterator.php', 'CodeIgniter\Debug\Iterator' => SYSTEMPATH . 'Debug/Iterator.php',
'CodeIgniter\Events\Events' => BASEPATH . 'Events/Events.php', 'CodeIgniter\Events\Events' => SYSTEMPATH . 'Events/Events.php',
'CodeIgniter\HTTP\CLIRequest' => BASEPATH . 'HTTP/CLIRequest.php', 'CodeIgniter\HTTP\CLIRequest' => SYSTEMPATH . 'HTTP/CLIRequest.php',
'CodeIgniter\HTTP\ContentSecurityPolicy' => BASEPATH . 'HTTP/ContentSecurityPolicy.php', 'CodeIgniter\HTTP\ContentSecurityPolicy' => SYSTEMPATH . 'HTTP/ContentSecurityPolicy.php',
'CodeIgniter\HTTP\CURLRequest' => BASEPATH . 'HTTP/CURLRequest.php', 'CodeIgniter\HTTP\CURLRequest' => SYSTEMPATH . 'HTTP/CURLRequest.php',
'CodeIgniter\HTTP\IncomingRequest' => BASEPATH . 'HTTP/IncomingRequest.php', 'CodeIgniter\HTTP\IncomingRequest' => SYSTEMPATH . 'HTTP/IncomingRequest.php',
'CodeIgniter\HTTP\Message' => BASEPATH . 'HTTP/Message.php', 'CodeIgniter\HTTP\Message' => SYSTEMPATH . 'HTTP/Message.php',
'CodeIgniter\HTTP\Negotiate' => BASEPATH . 'HTTP/Negotiate.php', 'CodeIgniter\HTTP\Negotiate' => SYSTEMPATH . 'HTTP/Negotiate.php',
'CodeIgniter\HTTP\Request' => BASEPATH . 'HTTP/Request.php', 'CodeIgniter\HTTP\Request' => SYSTEMPATH . 'HTTP/Request.php',
'CodeIgniter\HTTP\RequestInterface' => BASEPATH . 'HTTP/RequestInterface.php', 'CodeIgniter\HTTP\RequestInterface' => SYSTEMPATH . 'HTTP/RequestInterface.php',
'CodeIgniter\HTTP\Response' => BASEPATH . 'HTTP/Response.php', 'CodeIgniter\HTTP\Response' => SYSTEMPATH . 'HTTP/Response.php',
'CodeIgniter\HTTP\ResponseInterface' => BASEPATH . 'HTTP/ResponseInterface.php', 'CodeIgniter\HTTP\ResponseInterface' => SYSTEMPATH . 'HTTP/ResponseInterface.php',
'CodeIgniter\HTTP\URI' => BASEPATH . 'HTTP/URI.php', 'CodeIgniter\HTTP\URI' => SYSTEMPATH . 'HTTP/URI.php',
'CodeIgniter\Log\Logger' => BASEPATH . 'Log/Logger.php', 'CodeIgniter\Log\Logger' => SYSTEMPATH . 'Log/Logger.php',
'Psr\Log\AbstractLogger' => BASEPATH . 'ThirdParty/PSR/Log/AbstractLogger.php', 'Psr\Log\AbstractLogger' => SYSTEMPATH . 'ThirdParty/PSR/Log/AbstractLogger.php',
'Psr\Log\InvalidArgumentException' => BASEPATH . 'ThirdParty/PSR/Log/InvalidArgumentException.php', 'Psr\Log\InvalidArgumentException' => SYSTEMPATH . 'ThirdParty/PSR/Log/InvalidArgumentException.php',
'Psr\Log\LoggerAwareInterface' => BASEPATH . 'ThirdParty/PSR/Log/LoggerAwareInterface.php', 'Psr\Log\LoggerAwareInterface' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerAwareInterface.php',
'Psr\Log\LoggerAwareTrait' => BASEPATH . 'ThirdParty/PSR/Log/LoggerAwareTrait.php', 'Psr\Log\LoggerAwareTrait' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerAwareTrait.php',
'Psr\Log\LoggerInterface' => BASEPATH . 'ThirdParty/PSR/Log/LoggerInterface.php', 'Psr\Log\LoggerInterface' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerInterface.php',
'Psr\Log\LoggerTrait' => BASEPATH . 'ThirdParty/PSR/Log/LoggerTrait.php', 'Psr\Log\LoggerTrait' => SYSTEMPATH . 'ThirdParty/PSR/Log/LoggerTrait.php',
'Psr\Log\LogLevel' => BASEPATH . 'ThirdParty/PSR/Log/LogLevel.php', 'Psr\Log\LogLevel' => SYSTEMPATH . 'ThirdParty/PSR/Log/LogLevel.php',
'Psr\Log\NullLogger' => BASEPATH . 'ThirdParty/PSR/Log/NullLogger.php', 'Psr\Log\NullLogger' => SYSTEMPATH . 'ThirdParty/PSR/Log/NullLogger.php',
'CodeIgniter\Log\Handlers\BaseHandler' => BASEPATH . 'Log/Handlers/BaseHandler.php', 'CodeIgniter\Log\Handlers\BaseHandler' => SYSTEMPATH . 'Log/Handlers/BaseHandler.php',
'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => BASEPATH . 'Log/Handlers/ChromeLoggerHandler.php', 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => SYSTEMPATH . 'Log/Handlers/ChromeLoggerHandler.php',
'CodeIgniter\Log\Handlers\FileHandler' => BASEPATH . 'Log/Handlers/FileHandler.php', 'CodeIgniter\Log\Handlers\FileHandler' => SYSTEMPATH . 'Log/Handlers/FileHandler.php',
'CodeIgniter\Log\Handlers\HandlerInterface' => BASEPATH . 'Log/Handlers/HandlerInterface.php', 'CodeIgniter\Log\Handlers\HandlerInterface' => SYSTEMPATH . 'Log/Handlers/HandlerInterface.php',
'CodeIgniter\Router\RouteCollection' => BASEPATH . 'Router/RouteCollection.php', 'CodeIgniter\Router\RouteCollection' => SYSTEMPATH . 'Router/RouteCollection.php',
'CodeIgniter\Router\RouteCollectionInterface' => BASEPATH . 'Router/RouteCollectionInterface.php', 'CodeIgniter\Router\RouteCollectionInterface' => SYSTEMPATH . 'Router/RouteCollectionInterface.php',
'CodeIgniter\Router\Router' => BASEPATH . 'Router/Router.php', 'CodeIgniter\Router\Router' => SYSTEMPATH . 'Router/Router.php',
'CodeIgniter\Router\RouterInterface' => BASEPATH . 'Router/RouterInterface.php', 'CodeIgniter\Router\RouterInterface' => SYSTEMPATH . 'Router/RouterInterface.php',
'CodeIgniter\Security\Security' => BASEPATH . 'Security/Security.php', 'CodeIgniter\Security\Security' => SYSTEMPATH . 'Security/Security.php',
'CodeIgniter\Session\Session' => BASEPATH . 'Session/Session.php', 'CodeIgniter\Session\Session' => SYSTEMPATH . 'Session/Session.php',
'CodeIgniter\Session\SessionInterface' => BASEPATH . 'Session/SessionInterface.php', 'CodeIgniter\Session\SessionInterface' => SYSTEMPATH . 'Session/SessionInterface.php',
'CodeIgniter\Session\Handlers\BaseHandler' => BASEPATH . 'Session/Handlers/BaseHandler.php', 'CodeIgniter\Session\Handlers\BaseHandler' => SYSTEMPATH . 'Session/Handlers/BaseHandler.php',
'CodeIgniter\Session\Handlers\FileHandler' => BASEPATH . 'Session/Handlers/FileHandler.php', 'CodeIgniter\Session\Handlers\FileHandler' => SYSTEMPATH . 'Session/Handlers/FileHandler.php',
'CodeIgniter\Session\Handlers\MemcachedHandler' => BASEPATH . 'Session/Handlers/MemcachedHandler.php', 'CodeIgniter\Session\Handlers\MemcachedHandler' => SYSTEMPATH . 'Session/Handlers/MemcachedHandler.php',
'CodeIgniter\Session\Handlers\RedisHandler' => BASEPATH . 'Session/Handlers/RedisHandler.php', 'CodeIgniter\Session\Handlers\RedisHandler' => SYSTEMPATH . 'Session/Handlers/RedisHandler.php',
'CodeIgniter\View\RendererInterface' => BASEPATH . 'View/RendererInterface.php', 'CodeIgniter\View\RendererInterface' => SYSTEMPATH . 'View/RendererInterface.php',
'CodeIgniter\View\View' => BASEPATH . 'View/View.php', 'CodeIgniter\View\View' => SYSTEMPATH . 'View/View.php',
'CodeIgniter\View\Parser' => BASEPATH . 'View/Parser.php', 'CodeIgniter\View\Parser' => SYSTEMPATH . 'View/Parser.php',
'CodeIgniter\View\Cell' => BASEPATH . 'View/Cell.php', 'CodeIgniter\View\Cell' => SYSTEMPATH . 'View/Cell.php',
'Zend\Escaper\Escaper' => BASEPATH . 'ThirdParty/ZendEscaper/Escaper.php', 'Zend\Escaper\Escaper' => SYSTEMPATH . 'ThirdParty/ZendEscaper/Escaper.php',
]; ];
if (isset($_SERVER['CI_ENVIRONMENT']) && $_SERVER['CI_ENVIRONMENT'] === 'testing') if (isset($_SERVER['CI_ENVIRONMENT']) && $_SERVER['CI_ENVIRONMENT'] === 'testing')

View File

@ -176,7 +176,8 @@ class Exceptions
*/ */
public function errorHandler(int $severity, string $message, string $file = null, int $line = null, $context = null) public function errorHandler(int $severity, string $message, string $file = null, int $line = null, $context = null)
{ {
if (! (\error_reporting() & $severity)) { if (! (\error_reporting() & $severity))
{
return; return;
} }
@ -359,9 +360,9 @@ class Exceptions
{ {
$file = 'APPPATH/' . substr($file, strlen(APPPATH)); $file = 'APPPATH/' . substr($file, strlen(APPPATH));
} }
elseif (strpos($file, BASEPATH) === 0) elseif (strpos($file, SYSTEMPATH) === 0)
{ {
$file = 'BASEPATH/' . substr($file, strlen(BASEPATH)); $file = 'SYSTEMPATH/' . substr($file, strlen(SYSTEMPATH));
} }
elseif (strpos($file, FCPATH) === 0) elseif (strpos($file, FCPATH) === 0)
{ {

View File

@ -255,9 +255,9 @@ class BaseCollector
{ {
$file = 'APPPATH/' . substr($file, strlen(APPPATH)); $file = 'APPPATH/' . substr($file, strlen(APPPATH));
} }
elseif (strpos($file, BASEPATH) === 0) elseif (strpos($file, SYSTEMPATH) === 0)
{ {
$file = 'BASEPATH/' . substr($file, strlen(BASEPATH)); $file = 'SYSTEMPATH/' . substr($file, strlen(SYSTEMPATH));
} }
elseif (strpos($file, FCPATH) === 0) elseif (strpos($file, FCPATH) === 0)
{ {

View File

@ -95,7 +95,7 @@ class Files extends BaseCollector
{ {
$path = $this->cleanPath($file); $path = $this->cleanPath($file);
if (strpos($path, 'BASEPATH') !== false) if (strpos($path, 'SYSTEMPATH') !== false)
{ {
$coreFiles[] = [ $coreFiles[] = [
'name' => basename($file), 'name' => basename($file),

View File

@ -108,7 +108,7 @@ class FileHandler extends BaseHandler implements HandlerInterface
// Only add protection to php files // Only add protection to php files
if ($this->fileExtension === 'php') if ($this->fileExtension === 'php')
{ {
$msg .= "<?php defined('BASEPATH') || exit('No direct script access allowed'); ?>\n\n"; $msg .= "<?php defined('SYSTEMPATH') || exit('No direct script access allowed'); ?>\n\n";
} }
} }

View File

@ -508,7 +508,7 @@ class Logger implements LoggerInterface
//-------------------------------------------------------------------- //--------------------------------------------------------------------
/** /**
* Cleans the paths of filenames by replacing APPPATH, BASEPATH, FCPATH * Cleans the paths of filenames by replacing APPPATH, SYSTEMPATH, FCPATH
* with the actual var. i.e. * with the actual var. i.e.
* *
* /var/www/site/application/Controllers/Home.php * /var/www/site/application/Controllers/Home.php
@ -522,7 +522,7 @@ class Logger implements LoggerInterface
protected function cleanFileNames($file) protected function cleanFileNames($file)
{ {
$file = str_replace(APPPATH, 'APPPATH/', $file); $file = str_replace(APPPATH, 'APPPATH/', $file);
$file = str_replace(BASEPATH, 'BASEPATH/', $file); $file = str_replace(SYSTEMPATH, 'SYSTEMPATH/', $file);
$file = str_replace(FCPATH, 'FCPATH/', $file); $file = str_replace(FCPATH, 'FCPATH/', $file);
return $file; return $file;

View File

@ -220,7 +220,7 @@ class View implements RendererInterface
if (in_array(\CodeIgniter\Debug\Toolbar\Collectors\Views::class, $toolbarCollectors)) if (in_array(\CodeIgniter\Debug\Toolbar\Collectors\Views::class, $toolbarCollectors))
{ {
// Clean up our path names to make them a little cleaner // Clean up our path names to make them a little cleaner
foreach (['APPPATH', 'BASEPATH', 'ROOTPATH'] as $path) foreach (['APPPATH', 'SYSTEMPATH', 'ROOTPATH'] as $path)
{ {
if (strpos($this->renderVars['file'], constant($path)) === 0) if (strpos($this->renderVars['file'], constant($path)) === 0)
{ {

View File

@ -65,9 +65,9 @@ if (! defined('ROOTPATH'))
/** /**
* The path to the system directory. * The path to the system directory.
*/ */
if (! defined('BASEPATH')) if (! defined('SYSTEMPATH'))
{ {
define('BASEPATH', realpath($paths->systemDirectory) . DIRECTORY_SEPARATOR); define('SYSTEMPATH', realpath($paths->systemDirectory) . DIRECTORY_SEPARATOR);
} }
/** /**
@ -93,7 +93,7 @@ if (! defined('TESTPATH'))
*/ */
require_once APPPATH . 'Config/Constants.php'; require_once APPPATH . 'Config/Constants.php';
require_once BASEPATH . 'Common.php'; require_once SYSTEMPATH . 'Common.php';
/* /*
* --------------------------------------------------------------- * ---------------------------------------------------------------
@ -105,9 +105,9 @@ require_once BASEPATH . 'Common.php';
* that the config files can use the path constants. * that the config files can use the path constants.
*/ */
require_once BASEPATH . 'Autoloader/Autoloader.php'; require_once SYSTEMPATH . 'Autoloader/Autoloader.php';
require_once APPPATH . 'Config/Autoload.php'; require_once APPPATH . 'Config/Autoload.php';
require_once BASEPATH . 'Config/BaseService.php'; require_once SYSTEMPATH . 'Config/BaseService.php';
require_once APPPATH . 'Config/Services.php'; require_once APPPATH . 'Config/Services.php';
// Use Config\Services as CodeIgniter\Services // Use Config\Services as CodeIgniter\Services
@ -128,7 +128,7 @@ if (is_file(COMPOSER_PATH))
// Load environment settings from .env files // Load environment settings from .env files
// into $_SERVER and $_ENV // into $_SERVER and $_ENV
require_once BASEPATH . 'Config/DotEnv.php'; require_once SYSTEMPATH . 'Config/DotEnv.php';
$env = new \CodeIgniter\Config\DotEnv(ROOTPATH); $env = new \CodeIgniter\Config\DotEnv(ROOTPATH);
$env->load(); $env->load();

View File

@ -21,7 +21,7 @@ class FileLocatorTest extends \CIUnitTestCase
$config->psr4 = [ $config->psr4 = [
'App\Libraries' => '/application/somewhere', 'App\Libraries' => '/application/somewhere',
'App' => '/application', 'App' => '/application',
'Sys' => BASEPATH, 'Sys' => SYSTEMPATH,
'Blog' => '/modules/blog', 'Blog' => '/modules/blog',
'Tests/Support' => TESTPATH . '_support/', 'Tests/Support' => TESTPATH . '_support/',
]; ];
@ -154,7 +154,7 @@ class FileLocatorTest extends \CIUnitTestCase
$expected = rtrim(APPPATH, '/') . '/index.html'; $expected = rtrim(APPPATH, '/') . '/index.html';
$this->assertContains($expected, $foundFiles); $this->assertContains($expected, $foundFiles);
$expected = rtrim(BASEPATH, '/') . '/index.html'; $expected = rtrim(SYSTEMPATH, '/') . '/index.html';
$this->assertContains($expected, $foundFiles); $this->assertContains($expected, $foundFiles);
} }
@ -197,8 +197,8 @@ class FileLocatorTest extends \CIUnitTestCase
$expectedLin = APPPATH . 'Filters/DebugToolbar.php'; $expectedLin = APPPATH . 'Filters/DebugToolbar.php';
$this->assertTrue(in_array($expectedWin, $files) || in_array($expectedLin, $files)); $this->assertTrue(in_array($expectedWin, $files) || in_array($expectedLin, $files));
$expectedWin = BASEPATH . 'Filters\Filters.php'; $expectedWin = SYSTEMPATH . 'Filters\Filters.php';
$expectedLin = BASEPATH . 'Filters/Filters.php'; $expectedLin = SYSTEMPATH . 'Filters/Filters.php';
$this->assertTrue(in_array($expectedWin, $files) || in_array($expectedLin, $files)); $this->assertTrue(in_array($expectedWin, $files) || in_array($expectedLin, $files));
} }

View File

@ -5,30 +5,30 @@ class FileTest extends \CIUnitTestCase
public function testNewGoodChecked() public function testNewGoodChecked()
{ {
$path = BASEPATH . 'Common.php'; $path = SYSTEMPATH . 'Common.php';
$file = new File($path, true); $file = new File($path, true);
$this->assertEquals($path, $file->getRealPath()); $this->assertEquals($path, $file->getRealPath());
} }
public function testNewGoodUnchecked() public function testNewGoodUnchecked()
{ {
$path = BASEPATH . 'Common.php'; $path = SYSTEMPATH . 'Common.php';
$file = new File($path, false); $file = new File($path, false);
$this->assertEquals($path, $file->getRealPath()); $this->assertEquals($path, $file->getRealPath());
} }
public function testNewBadUnchecked() public function testNewBadUnchecked()
{ {
$path = BASEPATH . 'bogus'; $path = SYSTEMPATH . 'bogus';
$file = new File($path, false); $file = new File($path, false);
$this->assertFalse($file->getRealPath()); $this->assertFalse($file->getRealPath());
} }
public function testGuessExtension() public function testGuessExtension()
{ {
$file = new File(BASEPATH . 'Common.php'); $file = new File(SYSTEMPATH . 'Common.php');
$this->assertEquals('php', $file->guessExtension()); $this->assertEquals('php', $file->guessExtension());
$file = new File(BASEPATH . 'index.html'); $file = new File(SYSTEMPATH . 'index.html');
$this->assertEquals('html', $file->guessExtension()); $this->assertEquals('html', $file->guessExtension());
$file = new File(ROOTPATH . 'phpunit.xml.dist'); $file = new File(ROOTPATH . 'phpunit.xml.dist');
$this->assertEquals('xml', $file->guessExtension()); $this->assertEquals('xml', $file->guessExtension());
@ -36,28 +36,28 @@ class FileTest extends \CIUnitTestCase
public function testRandomName() public function testRandomName()
{ {
$file = new File(BASEPATH . 'Common.php'); $file = new File(SYSTEMPATH . 'Common.php');
$result1 = $file->getRandomName(); $result1 = $file->getRandomName();
$this->assertNotEquals($result1, $file->getRandomName()); $this->assertNotEquals($result1, $file->getRandomName());
} }
public function testCanAccessSplFileInfoMethods() public function testCanAccessSplFileInfoMethods()
{ {
$file = new File(BASEPATH . 'Common.php'); $file = new File(SYSTEMPATH . 'Common.php');
$this->assertEquals('file', $file->getType()); $this->assertEquals('file', $file->getType());
} }
public function testGetSizeReturnsKB() public function testGetSizeReturnsKB()
{ {
$file = new File(BASEPATH . 'Common.php'); $file = new File(SYSTEMPATH . 'Common.php');
$size = number_format(filesize(BASEPATH . 'Common.php') / 1024, 3); $size = number_format(filesize(SYSTEMPATH . 'Common.php') / 1024, 3);
$this->assertEquals($size, $file->getSize('kb')); $this->assertEquals($size, $file->getSize('kb'));
} }
public function testGetSizeReturnsMB() public function testGetSizeReturnsMB()
{ {
$file = new File(BASEPATH . 'Common.php'); $file = new File(SYSTEMPATH . 'Common.php');
$size = number_format(filesize(BASEPATH . 'Common.php') / 1024 / 1024, 3); $size = number_format(filesize(SYSTEMPATH . 'Common.php') / 1024 / 1024, 3);
$this->assertEquals($size, $file->getSize('mb')); $this->assertEquals($size, $file->getSize('mb'));
} }
@ -66,7 +66,7 @@ class FileTest extends \CIUnitTestCase
*/ */
public function testThrowsExceptionIfNotAFile() public function testThrowsExceptionIfNotAFile()
{ {
$file = new File(BASEPATH . 'Commoner.php', true); $file = new File(SYSTEMPATH . 'Commoner.php', true);
} }
} }

View File

@ -152,8 +152,8 @@ class DownloadResponseTest extends \CIUnitTestCase
$response = new DownloadResponse('unit-test.txt', true); $response = new DownloadResponse('unit-test.txt', true);
$size = filesize(BASEPATH . 'Common.php'); $size = filesize(SYSTEMPATH . 'Common.php');
$response->setFilePath(BASEPATH . 'Common.php'); $response->setFilePath(SYSTEMPATH . 'Common.php');
$this->assertSame($size, $response->getContentLength()); $this->assertSame($size, $response->getContentLength());
} }

View File

@ -50,7 +50,7 @@ class FileHandlerTest extends \CIUnitTestCase
fclose($fp); fclose($fp);
// did the log file get created? // did the log file get created?
$expectedResult = "<?php defined('BASEPATH') || exit('No direct script access allowed'); ?>\n"; $expectedResult = "<?php defined('SYSTEMPATH') || exit('No direct script access allowed'); ?>\n";
$this->assertEquals($expectedResult, $line); $this->assertEquals($expectedResult, $line);
} }

View File

@ -130,7 +130,7 @@ Our demo command might have a ``run`` method something like::
CLI::write('PHP Version: '. CLI::color(phpversion(), 'yellow')); CLI::write('PHP Version: '. CLI::color(phpversion(), 'yellow'));
CLI::write('CI Version: '. CLI::color(CodeIgniter::CI_VERSION, 'yellow')); CLI::write('CI Version: '. CLI::color(CodeIgniter::CI_VERSION, 'yellow'));
CLI::write('APPPATH: '. CLI::color(APPPATH, 'yellow')); CLI::write('APPPATH: '. CLI::color(APPPATH, 'yellow'));
CLI::write('BASEPATH: '. CLI::color(BASEPATH, 'yellow')); CLI::write('SYSTEMPATH: '. CLI::color(SYSTEMPATH, 'yellow'));
CLI::write('ROOTPATH: '. CLI::color(ROOTPATH, 'yellow')); CLI::write('ROOTPATH: '. CLI::color(ROOTPATH, 'yellow'));
CLI::write('Included files: '. CLI::color(count(get_included_files()), 'yellow')); CLI::write('Included files: '. CLI::color(count(get_included_files()), 'yellow'));
} }

View File

@ -42,7 +42,7 @@ those classes can be found in::
$psr4 = [ $psr4 = [
'App' => APPPATH, 'App' => APPPATH,
'CodeIgniter' => BASEPATH, 'CodeIgniter' => SYSTEMPATH,
]; ];
The key of each row is the namespace itself. This does not need a trailing slash. If you use double-quotes The key of each row is the namespace itself. This does not need a trailing slash. If you use double-quotes

View File

@ -328,7 +328,7 @@ Core Constants
The path to the main application directory. Just above ``APPPATH``. The path to the main application directory. Just above ``APPPATH``.
.. php:const:: BASEPATH .. php:const:: SYSTEMPATH
The path to the **system** directory. The path to the **system** directory.