Skip to content

Commit 9bb8e6f

Browse files
authored
Merge pull request #438 from kenjis/update-ci-451
Patch framework (v4.4.7 => v4.5.1)
2 parents 9d9d5a2 + 0b0d3ff commit 9bb8e6f

24 files changed

+525
-311
lines changed

app/Config/Autoload.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ class Autoload extends AutoloadConfig
3030
* their location on the file system. These are used by the autoloader
3131
* to locate files the first time they have been instantiated.
3232
*
33-
* The '/app' and '/system' directories are already mapped for you.
34-
* you may change the name of the 'App' namespace if you wish,
33+
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
34+
* already mapped for you.
35+
*
36+
* You may change the name of the 'App' namespace if you wish,
3537
* but this should be done prior to creating any namespaced classes,
3638
* else you will need to modify all of those classes for this to work.
3739
*
@@ -44,8 +46,7 @@ class Autoload extends AutoloadConfig
4446
* @var array<string, list<string>|string>
4547
*/
4648
public $psr4 = [
47-
APP_NAMESPACE => APPPATH, // For custom app namespace
48-
'Config' => APPPATH . 'Config',
49+
APP_NAMESPACE => APPPATH,
4950
];
5051

5152
/**

app/Config/Boot/development.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,4 @@
2828
| the system. This will control whether Kint is loaded, and a few other
2929
| items. It can always be used within your own application too.
3030
*/
31-
3231
defined('CI_DEBUG') || define('CI_DEBUG', true);

app/Config/Boot/production.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,13 @@
66
|--------------------------------------------------------------------------
77
| Don't show ANY in production environments. Instead, let the system catch
88
| it and display a generic error message.
9+
|
10+
| If you set 'display_errors' to '1', CI4's detailed error report will show.
911
*/
12+
error_reporting(E_ALL & ~E_DEPRECATED);
13+
// If you want to suppress more types of errors.
14+
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
1015
ini_set('display_errors', '0');
11-
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
1216

1317
/*
1418
|--------------------------------------------------------------------------
@@ -18,5 +22,4 @@
1822
| the system. It's not widely used currently, and may not survive
1923
| release of the framework.
2024
*/
21-
2225
defined('CI_DEBUG') || define('CI_DEBUG', false);

app/Config/Boot/testing.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,4 @@
2929
| the system. It's not widely used currently, and may not survive
3030
| release of the framework.
3131
*/
32-
3332
defined('CI_DEBUG') || define('CI_DEBUG', true);

app/Config/Cache.php

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,6 @@ class Cache extends BaseConfig
4646
*/
4747
public string $storePath = WRITEPATH . 'cache/';
4848

49-
/**
50-
* --------------------------------------------------------------------------
51-
* Cache Include Query String
52-
* --------------------------------------------------------------------------
53-
*
54-
* Whether to take the URL query string into consideration when generating
55-
* output cache files. Valid options are:
56-
*
57-
* false = Disabled
58-
* true = Enabled, take all query parameters into account.
59-
* Please be aware that this may result in numerous cache
60-
* files generated for the same page over and over again.
61-
* array('q') = Enabled, but only take into account the specified list
62-
* of query parameters.
63-
*
64-
* @var bool|list<string>
65-
*/
66-
public $cacheQueryString = false;
67-
6849
/**
6950
* --------------------------------------------------------------------------
7051
* Key Prefix
@@ -167,4 +148,23 @@ class Cache extends BaseConfig
167148
'redis' => RedisHandler::class,
168149
'wincache' => WincacheHandler::class,
169150
];
151+
152+
/**
153+
* --------------------------------------------------------------------------
154+
* Web Page Caching: Cache Include Query String
155+
* --------------------------------------------------------------------------
156+
*
157+
* Whether to take the URL query string into consideration when generating
158+
* output cache files. Valid options are:
159+
*
160+
* false = Disabled
161+
* true = Enabled, take all query parameters into account.
162+
* Please be aware that this may result in numerous cache
163+
* files generated for the same page over and over again.
164+
* ['q'] = Enabled, but only take into account the specified list
165+
* of query parameters.
166+
*
167+
* @var bool|list<string>
168+
*/
169+
public $cacheQueryString = false;
170170
}

