Skip to content

Commit

Permalink
升级到 v4.5.7 (#168)
Browse files Browse the repository at this point in the history
* 升级到 v4.5.7

* update
  • Loading branch information
hex-ci authored Jan 2, 2025
1 parent 86ac3a4 commit 521e514
Show file tree
Hide file tree
Showing 25 changed files with 188 additions and 60 deletions.
2 changes: 2 additions & 0 deletions source/changelogs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
.. toctree::
:titlesonly:

v4.5.7
v4.5.6
v4.5.5
v4.5.4
v4.5.3
Expand Down
33 changes: 33 additions & 0 deletions source/changelogs/v4.5.6.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#############
版本 4.5.6
#############

发布日期:2024 年 12 月 28 日

**CodeIgniter4 的 4.5.6 版本发布**

.. contents::
:local:
:depth: 3

************
已修复的 Bug
************

- **RequestTrait:** 修复了 ``fetchGlobal()`` 方法在处理以列表形式存储的数据时,无法通过数字键处理数据的 bug。
- **Session 类库:** 会话初始化的调试消息现在使用正确的日志类型 "debug" 而不是 "info"。
- **验证:** 修复了 ``getValidated()`` 方法在使用多个星号的验证规则时未返回有效数据的 bug。
- **数据库:** 修复了 ``like()`` 方法在处理带重音字符时的大小写不敏感选项。
- **解析器:** 修复了导致相同键名被第一个定义的键名替换的 bug。
- **DownloadResponse:** 修复了无法设置自定义缓存头的 bug。现在也可以使用 ``setCache()`` 方法。
- **DownloadResponse:** 修复了涉及发送自定义 "Expires-Disposition" 头的 bug。
- **路由:** 修复了当 `Routing::$translateURIDashes` 设置为 `true` 并且使用闭包定义路由时,`str_replace()` 中的 TypeError。
- **验证:** 修复了复杂语言字符串未正确处理的问题。
- **CURLRequest:** 添加了对使用非 1.1 版本的 HTTP 处理代理响应的支持。
- **数据库:** 修复了 ``Postgre\Connection::reconnect()`` 方法在连接尚未建立时抛出错误的 bug。
- **模型:** 修复了 ``Model::getIdValue()`` 方法在使用主键的数据映射时,无法正确识别 ``Entity`` 对象中主键的 bug。
- **数据库:** 修复了预处理语句中的一个错误,以正确处理二进制数据。

查看仓库的
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
以获取完整的已修复 bug 列表。
22 changes: 22 additions & 0 deletions source/changelogs/v4.5.7.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#############
版本 4.5.7
#############

发布日期:2024 年 12 月 31 日

**CodeIgniter4 的 4.5.7 版本发布**

.. contents::
:local:
:depth: 3

************
已修复的 Bug
************

- **Common:** 修复了 ``helper()`` 方法在有效的命名空间 helper 上可能抛出 `FileNotFoundException` 的 bug。
- **Forge:** 修复了 `SQLite3` 的 Forge 在调用 ``dropColumn()`` 时总是返回 `false` 的问题。

查看仓库的
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
以获取完整的已修复 bug 列表。
4 changes: 2 additions & 2 deletions source/concepts/factories.rst
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,14 @@ setOptions 方法

public bool $configCacheEnabled = true;

自 v4.5.0 起,你可以使用 ``spark optimize`` 命令来启用此功能。
或者你可以使用 ``spark optimize`` 命令来启用此功能。

.. note::
此属性无法通过
:ref:`环境变量 <configuration-classes-and-environment-variables>` 重写。

.. note::
在 v4.5.0 之前,请在 **public/index.php** 中取消以下代码的注释::
在 v4.4.x 中,请在 **public/index.php** 中取消以下代码的注释::

--- a/public/index.php
+++ b/public/index.php
Expand Down
2 changes: 1 addition & 1 deletion source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
version = '4.5'

# The full version, including alpha/beta/rc tags.
release = '4.5.5'
release = '4.5.7'

# -- General configuration ---------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions source/database/queries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ $db->error()

.. literalinclude:: queries/018.php

.. note:: 目前,唯一实际使用选项数组的数据库是 SQLSRV。

执行查询
===================

Expand Down
12 changes: 5 additions & 7 deletions source/database/queries/016.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<?php

$pQuery = $db->prepare(static function ($db) {
return $db->table('user')->insert([
'name' => 'x',
'email' => 'y',
'country' => 'US',
]);
});
$pQuery = $db->prepare(static fn ($db) => $db->table('user')->insert([
'name' => 'x',
'email' => 'y',
'country' => 'US',
]));
12 changes: 5 additions & 7 deletions source/database/queries/019.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php

// Prepare the Query
$pQuery = $db->prepare(static function ($db) {
return $db->table('user')->insert([
'name' => 'x',
'email' => 'y',
'country' => 'US',
]);
});
$pQuery = $db->prepare(static fn ($db) => $db->table('user')->insert([
'name' => 'x',
'email' => 'y',
'country' => 'US',
]));

// Collect the Data
$name = 'John Doe';
Expand Down
14 changes: 11 additions & 3 deletions source/dbmgmt/migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,22 @@
迁移文件命名
********************

每个迁移会按照创建时的数字顺序正向或反向运行,具体取决于采取的方法。每个迁移使用创建时的时间戳命名,格式为 **YYYY-MM-DD-HHIISS** (例如 **2012-10-31-100537**)。这有助于在团队环境下避免编号冲突
迁移文件名由时间戳前缀、下划线(``_``)和描述性名称(类名)组成

为你的迁移文件添加迁移编号前缀,后跟下划线和对迁移的描述性名称。年、月、日可以用破折号、下划线或不加分隔符的方式分割。例如:
* 2024-09-08-013653_AddBlogTable.php

每个迁移都使用创建迁移时的时间戳(**2024-09-08-013653**)进行编号,格式为 **YYYY-MM-DD-HHIISS**。

迁移的描述性名称(**AddBlogTable**)是 PHP 中的类名,因此你必须为其命名一个有效的类名。

前缀中的年、月、日和时间的分隔符可以是短横线(``-``)、下划线(``_``)或者不使用任何分隔符。例如:

* 2012-10-31-100538_AlterBlogTrackViews.php
* 2012_10_31_100539_AlterBlogAddTranslations.php
* 20121031100537_AddBlog.php

每个迁移根据所采取的方法按数字顺序向前或向后运行。这有助于在团队协作环境中避免编号冲突。

******************
创建迁移
******************
Expand All @@ -32,7 +40,7 @@

数据库连接和数据库 Forge 类都可以通过 ``$this->db`` 和 ``$this->forge`` 获取。

或者,你可以使用命令行调用来生成骨架迁移文件。更多细节请参阅 :ref:`command-line-tools` 中的 **make:migration**
或者,你可以使用命令行调用来生成一个骨架迁移文件。更多详情请参阅 :ref:`command-line-tools` 中的 `make:migration`_

.. note:: 由于迁移类是一个 PHP 类,每个迁移文件中的类名必须是唯一的。

Expand Down
2 changes: 1 addition & 1 deletion source/general/ajax.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ React
htmx
====

你可以使用 ajax-header 扩展。
你可以使用 `ajax-header <https://github.com/bigskysoftware/htmx-extensions/blob/main/src/ajax-header/README.md>`_ 扩展。

.. code-block:: html

Expand Down
15 changes: 8 additions & 7 deletions source/helpers/html_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ HTML 辅助函数文件包含了帮助处理 HTML 的函数。
.. php:function:: img([$src = ''[, $indexPage = false[, $attributes = '']]])
:param string|array $src: 图像源 URI,或属性和值的数组
:param bool $indexPage: 是否将 ``$src`` 视为路由的 URI 字符串
:param bool $indexPage: 是否应该将 ``Config\App::$indexPage`` 添加到源路径中
:param mixed $attributes: 其他 HTML 属性
:returns: 一个 HTML img 标签
:rtype: string
Expand Down Expand Up @@ -71,14 +71,14 @@ HTML 辅助函数文件包含了帮助处理 HTML 的函数。
:param string $type: 相关文档的类型
:param string $title: 链接标题
:param string $media: 媒体类型
:param bool $indexPage: 是否将 ``$src`` 视为路由的 URI 字符串
:param bool $indexPage: 是否应该将 indexPage 添加到链接路径中
:param string $hreflang: Hreflang 类型
:returns: 一个 HTML link 标签
:rtype: string

允许你创建 HTML ``<link>`` 标签。这对于样式表链接很有用,也用于其他链接。参数是 *href*,可选的 *rel*、*type*、*title*、*media* 和 *indexPage*。
允许你创建 HTML ``<link>`` 标签。这对于样式表链接很有用也用于其他链接。参数是 *href*可选的 *rel*、*type*、*title*、*media*、*indexPage* 和 *hreflang*。

*indexPage* 是一个布尔值,指定 *href* 是否应该添加由 ``$config['indexPage']`` 指定的页面地址。
*indexPage* 是一个布尔值指定 *href* 是否应该添加由 ``$config['indexPage']`` 指定的页面地址。

示例:

Expand Down Expand Up @@ -198,7 +198,7 @@ HTML 辅助函数文件包含了帮助处理 HTML 的函数。
:param string $unsupportedMessage: 如果浏览器不支持 video 标签应显示的消息
:param string $attributes: HTML 属性
:param array $tracks: 在数组内使用 track 函数。参见 :php:func:`track()` 函数
:param bool $indexPage:
:param bool $indexPage: 是否应该将 indexPage 添加到视频源路径中
:returns: 一个 HTML video 标签
:rtype: string

Expand Down Expand Up @@ -236,7 +236,7 @@ HTML 辅助函数文件包含了帮助处理 HTML 的函数。
:param string $unsupportedMessage: 如果浏览器不支持 audio 标签应显示的消息
:param string $attributes:
:param array $tracks: 在数组内使用 track 函数。参见 :php:func:`track()` 函数
:param bool $indexPage:
:param bool $indexPage: 是否应该将 indexPage 添加到音频源路径中
:returns: 一个 HTML audio 标签
:rtype: string

Expand All @@ -259,7 +259,7 @@ HTML 辅助函数文件包含了帮助处理 HTML 的函数。
:param string $src: 要嵌入的资源路径
:param bool $type: MIME 类型
:param array $attributes: HTML 属性
:param bool $indexPage:
:param bool $indexPage: 是否应该将 indexPage 添加到源路径中
:returns: 一个 HTML embed 标签
:rtype: string

Expand All @@ -272,6 +272,7 @@ HTML 辅助函数文件包含了帮助处理 HTML 的函数。
:param string $data: 资源 URL
:param bool $type: 资源的内容类型
:param array $attributes: HTML 属性
:param bool $indexPage: 是否应该将 indexPage 添加到资源 URL 中
:param array $params: 在数组中使用 param 函数。参见 :php:func:`param()` 函数
:returns: 一个 HTML object 标签
:rtype: string
Expand Down
38 changes: 19 additions & 19 deletions source/helpers/url_helper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ URL 辅助函数文件包含帮助使用 URL 的函数。
.. php:function:: site_url([$uri = ''[, $protocol = null[, $altConfig = null]]])
:param array|string $uri: URI 字符串或 URI 段数组
:param string $protocol: 协议,例如 'http' 或 'https'。如果设置为空字符串 '',则返回一个 protocol-relative 链接。
:param string $protocol: 协议,例如 ``'http'````'https'``。如果设置为空字符串 ``''``,则返回一个 protocol-relative 链接。
:param \\Config\\App $altConfig: 要使用的备用配置
:returns: 站点 URL
:rtype: string
Expand Down Expand Up @@ -49,7 +49,7 @@ URL 辅助函数文件包含帮助使用 URL 的函数。
.. php:function:: base_url([$uri = ''[, $protocol = null]])
:param array|string $uri: URI 字符串或 URI 段数组
:param string $protocol: 协议,例如 'http' 或 'https'。如果设置为空字符串 '',则返回一个 protocol-relative 链接。
:param string $protocol: 协议,例如 ``'http'````'https'``。如果设置为空字符串 ``''``,则返回一个 protocol-relative 链接。
:returns: Base URL
:rtype: string

Expand Down Expand Up @@ -107,7 +107,7 @@ URL 辅助函数文件包含帮助使用 URL 的函数。
:param boolean $returnObject: 如果希望返回 URI 实例而不是字符串,则为 True。
:returns: 用户之前所在的 URL
:rtype: string|mixed|\\CodeIgniter\\HTTP\\URI
:rtype: string|\\CodeIgniter\\HTTP\\URI

返回用户之前完整的 URL(包括段)。

Expand Down Expand Up @@ -157,10 +157,10 @@ URL 辅助函数文件包含帮助使用 URL 的函数。

.. php:function:: anchor([$uri = ''[, $title = ''[, $attributes = ''[, $altConfig = null]]]])
:param mixed $uri: URI字符串或URI段数组
:param string $title: 锚点标题
:param mixed $attributes: HTML属性
:param \\Config\\App $altConfig: 要使用的备用配置
:param array|string $uri: URI字符串或URI段数组
:param string $title: 锚点标题
:param array|object|string $attributes: HTML属性
:param \\Config\\App|null $altConfig: 要使用的备用配置
:returns: HTML链接(锚点标签)
:rtype: string

Expand All @@ -184,10 +184,10 @@ URL 辅助函数文件包含帮助使用 URL 的函数。

.. php:function:: anchor_popup([$uri = ''[, $title = ''[, $attributes = false[, $altConfig = null]]]])
:param string $uri: URI字符串
:param string $title: 锚点标题
:param mixed $attributes: HTML属性
:param \\Config\\App $altConfig: 要使用的备用配置
:param string $uri: URI字符串
:param string $title: 锚点标题
:param array|false|object|string $attributes: HTML属性
:param \\Config\\App $altConfig: 要使用的备用配置
:returns: 弹出式超链接
:rtype: string

Expand All @@ -211,9 +211,9 @@ URL 辅助函数文件包含帮助使用 URL 的函数。

.. php:function:: mailto($email[, $title = ''[, $attributes = '']])
:param string $email: 电子邮件地址
:param string $title: 锚点标题
:param mixed $attributes: HTML属性
:param string $email: 电子邮件地址
:param string $title: 锚点标题
:param array|object|string $attributes: HTML属性
:returns: “发送邮件到”超链接
:rtype: string

Expand All @@ -229,9 +229,9 @@ URL 辅助函数文件包含帮助使用 URL 的函数。

.. php:function:: safe_mailto($email[, $title = ''[, $attributes = '']])
:param string $email: 电子邮件地址
:param string $title: 锚点标题
:param mixed $attributes: HTML属性
:param string $email: 电子邮件地址
:param string $title: 锚点标题
:param array|object|string $attributes: HTML属性
:returns: 防垃圾邮件的“发送邮件到”超链接
:rtype: string

Expand All @@ -240,7 +240,7 @@ URL 辅助函数文件包含帮助使用 URL 的函数。
.. php:function:: auto_link($str[, $type = 'both'[, $popup = false]])
:param string $str: 输入字符串
:param string $type: 链接类型('email''url' 或 'both')
:param string $type: 链接类型(``'email'``、``'url'````'both'``)
:param bool $popup: 是否创建弹出链接
:returns: 链接化的字符串
:rtype: string
Expand Down Expand Up @@ -315,7 +315,7 @@ URL 辅助函数文件包含帮助使用 URL 的函数。
.. php:function:: url_to($controller[, ...$args])
:param string $controller: 路由名称或 Controller::method
:param mixed ...$args: 要传递给路由的一个或多个参数。最后一个参数允许你设置区域设置。
:param int|string ...$args: 要传递给路由的一个或多个参数。最后一个参数允许你设置区域设置。
:returns: 绝对 URL
:rtype: string

Expand Down
2 changes: 1 addition & 1 deletion source/incoming/filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ $required

本章节允许你定义 **Required Filters** (必需过滤器)。它们是应用于框架所做的每个请求的特殊过滤器。它们在其他种类的过滤器之前和之后应用,这些过滤器将在下面解释。

.. note:: Required Filters 总是会执行,即使路由不存在
.. note:: Required Filters 总是会被执行。然而,如果路由不存在,则只会执行 Before Filters

你应该注意在这里使用的数量,因为在每个请求上运行太多可能会带来性能影响。但默认设置的过滤器提供了框架功能。如果移除,这些功能将不再工作。详细信息请参见 :ref:`provided-filters`。

Expand Down
4 changes: 2 additions & 2 deletions source/installation/upgrade_455.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
配置
------

- composer.json
- preload.php

所有更改
===========

这是 **项目空间** 中所有收到更改的文件列表;许多只是简单的注释或格式调整,对运行时没有影响:

- composer.json
- preload.php
33 changes: 33 additions & 0 deletions source/installation/upgrade_456.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#############################
从 4.5.5 升级到 4.5.6
#############################

请参考与你的安装方法对应的升级说明。

- :ref:`Composer 安装 App Starter 升级 <app-starter-upgrading>`
- :ref:`Composer 安装 将 CodeIgniter4 添加到现有项目 升级 <adding-codeigniter4-upgrading>`
- :ref:`手动安装 升级 <installing-manual-upgrading>`

.. contents::
:local:
:depth: 2

*************
项目文件
*************

**项目空间** (root、app、public、writable)中的一些文件已更新。由于这些文件位于 **system** 范围之外,它们不会在没有你干预的情况下被更改。

.. note:: 有一些第三方 CodeIgniter 模块可用于帮助合并项目空间的更改:
`在 Packagist 上探索 <https://packagist.org/explore/?query=codeigniter4%20updates>`_。

所有更改
===========

这是 **项目空间** 中所有已更改文件的列表;许多更改只是注释或格式调整,不会影响运行时:

- app/Config/Events.php
- app/Config/Format.php
- app/Controllers/BaseController.php
- app/Views/errors/cli/error_exception.php
- app/Views/errors/html/error_exception.php
Loading

0 comments on commit 521e514

Please sign in to comment.