-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.php
179 lines (164 loc) · 4.66 KB
/
cli.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?php
/**
* This file is part of the O2System PHP Framework package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Steeve Andrian Salim
* @copyright Copyright (c) Steeve Andrian Salim
*/
// ------------------------------------------------------------------------
// Valid PHP Version?
$minPHPVersion = '7.2';
if (phpversion() < $minPHPVersion)
{
die("Your PHP version must be {$minPHPVersion} or higher to run O2System. Current version: " . phpversion());
}
unset($minPHPVersion);
// ------------------------------------------------------------------------
define( 'STARTUP_TIME', microtime( true ) );
define( 'STARTUP_MEMORY', memory_get_usage( true ) );
/*
*---------------------------------------------------------------
* APPLICATION ENVIRONMENT
*---------------------------------------------------------------
*
* You can load different configurations depending on your
* current environment. Setting the environment also influences
* things like logging and error reporting.
*
* This can be set to anything, but default usage is:
*
* development
* testing
* production
*
* NOTE: If you change these, also change the error_reporting() code below
*
*/
if ( ! defined( 'ENVIRONMENT' ) ) {
/**
* Environment Stage
*
* @value DEVELOPMENT|TESTING|PRODUCTION
*/
define( 'ENVIRONMENT', 'DEVELOPMENT' );
/**
* Environment Debug Stage
*
* @value DEVELOPER|TESTER|PUBLIC
*/
$_ENV[ 'DEBUG_STAGE' ] = 'DEVELOPER';
}
/*
*---------------------------------------------------------------
* APP FOLDER NAME
*---------------------------------------------------------------
*
* Application folder name.
*
* NO TRAILING SLASH!
*/
if ( ! defined( 'DIR_APP' ) ) {
define( 'DIR_APP', 'app' );
}
/*
*---------------------------------------------------------------
* CACHE FOLDER NAME
*---------------------------------------------------------------
*
* Caching folder name.
*
* NO TRAILING SLASH!
*/
if ( ! defined( 'DIR_CACHE' ) ) {
define( 'DIR_CACHE', 'cache' );
}
/*
*---------------------------------------------------------------
* STORAGE FOLDER NAME
*---------------------------------------------------------------
*
* Storage folder name.
*
* NO TRAILING SLASH!
*/
if ( ! defined( 'DIR_STORAGE' ) ) {
define( 'DIR_STORAGE', 'storage' );
}
/*
*---------------------------------------------------------------
* RESOURCES FOLDER NAME
*---------------------------------------------------------------
*
* Resources folder name.
*
* NO TRAILING SLASH!
*/
if ( ! defined( 'DIR_RESOURCES' ) ) {
define( 'DIR_RESOURCES', 'resources' );
}
/*
*---------------------------------------------------------------
* DATABASE FOLDER NAME
*---------------------------------------------------------------
*
* Database folder name.
*
* NO TRAILING SLASH!
*/
if ( ! defined( 'DIR_DATABASE' ) ) {
define( 'DIR_DATABASE', 'database' );
}
/*
*---------------------------------------------------------------
* PUBLIC FOLDER NAME
*---------------------------------------------------------------
*
* Accessible folder by public.
*
* NO TRAILING SLASH!
*/
if ( ! defined( 'DIR_PUBLIC' ) ) {
// cpanel based hosting
if(is_dir('../public_html')) {
define( 'DIR_PUBLIC', 'public' );
} else {
define( 'DIR_PUBLIC', 'public' );
}
}
/*
*---------------------------------------------------------------
* DEFINE ROOT PATH
*---------------------------------------------------------------
*/
define( 'PATH_ROOT', dirname( __FILE__ ) . DIRECTORY_SEPARATOR );
/*
*---------------------------------------------------------------
* POINTING FRONT CONTROLLER DIRECTORY
*---------------------------------------------------------------
*
* Ensure the current directory is pointing to the front controller's directory
*/
chdir( __DIR__ . DIRECTORY_SEPARATOR );
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader
| for our application. We just need to utilize it! We'll require it
| into the script here so that we do not have to worry about the
| loading of any our classes "manually". Feels great to relax.
|
*/
require __DIR__ . '/vendor/autoload.php';
/*
* ------------------------------------------------------
* STARTUP O2SYSTEM
* ------------------------------------------------------
*/
if ( class_exists( 'O2System\Framework', false ) ) {
O2System\Framework::getInstance();
}