跳过,至主要内容

新弃用

了解所有新的弃用以及你应该开始使用什么替换它们。

语言字符串

文件:administrator/language/en-GB/com_joomlaupdate.ini
字符串:INSTL_MB_STRING_OVERLOAD_OFF、INSTL_NOTICEMBSTRINGOVERLOAD

文件:installation/language/en-GB/joomla.ini
字符串:INSTL_MB_STRING_OVERLOAD_OFF、INSTL_NOTICE_MBSTRING_OVERLOAD_OFF

文件:administrator/language/en-GB/plg_user_joomla.ini 字符串:PLG_USER_JOOMLA_FIELD_STRONG_PASSWORDS_LABEL、PLG_USER_JOOMLA_POSTINSTALL_STRONGPW_BTN、PLG_USER_JOOMLA_POSTINSTALL_STRONGPW_TEXT、PLG_USER_JOOMLA_POSTINSTALL_STRONGPW_TITLE

WebApplication 类的 item_associations 属性已弃用

文件:libraries/src/Application/WebApplication.php 替换:$item_associations 属性已被移除,没有替代品,因为它不再在核心使用了。

隐私插件 db 属性已弃用

文件:administrator/components/com_privacy/src/Plugin/PrivacyPlugin.php 替换:隐私插件中已将 $this->db 属性弃用。当插件转换为服务提供程序时,请改用 $this->getDatabase()

模型状态不再属于 CMSObject 类型

文件:libraries/src/MVC/Model/StateBehaviorTrait.php 替换:直接针对模型状态对象进行的属性访问应替换为 get/set 函数调用。状态对象现在是一个包含商店应提供所有便捷功能的 Registry。例如

// Write to the state
$model->getState()->set('foo', 'bar');

// Access the state
$data = $model->getState()->get('foo');

ContentHelper 操作不再属于 CMSObject 类型

文件:libraries/src/Helper/ContentHelper.php 替换:直接针对视图的 canDo 对象进行的属性访问应替换为 get/set 函数调用。状态对象现在是一个包含商店应提供所有便捷功能的 Registry。例如

$canCreate = \Joomla\CMS\Helper\ContentHelper::getActions('com_content')->get('core.create');

类不推荐使用

计划在 Joomla! 6.0 中移除

Filesystem CMS 包

CMS Filesystem 包位于 libraries/src/Filesystem 中,将在 6.0 中完全替换为 Joomla Framework Filesystem 包。CMS 包和 Framework 包几乎可以相互 1 对 1 替换,但是 Framework 包在适当的地方使用异常,而不是 CMS 包使用的旧 setErrorgetError

在大多数情况下,你只需要将命名空间从 Joomla\CMS\Filesystem\* 更改为 Joomla\Filesystem\* 即可。要正确处理错误情况,你将不得不遍历代码并在必要时捕获异常。

  • 文件:libraries/src/Filesystem/File.php
    类:Joomla\CMS\Filesystem\File
    替换:Joomla\Filesystem\File

  • 文件:libraries/src/Filesystem/FilesystemHelper.php
    类:Joomla\CMS\Filesystem\FilesystemHelper
    替换:Joomla\Filesystem\Helper

  • 文件:libraries/src/Filesystem/Folder.php
    类:Joomla\CMS\Filesystem\Folder
    替换:Joomla\Filesystem\Folder

  • 文件:libraries/src/Filesystem/Patcher.php
    类:Joomla\CMS\Filesystem\Patcher
    替换:Joomla\Filesystem\Patcher

  • 文件:libraries/src/Filesystem/Path.php
    类:Joomla\CMS\Filesystem\Path
    替换:Joomla\Filesystem\Path

  • 文件:libraries/src/Filesystem/Stream.php
    类:Joomla\CMS\Filesystem\Stream
    替换:Joomla\Filesystem\Stream

  • 文件:libraries/src/Filesystem/Streams/StreamString.php
    类:Joomla\CMS\Filesystem\Streams\StreamString
    替换:Joomla\Filesystem\Stream\StringWrapper

  • 文件:libraries/src/Filesystem/Support/StringController.php
    类:Joomla\CMS\Filesystem\Support/StringController
    更换:Joomla\Filesystem\Support\StringController