Skip to content

Commit 404fbc4

Browse files
committed
Merge branch 'develop' of https://github.com/codeigniter4/CodeIgniter4 into migration-union
2 parents f2c0d34 + 4b8c1fb commit 404fbc4

35 files changed

Lines changed: 4410 additions & 82 deletions

admin/release-appstarter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ git checkout $branch
1212
echo -e "${BOLD}Build the framework distributable${NORMAL}"
1313

1414
echo -e "${BOLD}Copy the main files/folders...${NORMAL}"
15-
releasable='app public writable README.md contributing.md env license.txt spark tests/_support'
15+
releasable='app public writable README.md contributing.md env license.txt spark .gitignore'
1616
for fff in $releasable ; do
1717
if [ -d "$fff" ] ; then
1818
rm -rf $fff

admin/release-framework

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ git checkout $branch
1212
echo -e "${BOLD}Build the framework distributable${NORMAL}"
1313

1414
echo -e "${BOLD}Copy the main files/folders...${NORMAL}"
15-
releasable='app docs public system writable contributing.md env license.txt spark'
15+
releasable='app docs public system writable contributing.md env license.txt spark .gitignore'
1616
for fff in $releasable ; do
1717
if [ -d "$fff" ] ; then
1818
rm -rf $fff

app/Config/Email.php

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
<?php
2+
namespace Config;
3+
4+
class Email
5+
{
6+
7+
/**
8+
* @var string
9+
*/
10+
public $fromEmail;
11+
12+
/**
13+
* @var string
14+
*/
15+
public $fromName;
16+
17+
/**
18+
* The "user agent"
19+
*
20+
* @var string
21+
*/
22+
public $userAgent = 'CodeIgniter';
23+
24+
/**
25+
* The mail sending protocol: mail, sendmail, smtp
26+
*
27+
* @var string
28+
*/
29+
public $protocol = 'mail';
30+
31+
/**
32+
* The server path to Sendmail.
33+
*
34+
* @var string
35+
*/
36+
public $mailPath = '/usr/sbin/sendmail';
37+
38+
/**
39+
* SMTP Server Address
40+
*
41+
* @var string
42+
*/
43+
public $SMTPHost;
44+
45+
/**
46+
* SMTP Username
47+
*
48+
* @var string
49+
*/
50+
public $SMTPUser;
51+
52+
/**
53+
* SMTP Password
54+
*
55+
* @var string
56+
*/
57+
public $SMTPPass;
58+
59+
/**
60+
* SMTP Port
61+
*
62+
* @var integer
63+
*/
64+
public $SMTPPort = 25;
65+
66+
/**
67+
* SMTP Timeout (in seconds)
68+
*
69+
* @var integer
70+
*/
71+
public $SMTPTimeout = 5;
72+
73+
/**
74+
* Enable persistent SMTP connections
75+
*
76+
* @var boolean
77+
*/
78+
public $SMTPKeepAlive = false;
79+
80+
/**
81+
* SMTP Encryption. Either tls or ssl
82+
*
83+
* @var string
84+
*/
85+
public $SMTPCrypto = 'tls';
86+
87+
/**
88+
* Enable word-wrap
89+
*
90+
* @var boolean
91+
*/
92+
public $wordWrap = true;
93+
94+
/**
95+
* Character count to wrap at
96+
*
97+
* @var integer
98+
*/
99+
public $wrapChars = 76;
100+
101+
/**
102+
* Type of mail, either 'text' or 'html'
103+
*
104+
* @var string
105+
*/
106+
public $mailType = 'text';
107+
108+
/**
109+
* Character set (utf-8, iso-8859-1, etc.)
110+
*
111+
* @var string
112+
*/
113+
public $charset = 'UTF-8';
114+
115+
/**
116+
* Whether to validate the email address
117+
*
118+
* @var boolean
119+
*/
120+
public $validate = false;
121+
122+
/**
123+
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
124+
*
125+
* @var integer
126+
*/
127+
public $priority = 3;
128+
129+
/**
130+
* Newline character. (Use “\r\n” to comply with RFC 822)
131+
*
132+
* @var string
133+
*/
134+
public $CRLF = "\r\n";
135+
136+
/**
137+
* Newline character. (Use “\r\n” to comply with RFC 822)
138+
*
139+
* @var string
140+
*/
141+
public $newline = "\r\n";
142+
143+
/**
144+
* Enable BCC Batch Mode.
145+
*
146+
* @var boolean
147+
*/
148+
public $BCCBatchMode = false;
149+
150+
/**
151+
* Number of emails in each BCC batch
152+
*
153+
* @var integer
154+
*/
155+
public $BCCBatchSize = 200;
156+
157+
/**
158+
* Enable notify message from server
159+
*
160+
* @var boolean
161+
*/
162+
public $DSN = false;
163+
164+
}