app/Config/Cors.php

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
<?php
2+
3+
namespace Config;
4+
5+
use CodeIgniter\Config\BaseConfig;
6+
7+
/**
8+
* Cross-Origin Resource Sharing (CORS) Configuration
9+
*
10+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
11+
*/
12+
class Cors extends BaseConfig
13+
{
14+
/**
15+
* The default CORS configuration.
16+
*
17+
* @var array{
18+
* allowedOrigins: list<string>,
19+
* allowedOriginsPatterns: list<string>,
20+
* supportsCredentials: bool,
21+
* allowedHeaders: list<string>,
22+
* exposedHeaders: list<string>,
23+
* allowedMethods: list<string>,
24+
* maxAge: int,
25+
* }
26+
*/
27+
public array $default = [
28+
/**
29+
* Origins for the `Access-Control-Allow-Origin` header.
30+
*
31+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
32+
*
33+
* E.g.:
34+
* - ['http://localhost:8080']
35+
* - ['https://www.example.com']
36+
*/
37+
'allowedOrigins' => [],
38+
39+
/**
40+
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
41+
*
42+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
43+
*
44+
* NOTE: A pattern specified here is part of a regular expression. It will
45+
* be actually `#\A<pattern>\z#`.
46+
*
47+
* E.g.:
48+
* - ['https://\w+\.example\.com']
49+
*/
50+
'allowedOriginsPatterns' => [],
51+
52+
/**
53+
* Weather to send the `Access-Control-Allow-Credentials` header.
54+
*
55+
* The Access-Control-Allow-Credentials response header tells browsers whether
56+
* the server allows cross-origin HTTP requests to include credentials.
57+
*
58+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
59+
*/
60+
'supportsCredentials' => false,
61+
62+
/**
63+
* Set headers to allow.
64+
*
65+
* The Access-Control-Allow-Headers response header is used in response to
66+
* a preflight request which includes the Access-Control-Request-Headers to
67+
* indicate which HTTP headers can be used during the actual request.
68+
*
69+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
70+
*/
71+
'allowedHeaders' => [],
72+
73+
/**
74+
* Set headers to expose.
75+
*
76+
* The Access-Control-Expose-Headers response header allows a server to
77+
* indicate which response headers should be made available to scripts running
78+
* in the browser, in response to a cross-origin request.
79+
*
80+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
81+
*/
82+
'exposedHeaders' => [],
83+
84+
/**
85+
* Set methods to allow.
86+
*
87+
* The Access-Control-Allow-Methods response header specifies one or more
88+
* methods allowed when accessing a resource in response to a preflight
89+
* request.
90+
*
91+
* E.g.:
92+
* - ['GET', 'POST', 'PUT', 'DELETE']
93+
*
94+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
95+
*/
96+
'allowedMethods' => [],
97+
98+
/**
99+
* Set how many seconds the results of a preflight request can be cached.
100+
*
101+
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
102+
*/
103+
'maxAge' => 7200,
104+
];
105+
}

app/Config/Database.php

Lines changed: 119 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
class Database extends Config
1111
{
1212
/**
13-
* The directory that holds the Migrations
14-
* and Seeds directories.
13+
* The directory that holds the Migrations and Seeds directories.
1514
*/
1615
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
1716

1817
/**
19-
* Lets you choose which connection group to
20-
* use if no other is specified.
18+
* Lets you choose which connection group to use if no other is specified.
2119
*/
2220
public string $defaultGroup = 'default';
2321

@@ -45,11 +43,120 @@ class Database extends Config
4543
'failover' => [],
4644
'port' => 3306,
4745
'numberNative' => false,
46+
'dateFormat' => [
47+
'date' => 'Y-m-d',
48+
'datetime' => 'Y-m-d H:i:s',
49+
'time' => 'H:i:s',
50+
],
4851
];
4952

