Skip to content

Commit 1a24ff5

Browse files
committed
Merge branch 'develop' of https://github.com/JakeAi/CodeIgniter4 into develop
2 parents 2c1e04b + 027a433 commit 1a24ff5

File tree

178 files changed

+8955
-3780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+8955
-3780
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ More information about the plans for version 4 can be found in [the announcement
1818

1919
### Documentation
2020

21-
The current documentation can be found [here](https://bcit-ci.github.io/CodeIgniter4/). As with the rest of the framwork, it is currently a work in progress, and will see changes over time to structure, explanations, etc.
21+
The current documentation can be found [here](https://bcit-ci.github.io/CodeIgniter4/). As with the rest of the framework, it is currently a work in progress, and will see changes over time to structure, explanations, etc.
2222

2323
## Important Change with index.php
2424

application/Config/App.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -282,17 +282,6 @@ class App extends BaseConfig
282282
'CodeIgniter\Debug\Toolbar\Collectors\Events',
283283
];
284284

285-
/*
286-
|--------------------------------------------------------------------------
287-
| Error Views Path
288-
|--------------------------------------------------------------------------
289-
| This is the path to the directory that contains the 'cli' and 'html'
290-
| directories that hold the views used to generate errors.
291-
|
292-
| Default: APPPATH.'Views/errors'
293-
*/
294-
public $errorViewPath = APPPATH.'Views/errors';
295-
296285
/*
297286
|--------------------------------------------------------------------------
298287
| Application Salt

application/Config/Encryption.php

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

application/Config/Exceptions.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php namespace Config;
2+
3+
/**
4+
* Setup how the exception handler works.
5+
*
6+
* @package Config
7+
*/
8+
class Exceptions
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| LOG EXCEPTIONS?
13+
|--------------------------------------------------------------------------
14+
| If true, then exceptions will be logged
15+
| through Services::Log.
16+
|
17+
| Default: true
18+
*/
19+
public $log = true;
20+
21+
/*
22+
|--------------------------------------------------------------------------
23+
| DO NOT LOG STATUS CODES
24+
|--------------------------------------------------------------------------
25+
| Any status codes here will NOT be logged if logging is turned on.
26+
| By default, only 404 (Page Not Found) exceptions are ignored.
27+
*/
28+
public $ignoreCodes = [ 404 ];
29+
30+
/*
31+
|--------------------------------------------------------------------------
32+
| Error Views Path
33+
|--------------------------------------------------------------------------
34+
| This is the path to the directory that contains the 'cli' and 'html'
35+
| directories that hold the views used to generate errors.
36+
|
37+
| Default: APPPATH.'Views/errors'
38+
*/
39+
public $errorViewPath = APPPATH.'Views/errors';
40+
}

application/Config/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Logger extends BaseConfig
3232
| your log files will fill up very fast.
3333
|
3434
*/
35-
public $threshold = 0;
35+
public $threshold = 3;
3636

3737
/*
3838
|--------------------------------------------------------------------------

application/Controllers/Checks.php

Lines changed: 152 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
use CodeIgniter\Model;
88
use Config\Database;
99

10+
/**
11+
* NOTE: This is not a valid file for actual tests.
12+
* This file came about as a small testbed I was using that
13+
* accidentally got committed. It will be removed prior to release
14+
* If you commit any changes to this file, it should be accompanied
15+
* by actual tests also.
16+
*
17+
* @package App\Controllers
18+
*/
1019
class Checks extends Controller
1120
{
1221
use ResponseTrait;
@@ -15,6 +24,140 @@ public function index()
1524
{
1625
session()->start();
1726
}
27+
28+
public function forge()
29+
{
30+
echo '<h1>MySQL</h1>';
31+
32+
log_message('debug', 'MYSQL TEST');
33+
34+
$forge_mysql = \Config\Database::forge();
35+
36+
$forge_mysql->getConnection()->query('SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;');
37+
38+
$forge_mysql->dropTable('users', true);
39+
40+
$forge_mysql->getConnection()->query('SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;');
41+
42+
$forge_mysql->addField([
43+
'id' => [
44+
'type' => 'INTEGER',
45+
'constraint' => 11
46+
],
47+
'name' => [
48+
'type' => 'VARCHAR',
49+
'constraint' => 50,
50+
]
51+
]);
52+
$forge_mysql->addKey('id', true);
53+
$attributes = array('ENGINE' => 'InnoDB');
54+
$forge_mysql->createTable('users', true, $attributes);
55+
56+
$data_insert = array(
57+
'id' => 1,
58+
'name' => 'User 1',
59+
);
60+
$forge_mysql->getConnection()->table('users')->insert($data_insert);
61+
62+
$drop = $forge_mysql->dropTable('invoices', true);
63+
64+
$forge_mysql->addField([
65+
'id' => [
66+
'type' => 'INTEGER',
67+
'constraint' => 11,
68+
],
69+
'users_id' => [
70+
'type' => 'INTEGER',
71+
'constraint' => 11
72+
],
73+
'other_id' => [
74+
'type' => 'INTEGER',
75+
'constraint' => 11
76+
]
77+
]);
78+
$forge_mysql->addKey('id', true);
79+
80+
$forge_mysql->addForeignKey('users_id','users','id','CASCADE','CASCADE');
81+
$forge_mysql->addForeignKey('other_id','users','id','CASCADE','CASCADE');
82+
83+
$attributes = array('ENGINE' => 'InnoDB');
84+
$res = $forge_mysql->createTable('invoices', true,$attributes);
85+
86+
if(!$res){
87+
var_dump($forge_mysql->getConnection()->mysqli);
88+
}else{
89+
echo '<br><br>OK';
90+
91+
var_dump($forge_mysql->getConnection()->getForeignKeyData('invoices'));
92+
}
93+
94+
$res = $forge_mysql->dropForeignKey('invoices','invoices_other_id_foreign');
95+
96+
97+
echo '<h1>PostgreSQL</h1>';
98+
99+
$forge_pgsql = \Config\Database::forge('pgsql');
100+
101+
$forge_pgsql->dropTable('users',true, true);
102+
103+
$forge_pgsql->addField([
104+
'id' => [
105+
'type' => 'INTEGER',
106+
'constraint' => 11,
107+
'auto_increment' => true,
108+
],
109+
'name' => [
110+
'type' => 'VARCHAR',
111+
'constraint' => 50,
112+
]
113+
]);
114+
$forge_pgsql->addKey('id', true);
115+
$forge_pgsql->createTable('users', true);
116+
117+
118+
$data_insert = array(
119+
'id' => 1,
120+
'name' => 'User 1',
121+
);
122+
$forge_pgsql->getConnection()->table('users')->insert($data_insert);
123+
124+
$forge_pgsql->dropTable('invoices',true);
125+
$forge_pgsql->addField([
126+
'id' => [
127+
'type' => 'INTEGER',
128+
'constraint' => 11,
129+
'auto_increment' => true,
130+
],
131+
'users_id' => [
132+
'type' => 'INTEGER',
133+
'constraint' => 11
134+
],
135+
'other_id' => [
136+
'type' => 'INTEGER',
137+
'constraint' => 11
138+
],
139+
'another_id' => [
140+
'type' => 'INTEGER',
141+
'constraint' => 11
142+
]
143+
]);
144+
$forge_pgsql->addKey('id', true);
145+
146+
$forge_pgsql->addForeignKey('users_id','users','id','CASCADE','CASCADE');
147+
$forge_pgsql->addForeignKey('other_id','users','id');
148+
149+
$res = $forge_pgsql->createTable('invoices', true);
150+
151+
if(!$res){
152+
var_dump($forge_pgsql->getConnection()->mysqli);
153+
}else{
154+
echo '<br><br>OK';
155+
var_dump($forge_pgsql->getConnection()->getForeignKeyData('invoices'));
156+
}
157+
158+
//$res = $forge_pgsql->dropForeignKey('invoices','invoices_other_id_foreign');
159+
160+
}
18161

19162

20163
public function escape()
@@ -136,6 +279,8 @@ public function model()
136279

137280
$politician = $model->find(3);
138281

282+
dd($politician);
283+
139284
}
140285

141286
public function curl()
@@ -160,7 +305,7 @@ public function catch()
160305

161306
public function redirect()
162307
{
163-
redirect('/checks/model');
308+
return redirect('/checks/model');
164309
}
165310

166311
public function image()
@@ -289,7 +434,7 @@ public function upload()
289434
<input type="file" name="avatar">
290435
291436
<input type="submit" value="Upload">
292-
437+
293438
</form>
294439
295440
</body>
@@ -304,4 +449,9 @@ public function parser()
304449
$this->parser = Services::parser();
305450
}
306451

452+
public function error()
453+
{
454+
throw new \RuntimeException('Oops!', 403);
455+
}
456+
307457
}

application/Views/errors/html/error_exception.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190

191191
<!-- Request -->
192192
<div class="content" id="request">
193-
<?php $request = \CodeIgniter\Services::request(null, true); ?>
193+
<?php $request = \CodeIgniter\Config\Services::request(null, true); ?>
194194

195195
<table>
196196
<tbody>
@@ -299,7 +299,7 @@
299299

300300
<!-- Response -->
301301
<?php
302-
$response = \CodeIgniter\Services::response(null, true);
302+
$response = \CodeIgniter\Config\Services::response(null, true);
303303
$response->setStatusCode(http_response_code());
304304
?>
305305
<div class="content" id="response">

0 commit comments

Comments
 (0)