Merge remote-tracking branch 'upstream/develop' into 4.3

Conflicts:
	phpstan-baseline.neon.dist
This commit is contained in:
kenjis 2022-12-06 10:31:38 +09:00
commit 2ad6f5106a
No known key found for this signature in database
GPG Key ID: BD254878922AF198
11 changed files with 27 additions and 29 deletions

View File

@ -165,6 +165,7 @@ parameters:
Database:
- Entity
- Events
- I18n
Email:
- I18n
- Events

View File

@ -26,7 +26,7 @@ parameters:
path: system/Autoloader/Autoloader.php
-
message: "#^Comparison operation \"\\>\" between int\\<1, max\\> and \\(array\\|float\\|int\\) results in an error\\.$#"
message: "#^Comparison operation \"\\>\" between int and \\(array\\|float\\|int\\) results in an error\\.$#"
count: 1
path: system/Cache/Handlers/FileHandler.php

View File

@ -242,7 +242,7 @@ class FileHandler extends BaseHandler
return false;
}
if ($data['ttl'] > 0 && time() > $data['time'] + $data['ttl']) {
if ($data['ttl'] > 0 && Time::now()->getTimestamp() > $data['time'] + $data['ttl']) {
// If the file is still there then try to remove it
if (is_file($this->path . $filename)) {
@unlink($this->path . $filename);

View File

@ -14,6 +14,7 @@ namespace CodeIgniter\Database;
use CodeIgniter\CLI\CLI;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\ConfigException;
use CodeIgniter\I18n\Time;
use Config\Database;
use Config\Migrations as MigrationsConfig;
use Config\Services;
@ -596,7 +597,7 @@ class MigrationRunner
'class' => $migration->class,
'group' => $this->group,
'namespace' => $migration->namespace,
'time' => time(),
'time' => Time::now()->getTimestamp(),
'batch' => $batch,
]);

View File

@ -12,6 +12,7 @@
namespace CodeIgniter\Test;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\I18n\Time;
use CodeIgniter\Model;
use Faker\Factory;
use Faker\Generator;
@ -503,7 +504,7 @@ class Fabricator
break;
default:
$datetime = time();
$datetime = Time::now()->getTimestamp();
}
// Determine which fields we will need

View File