app/Config/Encryption.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
namespace Config;
3+
4+
use CodeIgniter\Config\BaseConfig;
5+
6+
/**
7+
* Encryption configuration.
8+
*
9+
* These are the settings used for encryption, if you don't pass a parameter
10+
* array to the encrypter for creation/initialization.
11+
*/
12+
class Encryption extends BaseConfig
13+
{
14+
/*
15+
|--------------------------------------------------------------------------
16+
| Encryption Key Starter
17+
|--------------------------------------------------------------------------
18+
|
19+
| If you use the Encryption class you must set an encryption key (seed).
20+
| You need to ensure it is long enough for the cipher and mode you plan to use.
21+
| See the user guide for more info.
22+
*/
23+
24+
public $key = '';
25+
26+
/*
27+
|--------------------------------------------------------------------------
28+
| Encryption driver to use
29+
|--------------------------------------------------------------------------
30+
|
31+
| One of the supported drivers, eg 'OpenSSL' or 'Sodium'.
32+
| The default driver, if you don't specify one, is 'OpenSSL'.
33+
*/
34+
public $driver = 'OpenSSL';
35+
36+
}

app/Config/Migrations.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Migrations extends BaseConfig
99
| Enable/Disable Migrations
1010
|--------------------------------------------------------------------------
1111
|
12-
| Migrations are disabled by default for security reasons.
12+
| Migrations are enabled by default for security reasons.
1313
| You should enable migrations whenever you intend to do a schema migration
1414
| and disable it back when you're done.
1515
|

app/Controllers/Home.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php namespace App\Controllers;
22

3-
use App\Models\UserModel;
4-
53
class Home extends BaseController
64
{
75
public function index()

system/Autoloader/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ protected function discoverComposerNamespaces()
422422
unset($paths['CodeIgniter\\']);
423423
}
424424

425-
// Composer stores paths with trailng slash. We don't.
425+
// Composer stores namespaces with trailing slash. We don't.
426426
$newPaths = [];
427427
foreach ($paths as $key => $value)
428428
{

system/Autoloader/FileLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public function listNamespaceFiles(string $prefix, string $path): array
408408
// autoloader->getNamespace($prefix) returns an array of paths for that namespace
409409
foreach ($this->autoloader->getNamespace($prefix) as $namespacePath)
410410
{
411-
$fullPath = realpath($namespacePath . $path);
411+
$fullPath = realpath(rtrim($namespacePath, '/') . '/' . $path);
412412

413413
if (! is_dir($fullPath))
414414
{

system/Config/BaseConfig.php

Lines changed: 44 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -90,47 +90,7 @@ public function __construct()
9090

9191
foreach ($properties as $property)
9292
{
93-
if (is_array($this->$property))
94-
{
95-
foreach ($this->$property as $key => $val)
96-
{
97-
if ($value = $this->getEnvValue("{$property}.{$key}", $prefix, $shortPrefix))
98-
{
99-
if (! is_null($value))
100-
{
101-
if ($value === 'false')
102-
{
103-
$value = false;
104-
}
105-
elseif ($value === 'true')
106-
{
107-
$value = true;
108-
}
109-
110-
$this->$property[$key] = $value;
111-
}
112-
}
113-
}
114-
}
115-
else
116-
{
117-
if (($value = $this->getEnvValue($property, $prefix, $shortPrefix)) !== false)
118-
{
119-
if (! is_null($value))
120-
{
121-
if ($value === 'false')
122-
{
123-
$value = false;
124-
}
125-
elseif ($value === 'true')
126-
{
127-
$value = true;
128-
}
129-
130-
$this->$property = is_bool($value) ? $value : trim($value, '\'"');
131-
}
132-
}
133-
}
93+
$this->initEnvValue($this->$property, $property, $prefix, $shortPrefix);
13494
}
13595

13696
if (defined('ENVIRONMENT') && ENVIRONMENT !== 'testing')
@@ -144,6 +104,49 @@ public function __construct()
144104

145105
//--------------------------------------------------------------------
146106

107+
/**
108+
* Initialization an environment-specific configuration setting
109+
*
110+
* @param mixed &$property
111+
* @param string $name
112+
* @param string $prefix
113+
* @param string $shortPrefix
114+
*
115+
* @return mixed
116+
*/
117+
protected function initEnvValue(&$property, string $name, string $prefix, string $shortPrefix)
118+
{
119+
if (is_array($property))
120+
{
121+
foreach ($property as $key => $val)
122+
{
123+
$this->initEnvValue($property[$key], "{$name}.{$key}", $prefix, $shortPrefix);
124+
}
125+
}
126+
else
127+
{
128+
if (($value = $this->getEnvValue($name, $prefix, $shortPrefix)) !== false)
129+
{
130+
if (! is_null($value))
131+
{
132+
if ($value === 'false')
133+
{
134+
$value = false;
135+
}
136+
elseif ($value === 'true')
137+
{
138+
$value = true;
139+
}
140+
141+
$property = is_bool($value) ? $value : trim($value, '\'"');
142+
}
143+
}
144+
}
145+
return $property;
146+
}
147+
148+
//--------------------------------------------------------------------
149+
147150
/**
148151
* Retrieve an environment-specific configuration setting
149152
*

0 commit comments

Comments
 (0)