Skip to content

Commit 473a0f9

Browse files
committed
Refactor database configurations and log options
The commit refactors the MySQL database configurations in the .env file, updating the DB_PASS, DB_HOST, and DB_BASE values. Additionally, the commit modifies the PhpSlides.php file, changing the $log property to be of type bool and introduces a new static method config() for configuring the request log. This change enhances the security and flexibility of the application's database setup and logging functionality. No issues are associated with this commit. #Refactor #DatabaseConfigurations #LogOptions
1 parent d9559b4 commit 473a0f9

File tree

16 files changed

+18
-184
lines changed

16 files changed

+18
-184
lines changed

.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ APP_VERSION='1.0.0'
33
APP_SERVER='localhost'
44

55
## DATABASE INFO (MySQL)
6-
DB_HOST='localhost'
76
DB_USER='root'
8-
DB_PASS=''
9-
DB_BASE='react_blog'
7+
DB_PASS='root'
8+
DB_HOST='localhost'
9+
DB_BASE='php_slides'

App/Controller/RouteController.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ protected static function log()
120120
// all content messages to log
121121
$content = "$method\t\t\t $http_protocol\t\t\t $http_code\t\t\t $uri\t\t\t $date\n\n";
122122

123-
echo Route::$log;
124123
if (Route::$log === true)
125124
{
126125
$log = fopen($log_path, 'a');

App/PhpSlides.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ final class Route extends Controller
4343
*
4444
* ---------------------------------------------------------------------------------------------------------
4545
*/
46-
public static $log = true;
46+
public static bool $log;
4747

4848

4949

@@ -65,15 +65,11 @@ final class Route extends Controller
6565
*
6666
* ---------------------------------------------------------------------------------------------------------
6767
*/
68-
public static function config(bool|null $request_log = null)
68+
public static function config(bool $request_log = true)
6969
{
7070
try
7171
{
72-
if (is_bool($request_log))
73-
{
74-
self::$log = $request_log;
75-
}
76-
72+
self::$log = $request_log;
7773

7874
$dir = dirname(__DIR__);
7975
$req = preg_replace("/(^\/)|(\/$)/", "", $_REQUEST["uri"]);
File renamed without changes.
File renamed without changes.

configs/cors.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
/**
44
* Configure your setting for cross-origin resource sharing
5-
* How
65
*/
76

87
// Allow cross-origin requests from any origin

phpslides.config.json

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"public": {
3-
"/": [ "*" ],
3+
"/": ["*"],
44
"assets": [
5-
"js",
65
"gif",
76
"jpg",
87
"svg",
98
"png",
109
"jpeg",
1110
"webp",
11+
"js",
1212
"ts",
1313
"css",
1414
"scss",
@@ -21,7 +21,14 @@
2121
"txt",
2222
"readme"
2323
],
24-
"images": [ "*" ],
24+
"images": [
25+
"gif",
26+
"jpg",
27+
"svg",
28+
"png",
29+
"jpeg",
30+
"webp"
31+
],
2532
"styles": [
2633
"css",
2734
"scss",
@@ -38,10 +45,6 @@
3845
"css",
3946
"scss",
4047
"sass"
41-
],
42-
"axios": [
43-
"js",
44-
"ts"
4548
]
4649
},
4750
"charset": "UTF-8"

public/src/axios/axios.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

routes/route.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* | The parameter contains only be a boolean, which indicates request logger to prints out logs output on each received request
1313
* ---------------------------------------------------------------------------------------------------------------------------
1414
*/
15-
Route::config();
15+
Route::config(true);
1616

1717

1818
/**
@@ -23,7 +23,7 @@
2323
* --------------------------------------------------------------------
2424
*/
2525

26-
Route::view([ '/', '/index' ], '::index');
26+
Route::view([ '/', '/index' ], '::dashboard');
2727

2828
Route::get('/post', [ PostsController::class]);
2929
Route::get('/post/{id}', [ PostsController::class, 'Post' ]);

src/.gitignore

Whitespace-only changes.

views/.gitignore

Whitespace-only changes.
File renamed without changes.

views/login.view.php

Lines changed: 0 additions & 14 deletions
This file was deleted.

views/profile.view.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

views/signup.view.php

Lines changed: 0 additions & 44 deletions
This file was deleted.

views/upload.view.php

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)