Upgrade to Nextcloud 28
General
info.xml
Make sure your appinfo/info.xml
allows for Nextcloud 28.
<dependencies>
<nextcloud min-version="26" max-version="28" />
</dependencies>
Front-end changes
Added APIs
The new Files initialising much faster than the old one, you will face some race conditions if you register some custom properties loading your scripts by using the
Util::addScript
method. We recommend you use the newUtil::addInitScript
method instead, your script will be loaded right after the common core scripts and right before the Files app. See JavaScript for more information.File actions: to register file actions, please use the dedicated API from https://npmjs.org/@nextcloud/files or https://nextcloud-libraries.github.io/nextcloud-files/functions/registerFileAction.html
New file menu: to register entries in the new file menu, please use the dedicated API from https://npmjs.org/@nextcloud/files or https://nextcloud-libraries.github.io/nextcloud-files/functions/addNewFileMenuEntry.html
Reminder from 27, to interact with the Files app router, use
OCP.Files.Router
. See FilesTo Interact with the Files app data, please use the following events. All of them have a Node object as main parameter.
files:node:created
: the node has been createdfiles:node:deleted
: the node has been deletedfiles:node:moved
: the node has been moved (and its data is already updated)files:node:updated
: the node data has been updated
Changed APIs
tbd
Deprecated APIs
The CSS variables
--color-text-light
and--color-text-lighter
were made aliases of--color-main-text
and--color-text-maxcontrast
in Nextcloud 20 and are now officially deprecated and will be removed in the near future.
Removed APIs
OC.loadScript
andOC.loadStyle
: UseOCP.Loader
instead.OC.appSettings
: There is no replacement.OCA.Files
: Everything removed but Sidebar and Settings. See the Added API section for replacements.
Back-end changes
PHP 8.3
In this release support for PHP 8.3 was added. Follow the steps below to make your app compatible.
If
appinfo/info.xml
has a dependency specification for PHP, increase themax-version
to 8.3.
<dependencies>
<php min-version="8.0" max-version="8.3" />
<nextcloud min-version="26" max-version="28" />
</dependencies>
If your app has a
composer.json
and the file contains the PHP restrictions frominfo.xml
, adjust it as well.
{
"require": {
"php": ">=8.0 <=8.3"
}
}
If you have continuous integration set up, extend your test matrix with PHP 8.3 tests and linters.
Information about code changes can be found on php.net and stitcher.io.
Development dependency hell
Due to the popularity of CLI tools for development of Nextcloud apps, the likelihood of package conflicts has increased. It’s highly recommended to see Development tools and migrate to composer bin directories.
Updated core libraries
If apps use only official public APIs of Nextcloud, the update of core libraries should have little to no effect on apps. However, there are some edge cases where an app still has a code dependency to a library shipped with Nextcloud, e.g. when those 3rdparty classes or functions are used, and therefore app developers are recommended to check their code for any incompatibility. Moreover it’s recommended to check compatibility with sophisticated tools, as documented at the static analysis section.
doctrine/dbal
The Doctrine Database Abstraction Layer powers Nextcloud’s database connection and query builder. In Nextcloud 28, this dependency was updated from 3.3 to 3.7.
Optimistically speaking, the database connection and the query builder should mostly work like in Nextcloud 27 or older. Some (minor) breaking changes were inevitable. Here’s the summary:
When a query builder instance is using positional parameters
->setValue('name', '?')
setParameter(0, $name)
, all parameters need to be set again when executing the query multiple times, e.g. in a loop. It is recommended to switch to named parameters usingcreateParameter()
instead.
The details of this change can also be seen in the pull request on GitHub and in the upstream documentation dbal 3.7.x upgrade document.
symfony/event-dispatcher
Over the last 2 major versions the symfony/event-dispatcher
package first deprecated and then removed the way Nextcloud
server dispatched old events. This means the way we wrapped away symfony’s \Symfony\Component\EventDispatcher\EventDispatcherInterface
as well as using the \Symfony\Component\EventDispatcher\GenericEvent
could not be kept alive in a backwards compatible way.
Therefore migrating from \Symfony\Component\EventDispatcher\EventDispatcherInterface
to \OCP\EventDispatcher\IEventDispatcher
(exists since Nextcloud 17) is required to be compatible with Nextcloud 28.
All code places that dispatched a \Symfony\Component\EventDispatcher\GenericEvent
have been adjusted
and have \OCP\EventDispatcher\Event
based dedicated event now that is dispatched as a typed-event so all available parameters are documented.
The details of this change can also be seen in the todo items that are linked from the pull request on GitHub.
Added APIs
\OCP\AppFramework\Http\EmptyContentSecurityPolicy::useStrictDynamicOnScripts
to set ‘strict-dynamic’ on the ‘script-src-elem’ CSP, this is set by default to true to allow apps using module JS to import dependencies.\OCP\Mail\IMessage::setSubject
to set an email subject. See Email for an example.\OCP\Mail\IMessage::setHtmlBody
and\OCP\Mail\IMessage::setPlainBody
to set an email body See Email for an example.\OCP\IEventSourceFactory
to create aOCP\IEventSource
instance.\OCP\Preview\BeforePreviewFetchedEvent::getCrop
\OCP\Preview\BeforePreviewFetchedEvent::getHeight
\OCP\Preview\BeforePreviewFetchedEvent::getMode
\OCP\Preview\BeforePreviewFetchedEvent::getWidth
\OCP\IPhoneNumberUtil::convertToStandardFormat
to convert input into an E164 formatted phone number. See Phone number util for an example.\OCP\IPhoneNumberUtil::getCountryCodeForRegion
to get the E164 country code for a given region. See Phone number util for an example.\OCP\AppFramework\Http\EmptyContentSecurityPolicy::allowEvalWasm(bool)
: setswasm-unsafe-eval
inscript-src
of the Content Security Policy to allow compilation and execution of WebAssembly on the page\OCP\FilesMetadata\IMetadataBackgroundEvent::getNode
\OCP\FilesMetadata\IMetadataBackgroundEvent::getMetadata
\OCP\FilesMetadata\IMetadataLiveEvent::getNode
\OCP\FilesMetadata\IMetadataLiveEvent::getMetadata
\OCP\FilesMetadata\IMetadataLiveEvent::requestBackgroundJob
\OCP\FilesMetadata\IFilesMetadataManager::refreshMetadata
\OCP\FilesMetadata\IFilesMetadataManager::getMetadata
\OCP\FilesMetadata\IFilesMetadataManager::saveMetadata
\OCP\FilesMetadata\IFilesMetadataManager::deleteMetadata
\OCP\FilesMetadata\IFilesMetadataManager::getMetadataQuery
\OCP\FilesMetadata\IFilesMetadataManager::getKnownMetadata
\OCP\FilesMetadata\IFilesMetadataManager::initMetadata
\OCP\FilesMetadata\IMetadataQuery::retrieveMetadata
\OCP\FilesMetadata\IMetadataQuery::extractMetadata
\OCP\FilesMetadata\IMetadataQuery::joinIndex
\OCP\FilesMetadata\IMetadataQuery::getMetadataKeyField
\OCP\FilesMetadata\IMetadataQuery::getMetadataValueField
wasm-unsafe-eval
is supported by most browsersWebAssembly compilation and execution in worker threads is not affected by this directive (browsers allow compilation and execution of WebAssembly in worker threads by default)
OCP\Authentication\Token\IProvider::getToken
to get a token by its token string idOCP\Authentication\Token\IToken
public interface for tokens returned by the function above. Please use those instead of things fromOC
namespace.OCP\User\Backend\IProvideEnabledStateBackend
for user backends that wants to alter disabled state of users (used by user_ldap to mark remnants as disabled if the option is enabled).
Changed APIs
\OCP\Preview\BeforePreviewFetchedEvent
now accepts:width, height, crop and mode
as optional constructor arguments.Interface
\OCP\Files\Folder
got a new method:searchBySystemTag(string $tagName, string $userId, int $limit = 0, int $offset = 0)
.OCP\SystemTag\ISystemTagManager::getTagsByIds()
now optionally accepts IUser as second parameter, to only retrieve system tags visible to that user.
Deprecated APIs
\OCP\DB\IResult::fetch
: use the newfetchAssociative
,fetchNumeric
andfetchOne
instead. If you calledfetch
without arguments,fetchAssociative
is the direct replacement. Beware that the new methods throw a different exception.\OCP\DB\IResult::fetchAll
: use the newfetchAllAssociative
,fetchAllNumeric
andfetchOne
instead. If you calledfetchAll
without arguments,fetchAllAssociative
is the direct replacement. Beware that the new methods throw a different exception.\OCP\Preview\BeforePreviewFetchedEvent
passingnull
forwidth, height, crop or mode
is deprecated. Starting with Nextcloud 31 they are mandatory.
Removed APIs
\OC_App::getAppVersion
: inject\OCP\App\IAppManager
and call\OCP\App\IAppManager::getAppVersion
.\OC_App::getAppInfo
: inject\OCP\App\IAppManager
and call\OCP\App\IAppManager::getAppInfo
.\OC_App::getNavigation
: inject\OCP\App\IAppManager
and call\OCP\App\IAppManager::getAll
.\OC_App::getSettingsNavigation
: inject\OCP\App\IAppManager
and call\OCP\App\IAppManager::getAll('settings')
.\OC_App::isEnabled
: inject\OCP\App\IAppManager
and call\OCP\App\IAppManager::isEnabledForUser
.\OC_Defaults::getLogoClaim
: there is no replacement.\OCP\Util::linkToPublic
: there is no replacement.\OC_Defaults::getLogoClaim
: There is no replacement.\OC::$server->createEventSource()
has been removed, use\OCP\Server::get(\OCP\IEventSourceFactory::class)->create()
instead.\OCP\Util::writeLog
has been removed, use\OCP\Server::get(LoggerInterface::class)->…
instead.
The factory \OCP\IEventSourceFactory
works only from Nextcloud 28.
For older versions use \OC::$server->createEventSource()
.
If you want to support Nextcloud 27 and Nextcloud 28:
// @TODO: Remove method_exists when min-version="28"
if (method_exists(\OC::$server, 'createEventSource')) {
$eventSource = \OC::$server->createEventSource();
} else {
$eventSource = \OCP\Server::get(IEventSourceFactory::class)->create();
}
Added events
Typed event
OCA\DAV\Events\SabrePluginAddEvent
was addedTyped event
OCP\Accounts\UserUpdatedEvent
was addedTyped event
OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed
was addedTyped event
OCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed
was addedTyped event
OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered
was addedTyped event
OCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered
was addedTyped event
OCP\Authentication\TwoFactorAuth\TwoFactorProviderUserDeleted
was addedTyped event
OCP\Comments\CommentsEntityEvent
was addedTyped event
OCP\DB\Events\AddMissingColumnsEvent
to add missing indices to the database schema.Typed event
OCP\DB\Events\AddMissingIndicesEvent
to add missing indices to the database schema.Typed event
OCP\DB\Events\AddMissingPrimaryKeyEvent
to add missing indices to the database schema.Typed event
OCP\Files\Events\NodeAddedToFavorite
was addedTyped event
OCP\Files\Events\NodeRemovedFromFavorite
was addedTyped event
OCP\FilesMetadata\Event\MetadataBackgroundEvent
was addedTyped event
OCP\FilesMetadata\Event\MetadataLiveEvent
was addedTyped event
OCP\Share\Events\BeforeShareCreatedEvent
was addedTyped event
OCP\Share\Events\BeforeShareDeletedEvent
was addedTyped event
OCP\Share\Events\ShareAcceptedEvent
was addedTyped event
OCP\Share\Events\ShareDeletedFromSelfEvent
was addedTyped event
OCP\SystemTag\SystemTagsEntityEvent
was addedTyped event
OCP\User\Events\UserFirstTimeLoggedInEvent
was added
Deprecated events
OC\Console\Application::run
was deprecated. Listen to the typed eventOCP\Console\ConsoleEvent
insteadOCA\DAV\Connector\Sabre::addPlugin
was deprecated. Listen to the typed eventOCA\DAV\Events\SabrePluginAddEvent
insteadOCA\Files_Trashbin::moveToTrash
was deprecated. Listen to the typed eventOCA\Files_Trashbin\Events\MoveToTrashEvent
insteadOCA\Files_Trashbin::moveToTrash
was deprecated. Listen to the typed eventOCA\Files_Trashbin\Events\MoveToTrashEvent
insteadOCP\Console\ConsoleEvent::EVENT_RUN
was deprecated. Listen to the typed eventOCP\Console\ConsoleEvent
insteadOCP\Authentication\TwoFactorAuth\RegistryEvent
was deprecated. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered
andOCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered
insteadOCP\Authentication\TwoFactorAuth\IRegistry::enable
was deprecated. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserRegistered
insteadOCP\Authentication\TwoFactorAuth\IRegistry::disable
was deprecated. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserUnregistered
insteadOCP\Authentication\TwoFactorAuth\TwoFactorProviderDisabled
was deprecated. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderUserDeleted
insteadOCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserDisabled
was deprecated. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed
insteadOCP\Authentication\TwoFactorAuth\TwoFactorProviderForUserEnabled
was deprecated. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed
insteadOCP\Comments\CommentsEntityEvent::EVENT_ENTITY
was deprecated. Listen to the typed eventOCP\Comments\CommentsEntityEvent
insteadOCP\Comments\ICommentsManager::registerEntity
was deprecated. Listen to the typed eventOCP\Comments\CommentsEntityEvent
insteadOCP\SystemTag\ISystemTagManager::registerEntity
was deprecated. Listen to the typed eventOCP\SystemTag\SystemTagsEntityEvent
insteadOCP\SystemTag\SystemTagsEntityEvent::EVENT_ENTITY
was deprecated. Listen to the typed eventOCP\SystemTag\SystemTagsEntityEvent
insteadOCP\IUser::firstLogin
was deprecated. Listen to the typed eventOCP\User\Events\UserFirstTimeLoggedInEvent
instead
Removed events
OC\AccountManager::userUpdated
was removed. Listen to the typed eventOCP\Accounts\UserUpdatedEvent
insteadOCA\Files::loadAdditionalScripts
was removed. Listen to the typed eventOCA\Files\Event\LoadAdditionalScriptsEvent
insteadOCA\Files\Service\TagService::addFavorite
was removed. Listen to the typed eventOCP\Files\Events\NodeAddedToFavorite
insteadOCA\Files\Service\TagService::removeFavorite
was removed. Listen to the typed eventOCP\Files\Events\NodeRemovedFromFavorite
insteadOCA\Files_Sharing::loadAdditionalScripts
was removed. Listen to the typed eventOCA\Files_Sharing\Event\BeforeTemplateRenderedEvent
insteadOCP\AppFramework\Http\TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS
(deprecated since 20) was removed. Listen to the typed eventOCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent
insteadOCP\AppFramework\Http\TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN
(deprecated since 20) was removed. Listen to the typed eventOCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent
insteadOCP\AppFramework\Http\TemplateResponse::loadAdditionalScripts
(deprecated since 20) was removed. Listen to the typed eventOCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent
insteadOCP\AppFramework\Http\TemplateResponse::loadAdditionalScriptsLoggedIn
(deprecated since 20) was removed. Listen to the typed eventOCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent
insteadOCP\Authentication\TwoFactorAuth\IProvider::EVENT_SUCCESS
(deprecated since 22) was removed. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed
insteadOCP\Authentication\TwoFactorAuth\IProvider::EVENT_FAILED
(deprecated since 22) was removed. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed
insteadOCP\Authentication\TwoFactorAuth\IProvider::failed
(deprecated since 22) was removed. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengeFailed
insteadOCP\Authentication\TwoFactorAuth\IProvider::success
(deprecated since 22) was removed. Listen to the typed eventOCP\Authentication\TwoFactorAuth\TwoFactorProviderChallengePassed
insteadOCP\IDBConnection::ADD_MISSING_COLUMNS
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingColumnsEvent
insteadOCP\IDBConnection::ADD_MISSING_INDEXES
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingIndicesEvent
insteadOCP\IDBConnection::ADD_MISSING_PRIMARY_KEYS
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingPrimaryKeyEvent
insteadOCP\IDBConnection::CHECK_MISSING_COLUMNS
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingColumnsEvent
insteadOCP\IDBConnection::CHECK_MISSING_COLUMNS_EVENT
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingColumnsEvent
insteadOCP\IDBConnection::CHECK_MISSING_INDEXES
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingIndicesEvent
insteadOCP\IDBConnection::CHECK_MISSING_INDEXES_EVENT
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingIndicesEvent
insteadOCP\IDBConnection::CHECK_MISSING_PRIMARY_KEYS
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingPrimaryKeyEvent
insteadOCP\IDBConnection::CHECK_MISSING_PRIMARY_KEYS_EVENT
(deprecated since 22) was removed. Listen to the typed eventOCP\DB\Events\AddMissingPrimaryKeyEvent
insteadOCP\IGroup::postAddUser
was removed. Listen to the typed eventOCP\Group\Events\UserAddedEvent
insteadOCP\IGroup::postDelete
was removed. Listen to the typed eventOCP\Group\Events\GroupDeletedEvent
insteadOCP\IGroup::postRemoveUser
was removed. Listen to the typed eventOCP\Group\Events\UserRemovedEvent
insteadOCP\IGroup::preAddUser
was removed. Listen to the typed eventOCP\Group\Events\BeforeUserAddedEvent
insteadOCP\IGroup::preDelete
was removed. Listen to the typed eventOCP\Group\Events\BeforeGroupDeletedEvent
insteadOCP\IGroup::preRemoveUser
was removed. Listen to the typed eventOCP\Group\Events\BeforeUserRemovedEvent
insteadOCP\IPreview::EVENT
(deprecated since 22) was removed. Listen to the typed eventOCP\Preview\BeforePreviewFetchedEvent
insteadOCP\IPreview:PreviewRequested
(deprecated since 22) was removed. Listen to the typed eventOCP\Preview\BeforePreviewFetchedEvent
insteadOCP\IUser::changeUser
was removed. Listen to the typed eventOCP\User\Events\UserChangedEvent
insteadOCP\IUser::postDelete
(deprecated since 17) was removed. Listen to the typed eventOCP\User\Events\UserDeletedEvent
insteadOCP\IUser::postSetPassword
was removed. Listen to the typed eventOCP\User\Events\PasswordUpdatedEvent
insteadOCP\IUser::preDelete
(deprecated since 17) was removed. Listen to the typed eventOCP\User\Events\BeforeUserDeletedEvent
insteadOCP\IUser::preSetPassword
was removed. Listen to the typed eventOCP\User\Events\BeforePasswordUpdatedEvent
insteadOCP\Share::preShare
was removed. Listen to the typed eventOCP\Share\Events\BeforeShareCreatedEvent
insteadOCP\Share::preUnshare
was removed. Listen to the typed eventOCP\Share\Events\BeforeShareDeletedEvent
insteadOCP\Share::postAcceptShare
was removed. Listen to the typed eventOCP\Share\Events\ShareAcceptedEvent
insteadOCP\Share::postShare
was removed. Listen to the typed eventOCP\Share\Events\ShareCreatedEvent
insteadOCP\Share::postUnshare
was removed. Listen to the typed eventOCP\Share\Events\ShareDeletedEvent
insteadOCP\Share::postUnshareFromSelf
was removed. Listen to the typed eventOCP\Share\Events\ShareDeletedFromSelfEvent
insteadOCP\WorkflowEngine::registerChecks
(deprecated since 17) was removed. Listen to the typed eventOCP\WorkflowEngine\Events\RegisterChecksEvent
insteadOCP\WorkflowEngine::registerEntities
(deprecated since 17) was removed. Listen to the typed eventOCP\WorkflowEngine\Events\RegisterEntitiesEvent
insteadOCP\WorkflowEngine::registerOperations
(deprecated since 17) was removed. Listen to the typed eventOCP\WorkflowEngine\Events\RegisterOperationsEvent
instead\OCP\Collaboration\Resources::loadAdditionalScripts
was removed. Listen to the typed eventOCP\Collaboration\Resources\LoadAdditionalScriptsEvent
instead
Removed WebDAV properties
<nc:file-metadata-size>
<nc:file-metadata-gps>