Upgrade to Nextcloud 32
General
A new
tests/autoload.phpfile was added to server repository, that you can include in your appbootstrap.phpfile for tests, to be able to load the core\Test\TestCaseclass. You should remove any call to\OC::$loaderin your code as this legacy loader is being removed. This new file is backported to branches stable31, stable30 and stable29, so if your application supports multiple Nextcloud major versions it should still work.
Front-end changes
Status colors are now based on secondary styling
The status colors like error, success or warning are now based on the secondary style rather than the primary style.
This means they are now much lighter and thus cannot be used for usage such as text or border colors.
To mitigate this following new CSS variables are introduced:
--color-text-errorfor text that needs error highlight on normal background colors.--color-text-successfor text that needs success highlight on normal background colors.--color-border-errorto be used as border color for elements having an error state such as input elements with failing validity.--color-border-successto be used as border color for elements having a success state such as an input was saved or similar.
Please note that there are no text and border variants for warning and info as we design wise discourage them on text and borders.
Additionally as sometimes elements need a status color with proper contrast we now provide following variables for status elements like icons:
--color-element-error--color-element-info--color-element-success--color-element-warning
This existing variables have changed to a secondary style:
--color-errorto be used as the background color of error style elements (like error state button or note-card).--color-error-hoverto be used as the background color of such elements on hover.--color-error-textto be used as the foreground color of such elements.Same applies to
--color-info,--color-success,--color-warningand their variants.
Icons should be outlined
When using Material Icons, use the outlined variant where possible. Exceptions to this are app icons themselves, file type icons, as well as icons that were already a single line, such as the plus or checkmark icons. Reasoning and more details are in the issue.
Added APIs
TBD
Changed APIs
TBD
Deprecated APIs
--color-error-rgb,--color-info-rgb,--color-success-rgb,--color-warning-rgbare deprecated. Instead use the native CSS color utils with the the existing variables like--color-errorand similar.The
OC.SystemTagsapi is deprecated. If you need to get the list of system tags, check this merge request for how to fetch the tags directly.
Removed APIs
TBD
Back-end changes
OCP API split into consumable and implementable: For a more informed background see RFC: Split OCP into Consumable and Implementable for more information. Short summary:
Consumable: Interfaces, Enums and classes that have the
OCP\AppFramework\Attribute\Consumableattribute, must only be consumed by apps and can not be implemented by apps themselves. This means the server side can extend the interface with new methods or reduce returned types of existing methods without it being consider an API break. However argument types of existing methods can not be reduced. Same rules apply toOCP\EventsDispatcher\Eventthat have theOCP\AppFramework\Attribute\Listenableattribute andExceptionwith theOCP\AppFramework\Attribute\Catchableattribute.Implementable: Interfaces, Enums and classes that have the
OCP\AppFramework\Attribute\Implementableattribute, can be implemented by apps. This means the server side can not extend the interface with new methods or reduce returned types of existing methods without it being consider an API break. However argument types of existing methods can be reduced. Same rules apply toOCP\EventsDispatcher\Eventthat have theOCP\AppFramework\Attribute\Dispatchableattribute andExceptionwith theOCP\AppFramework\Attribute\Throwableattribute.ExceptionalImplementable: Despite not being implementable for all apps, some interfaces can have the
OCP\AppFramework\Attribute\ExceptionalImplementableattribute indicating that they are implementable by a single app (or multiple). In those cases the generalOCP\AppFramework\Attribute\Consumablerules apply, but the app maintainers or repository of named exceptions have to be informed during the process of a pull request, leaving them enough time to align with the upcoming change.
These new attributes will be applied on a “defacto standard” basis to the best of our knowledge. In case an API was flagged unexpectedly, leave a comment on the respective pull request in the server repository asking for clarification.
Added Events
New
preloadCollectionevent emitted by the DAV server during PROPFIND requests. See WebDAV collection preload events for details.New
OCP\SystemTag\TagAssignedEventemitted by the system tag object mapperNew
OCP\SystemTag\TagUnassignedEventemitted by the system tag object mapper
Added APIs
New
OCP\ContextChatAPI. See Context Chat for details.New interface
\OCP\OCM\ICapabilityAwareOCMProviderto extend the OCM provider with 1.1 and 1.2 extensions of the Open Cloud Mesh Discovery APINew interface
\OCP\Search\IExternalProviderallows extending the search provider with an explicit flag to indicate that the search is performed on external (3rd-party) resources. This is used in Unified Search to disable searches through these by default (via a toggle switch).New interface
\OCP\Share\IShareProviderSupportsAllSharesInFolderextending\OCP\Share\IShareProviderto add the method\OCP\Share\IShareProviderSupportsAllSharesInFolder::getAllSharesInFolderused for querying all shares in a folder without filtering by user.New interface
\OCP\Notification\IPreloadableNotifierto allow notifier implementations to preload and cache data for many notifications at once to improve performance by, for example, bundling SQL queries.New interface
\OCP\Template\ITemplateManagerto access template related functions, and get instances of new interface\OCP\Template\ITemplateinstead of building manually\OCP\Template.New attribute
\OCP\AppFramework\Http\Attribute\RequestHeaderused for documenting request headers for OpenAPI specifications generated using openapi-extractor.New event
\OCP\Files\Config\Event\UserMountAddedEventwhich is emitted when new mount is added to theoc_mountstable.New event
\OCP\Files\Config\Event\UserMountRemovedEventwhich is emitted when an existing mount is removed from theoc_mountstable.New event
\OCP\Files\Config\Event\UserMountUpdatedEventwhich is emitted when an existing mount is updated in theoc_mountstable.New method
\OCA\Files\Controller\TemplateController::listTemplateFieldsto list the fields of a template, accessible at/ocs/v2.php/apps/files/api/v1/templates/fields/{fileId}.New method
\OCP\Files\IFilenameValidator::sanitizeFilenameallowing to sanitize a given filename to comply with configured constraints.New method
\OCP\Files\Template\ITemplateManager::listTemplateFieldsto allow listing the fields of a template.New method
\OCP\Files\Template\BeforeGetTemplatesEvent::shouldGetFieldsto get the event’swithFieldsproperty, which should determine whether or not to perform template field extraction on the returned templates.New method
\OCP\IUser::canChangeEmailallowing to check if the user backend allows the user to change their email address.New method
\OCP\IDateTimeZone::getDefaultTimezoneallowing to get the default timezone configured for Nextcloud.New
OCP\SystemTag\TagAssignedEventemitted by the system tag object mapperNew
OCP\SystemTag\TagUnassignedEventemitted by the system tag object mapperTask processing API:
New task processing task type
OCP\TaskProcessing\TextToSpeechto convert text to speech.New task processing task type
OCP\TaskProcessing\AnalyzeImagesto ask questions about images.New method
OCP\TaskProcessing\Manager::getAvailableTaskTypeIdsto list only task type IDs without meta-data (faster thanOCP\TaskProcessing\Manager::getAvailableTaskTypes)
New
OCP\Mail\IEmailValidatorto validate an email address.
Changed APIs
\OCP\Authentication\TwoFactorAuth\ILoginSetupProvider::getBody,\OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings::getBodyand\OCP\Authentication\TwoFactorAuth\IProvider::getBodyreturn type was broaden from\OCP\Templateclass to\OCP\Template\ITemplateinterface. Should not change anything for applications.\OCP\Files\Template\BeforeGetTemplatesEventnow takes an optional boolean constructor value,withFields, that allows you to explicitly control whether template fields should be extracted. The default value isfalse.\OCP\IDateTimeZone::getTimezonenow has a new optional string parameteruserIdallowing to request the timezone of another user than the current.\OCP\IDBConnection::getDatabaseProvidernow has a new optional boolean parameterstrict. When specified the output will differentiate between MySQL and MariaDB. Otherwise MariaDB will be returned as MySQL
Deprecated APIs
The files API endpoint
/apps/files/api/v1/thumbnail/for generating previews is deprecated. Instead use the preview endpoint provided by Nextcloud core (/core/preview).The legacy method
\OC_Helper::canExecuteis deprecated, please use theOCP\IBinaryFinderinstead.\OC_Templateand\OCP\Templateclasses are deprecated, please use the new\OCP\Template\ITemplateManagerinstead.\OC_User::useBackendis deprecated, please use\OCP\IUserManager::registerBackendavailable since 8.0.0\OC_User::clearBackendsis deprecated, please use\OCP\IUserManager::clearBackendsavailable since 8.0.0\OC_Helper::isReadOnlyConfigEnabledis deprecated, please use theconfig_is_read_onlysystem config directly.\OCP\OCM\IOCMProvideris deprecated, please use\OCP\OCM\ICapabilityAwareOCMProvideravailable since 32.0.0\OCP\Mail\IMailer::validateMailAddressis deprecated, please use\OCP\Mail\IEmailValidatoravailable since 32.0.0
Removed APIs
The
scssphppackage is no longer shipped with Nextcloud. This package was not used and deprecated since Nextcloud 22. If you need the package for your app, then you need to ship it yourself.\OCP\Files::getStorageand the legacyOC_App_::getStoragemethods were deprecated since Nextcloud 14, respective Nextcloud 5, and were now removed. Instead use\OCP\Files\IAppData.\OCP\AppFramework\App::registerRoutes(deprecated in Nextcloud 20) was removed. Instead return the routes as an array from your routes.php or use route attributes.The legacy visibility constants of
OCP\Accounts\IAccountManager,VISIBILITY_PRIVATE,VISIBILITY_CONTACTS_ONLY,VISIBILITY_PUBLIC, were deprecated since Nextcloud 21 and are now removed. Instead only the v2 visibility constants can be used.Removed deprecated methods of legacy
\OC_Helperclass:humanFileSizewas deprecated since version 4.0.0 and replaced with\OCP\Util::humanFileSizecomputerFileSizewas deprecated since version 4.0.0 and replaced with\OCP\Util::computerFileSizemb_array_change_key_casewas deprecated since version 4.5.0 and replaced with\OCP\Util::mb_array_change_key_caserecursiveArraySearchwas deprecated since version 4.5.0 and replaced with\OCP\Util::recursiveArraySearchrmdirrwas deprecated since version 5.0.0 and replaced with\OCP\Files::rmdirrmaxUploadFilesizewas deprecated since version 5.0.0 and replaced with\OCP\Util::maxUploadFilesizefreeSpacewas deprecated since version 7.0.0 and replaced with\OCP\Util::freeSpaceuploadLimitwas deprecated since version 7.0.0 and replaced with\OCP\Util::uploadLimit
Removed deprecated methods of legacy
\OC_Utilclass:addScriptwas replaced by\OCP\Util::addScriptin 24addVendorScriptwas unused and removedaddTranslationswas replace by\OCP\Util::addTranslationsin 24
Template function
vendor_scriptwas unused and removedThe support for
app.phpfiles, deprecated since Nextcloud 19, was removed. Existence of the file is still checked to show an error if present, but that will be removed in a later version. Please move toOCP\AppFramework\Bootstrap\IBoostrapinstead.The following getters, deprecated since 20, were removed. Please use Dependency Injection or
\OCP\Server::getinstead:IServerContainer::getAppConfig()IServerContainer::getAvatarManager()IServerContainer::getCalendarManager()IServerContainer::getCalendarResourceBackendManager()IServerContainer::getCalendarRoomBackendManager()IServerContainer::getCloudFederationFactory()IServerContainer::getCloudFederationProviderManager()IServerContainer::getCommandBus()IServerContainer::getCommentsManager()IServerContainer::getContentSecurityPolicyManager()IServerContainer::getCredentialsManager()IServerContainer::getDateTimeFormatter()IServerContainer::getDateTimeZone()IServerContainer::getEncryptionKeyStorage()IServerContainer::getEventLogger()IServerContainer::getGlobalScaleConfig()IServerContainer::getHTTPClientService()IServerContainer::getIniWrapper()IServerContainer::getLogFactory()IServerContainer::getMountManager()IServerContainer::getMountProviderCollection()IServerContainer::getNavigationManager()IServerContainer::getPreviewManager()IServerContainer::getQueryLogger()IServerContainer::getRemoteApiFactory()IServerContainer::getRemoteInstanceFactory()IServerContainer::getRouter()IServerContainer::getShareManager()IServerContainer::getStorageFactory()IServerContainer::getSystemTagManager()IServerContainer::getSystemTagObjectMapper()IServerContainer::getTagManager()