@ -14,6 +14,7 @@ namespace CodeIgniter\Test\Mock;
use Closure;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\BaseHandler;
use CodeIgniter\I18n\Time;
use PHPUnit\Framework\Assert;
class MockCache extends BaseHandler implements CacheInterface
@ -100,7 +101,7 @@ class MockCache extends BaseHandler implements CacheInterface
$key = static::validateKey($key, $this->prefix);
$this->cache[$key] = $value;
$this->expirations[$key] = $ttl > 0 ? time() + $ttl : null;
$this->expirations[$key] = $ttl > 0 ? Time::now()->getTimestamp() + $ttl : null;
return true;
}
@ -221,7 +222,7 @@ class MockCache extends BaseHandler implements CacheInterface
}
// Count expired items as a miss
if (is_int($this->expirations[$key]) && $this->expirations[$key] > time()) {
if (is_int($this->expirations[$key]) && $this->expirations[$key] > Time::now()->getTimestamp()) {
return null;
}

View File

@ -12,6 +12,7 @@
namespace CodeIgniter\Test\Mock;
use CodeIgniter\Cookie\Cookie;
use CodeIgniter\I18n\Time;
use CodeIgniter\Session\Session;
/**
@ -56,7 +57,7 @@ class MockSession extends Session
*/
protected function setCookie()
{
$expiration = $this->sessionExpiration === 0 ? 0 : time() + $this->sessionExpiration;
$expiration = $this->sessionExpiration === 0 ? 0 : Time::now()->getTimestamp() + $this->sessionExpiration;
$this->cookie = $this->cookie->withValue(session_id())->withExpires($expiration);
$this->cookies[] = $this->cookie;
@ -65,6 +66,6 @@ class MockSession extends Session
public function regenerate(bool $destroy = false)
{
$this->didRegenerate = true;
$_SESSION['__ci_last_regenerate'] = time();
$_SESSION['__ci_last_regenerate'] = Time::now()->getTimestamp();
}
}

View File

@ -14,6 +14,7 @@ namespace CodeIgniter\Test;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\I18n\Time;
use Config\Services;
use Exception;
use PHPUnit\Framework\Constraint\IsEqual;
@ -339,7 +340,7 @@ class TestResponse extends TestCase
public function assertCookieExpired(string $key, string $prefix = '')
{
$this->assertTrue($this->response->hasCookie($key, null, $prefix));
$this->assertGreaterThan(time(), $this->response->getCookie($key, $prefix)->getExpiresTimestamp());
$this->assertGreaterThan(Time::now()->getTimestamp(), $this->response->getCookie($key, $prefix)->getExpiresTimestamp());
}
// --------------------------------------------------------------------

View File

@ -93,6 +93,7 @@ Database
- Added the class ``CodeIgniter\Database\RawSql`` which expresses raw SQL strings.
- :ref:`select() <query-builder-select-rawsql>`, :ref:`where() <query-builder-where-rawsql>`, :ref:`like() <query-builder-like-rawsql>`, :ref:`join() <query-builder-join-rawsql>` accept the ``CodeIgniter\Database\RawSql`` instance.
- ``DBForge::addField()`` default value raw SQL string support. See :ref:`forge-addfield-default-value-rawsql`.
- SQLite3 has a new Config property ``$foreignKeys`` that enables foreign key constraints.
Helpers and Functions
=====================

View File

@ -113,12 +113,12 @@ Explanation of Values:
=============== ===========================================================================================================
**dsn** The DSN connect string (an all-in-one configuration sequence).
**hostname** The hostname of your database server. Often this is 'localhost'.
**username** The username used to connect to the database.
**password** The password used to connect to the database.
**username** The username used to connect to the database. (``SQLite3`` does not use this.)
**password** The password used to connect to the database. (``SQLite3`` does not use this.)
**database** The name of the database you want to connect to.
.. note:: CodeIgniter doesn't support dots (``.``) in the database, table, and column names.
**DBDriver** The database type. e.g.,: ``MySQLi``, ``Postgres``, etc. The case must match the driver name
**DBDriver** The database driver name. e.g.,: ``MySQLi``, ``Postgres``, etc. The case must match the driver name
**DBPrefix** An optional table prefix which will added to the table name when running
:doc:`Query Builder <query_builder>` queries. This permits multiple CodeIgniter
installations to share one database.
@ -129,10 +129,10 @@ Explanation of Values:
**swapPre** A default table prefix that should be swapped with ``DBPrefix``. This is useful for distributed
applications where you might run manually written queries, and need the prefix to still be
customizable by the end user.
**schema** The database schema, default value varies by driver. Used by ``Postgres`` and ``SQLSRV`` drivers.
**schema** The database schema, default value varies by driver. (Used by ``Postgres`` and ``SQLSRV``.)
**encrypt** Whether or not to use an encrypted connection.
``SQLSRV`` drivers accept true/false
``MySQLi`` drivers accept an array with the following options:
``SQLSRV`` driver accepts true/false
``MySQLi`` driver accepts an array with the following options:
* ``ssl_key`` - Path to the private key file
* ``ssl_cert`` - Path to the public key certificate file
* ``ssl_ca`` - Path to the certificate authority file
@ -141,10 +141,8 @@ Explanation of Values:
* ``ssl_verify`` - true/false; Whether to verify the server certificate or not (``MySQLi`` only)
**compress** Whether or not to use client compression (``MySQLi`` only).
**strictOn** true/false (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL
while developing an application.
**port** The database port number. To use this value you have to add a line to the database config array.
.. literalinclude:: configuration/009.php
while developing an application (``MySQLi`` only).
**port** The database port number.
**foreignKeys** true/false (boolean) - Whether or not to enable Foreign Key constraint (``SQLite3`` only).
.. important:: SQLite3 Foreign Key constraint is disabled by default.
@ -152,8 +150,7 @@ Explanation of Values:
To enforce Foreign Key constraint, set this config item to true.
=============== ===========================================================================================================
.. note:: Depending on what database platform you are using (MySQL, PostgreSQL,
etc.) not all values will be needed. For example, when using SQLite you
.. note:: Depending on what database driver you are using (``MySQLi``, ``Postgres``,
etc.) not all values will be needed. For example, when using ``SQLite3`` you
will not need to supply a username or password, and the database name
will be the path to your database file. The information above assumes
you are using MySQL.
will be the path to your database file.

View File

@ -1,6 +0,0 @@
<?php
$default = [
// ...
'port' => 5432,
];