mirror of
https://github.com/flextype/flextype.git
synced 2025-08-05 04:37:43 +02:00
feat(core): Added ability to override default constants
This commit is contained in:
16
bin/flextype
16
bin/flextype
@@ -15,22 +15,16 @@
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
/**
|
||||
* Define the Flextype start time in current unix timestamp (microseconds).
|
||||
*/
|
||||
define('START_TIME', microtime(true));
|
||||
|
||||
/**
|
||||
* Define the PATH to the root directory (without trailing slash).
|
||||
*/
|
||||
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
|
||||
|
||||
/**
|
||||
* Define the project name.
|
||||
*/
|
||||
define('PROJECT_NAME', 'project');
|
||||
|
||||
/**
|
||||
* Define the PATH (without trailing slash).
|
||||
*/
|
||||
define('PATH_PROJECT', ROOT_DIR . '/' . PROJECT_NAME);
|
||||
define('PATH_TMP', ROOT_DIR . '/var/tmp');
|
||||
|
||||
/**
|
||||
* Ensure vendor libraries exist
|
||||
*/
|
||||
|
16
index.php
16
index.php
@@ -21,22 +21,16 @@ use function is_file;
|
||||
use function sprintf;
|
||||
use function str_replace;
|
||||
|
||||
/**
|
||||
* Define the Flextype start time in current unix timestamp (microseconds).
|
||||
*/
|
||||
define('START_TIME', microtime(true));
|
||||
|
||||
/**
|
||||
* Define the PATH to the root directory (without trailing slash).
|
||||
*/
|
||||
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
|
||||
|
||||
/**
|
||||
* Define the project name.
|
||||
*/
|
||||
define('PROJECT_NAME', 'project');
|
||||
|
||||
/**
|
||||
* Define the PATH (without trailing slash).
|
||||
*/
|
||||
define('PATH_PROJECT', ROOT_DIR . '/' . PROJECT_NAME);
|
||||
define('PATH_TMP', ROOT_DIR . '/var/tmp');
|
||||
|
||||
/**
|
||||
* Ensure vendor libraries exist
|
||||
*/
|
||||
|
45
src/flextype/defines.php
Normal file
45
src/flextype/defines.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Flextype - Hybrid Content Management System with the freedom of a headless CMS
|
||||
* and with the full functionality of a traditional CMS!
|
||||
*
|
||||
* Copyright (c) Sergey Romanenko (https://awilum.github.io)
|
||||
*
|
||||
* Licensed under The MIT License.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*/
|
||||
|
||||
namespace Flextype;
|
||||
|
||||
if (! defined('FLEXTYPE_MINIMUM_PHP')) {
|
||||
/**
|
||||
* Define the Flextype Application minimum supported PHP version.
|
||||
*/
|
||||
define('FLEXTYPE_MINIMUM_PHP', '7.4.0');
|
||||
}
|
||||
|
||||
if (! defined('PROJECT_NAME')) {
|
||||
/**
|
||||
* Define the project name.
|
||||
*/
|
||||
define('PROJECT_NAME', 'project');
|
||||
}
|
||||
|
||||
if (! defined('PATH_PROJECT')) {
|
||||
/**
|
||||
* Define the project path (without trailing slash).
|
||||
*/
|
||||
define('PATH_PROJECT', ROOT_DIR . '/' . PROJECT_NAME);
|
||||
}
|
||||
|
||||
if (! defined('PATH_TMP')) {
|
||||
/**
|
||||
* Define the project tmp path (without trailing slash).
|
||||
*/
|
||||
define('PATH_TMP', ROOT_DIR . '/var/tmp');
|
||||
}
|
@@ -84,8 +84,8 @@ use function version_compare;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use const PHP_VERSION;
|
||||
|
||||
// Define the Flextype Application minimum supported PHP version.
|
||||
define('FLEXTYPE_MINIMUM_PHP', '7.4.0');
|
||||
// Get defines.
|
||||
require_once ROOT_DIR . '/src/flextype/defines.php';
|
||||
|
||||
// Check PHP Version
|
||||
version_compare($ver = PHP_VERSION, $req = FLEXTYPE_MINIMUM_PHP, '<') and exit(sprintf('You are running PHP %s, but Flextype needs at least <strong>PHP %s</strong> to run.', $ver, $req));
|
||||
|
Reference in New Issue
Block a user