53+
// /**
54+
// * Sample database connection for SQLite3.
55+
// *
56+
// * @var array<string, mixed>
57+
// */
58+
// public array $default = [
59+
// 'database' => 'database.db',
60+
// 'DBDriver' => 'SQLite3',
61+
// 'DBPrefix' => '',
62+
// 'DBDebug' => true,
63+
// 'swapPre' => '',
64+
// 'failover' => [],
65+
// 'foreignKeys' => true,
66+
// 'busyTimeout' => 1000,
67+
// 'dateFormat' => [
68+
// 'date' => 'Y-m-d',
69+
// 'datetime' => 'Y-m-d H:i:s',
70+
// 'time' => 'H:i:s',
71+
// ],
72+
// ];
73+
74+
// /**
75+
// * Sample database connection for Postgre.
76+
// *
77+
// * @var array<string, mixed>
78+
// */
79+
// public array $default = [
80+
// 'DSN' => '',
81+
// 'hostname' => 'localhost',
82+
// 'username' => 'root',
83+
// 'password' => 'root',
84+
// 'database' => 'ci4',
85+
// 'schema' => 'public',
86+
// 'DBDriver' => 'Postgre',
87+
// 'DBPrefix' => '',
88+
// 'pConnect' => false,
89+
// 'DBDebug' => true,
90+
// 'charset' => 'utf8',
91+
// 'swapPre' => '',
92+
// 'failover' => [],
93+
// 'port' => 5432,
94+
// 'dateFormat' => [
95+
// 'date' => 'Y-m-d',
96+
// 'datetime' => 'Y-m-d H:i:s',
97+
// 'time' => 'H:i:s',
98+
// ],
99+
// ];
100+
101+
// /**
102+
// * Sample database connection for SQLSRV.
103+
// *
104+
// * @var array<string, mixed>
105+
// */
106+
// public array $default = [
107+
// 'DSN' => '',
108+
// 'hostname' => 'localhost',
109+
// 'username' => 'root',
110+
// 'password' => 'root',
111+
// 'database' => 'ci4',
112+
// 'schema' => 'dbo',
113+
// 'DBDriver' => 'SQLSRV',
114+
// 'DBPrefix' => '',
115+
// 'pConnect' => false,
116+
// 'DBDebug' => true,
117+
// 'charset' => 'utf8',
118+
// 'swapPre' => '',
119+
// 'encrypt' => false,
120+
// 'failover' => [],
121+
// 'port' => 1433,
122+
// 'dateFormat' => [
123+
// 'date' => 'Y-m-d',
124+
// 'datetime' => 'Y-m-d H:i:s',
125+
// 'time' => 'H:i:s',
126+
// ],
127+
// ];
128+
129+
// /**
130+
// * Sample database connection for OCI8.
131+
// *
132+
// * You may need the following environment variables:
133+
// * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
134+
// * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
135+
// * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
136+
// * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
137+
// *
138+
// * @var array<string, mixed>
139+
// */
140+
// public array $default = [
141+
// 'DSN' => 'localhost:1521/XEPDB1',
142+
// 'username' => 'root',
143+
// 'password' => 'root',
144+
// 'DBDriver' => 'OCI8',
145+
// 'DBPrefix' => '',
146+
// 'pConnect' => false,
147+
// 'DBDebug' => true,
148+
// 'charset' => 'AL32UTF8',
149+
// 'swapPre' => '',
150+
// 'failover' => [],
151+
// 'dateFormat' => [
152+
// 'date' => 'Y-m-d',
153+
// 'datetime' => 'Y-m-d H:i:s',
154+
// 'time' => 'H:i:s',
155+
// ],
156+
// ];
157+
50158
/**
51-
* This database connection is used when
52-
* running PHPUnit database tests.
159+
* This database connection is used when running PHPUnit database tests.
53160
*
54161
* @var array<string, mixed>
55162
*/
@@ -64,7 +171,7 @@ class Database extends Config
64171
'pConnect' => false,
65172
'DBDebug' => true,
66173
'charset' => 'utf8',
67-
'DBCollat' => 'utf8_general_ci',
174+
'DBCollat' => '',
68175
'swapPre' => '',
69176
'encrypt' => false,
70177
'compress' => false,
@@ -73,6 +180,11 @@ class Database extends Config
73180
'port' => 3306,
74181
'foreignKeys' => true,
75182
'busyTimeout' => 1000,
183+
'dateFormat' => [
184+
'date' => 'Y-m-d',
185+
'datetime' => 'Y-m-d H:i:s',
186+
'time' => 'H:i:s',
187+
],
76188
];
77189

78190
public function __construct()

0 commit comments

Comments
 (0)