From 6ad7941e5de95f2c0a8a074cd6701359a0662689 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Wed, 7 Jun 2023 21:12:05 +0200 Subject: [PATCH] fix(devmanual): Roll back recommendation for authoritative class maps Signed-off-by: Christoph Wurst --- .../app_upgrade_guide/upgrade_to_27.rst | 5 +++++ developer_manual/digging_deeper/classloader.rst | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_27.rst b/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_27.rst index d2139ba22..333143200 100644 --- a/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_27.rst +++ b/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_27.rst @@ -30,6 +30,11 @@ Added APIs Back-end changes ---------------- +Optimized class loader +^^^^^^^^^^^^^^^^^^^^^^ + +This documentation previously recommended using any composer class loader optimization in :ref:`app-custom-classloader`. Unfortunately authoritative class maps do not work with the upgrade process of Nextcloud apps. When app code is replaced during an app upgrade, the autoloader has to load *new* classes as well. Authoritative class loaders don't do that by design. Use the simple class map optimization only. + Removal of PSR-0 class loader ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/developer_manual/digging_deeper/classloader.rst b/developer_manual/digging_deeper/classloader.rst index d0d71a2ab..063c0fcc0 100644 --- a/developer_manual/digging_deeper/classloader.rst +++ b/developer_manual/digging_deeper/classloader.rst @@ -42,7 +42,7 @@ Replacing Nextcloud's autoloader Nextcloud's autoloader for apps is flexible and robust but not always the fastest. You can improve the loading speed of your app by shipping and optimizing a Composer class loader with the app. -First of all, familiarize yourself with the `Composer autoloader optimization options `_ and how they work. (Authoritative) class maps are a good fit for Nextcloud apps. +First of all, familiarize yourself with the `Composer autoloader optimization options `_ and how they work. Only level 1 optimization is suited for Nextcloud because authoritative class maps break upgrade processes where code is replaced dynamically and APCu is not a required extension. Once Composer is set up and class maps have been dumped, you can replace the generic Nextcloud class loader with the Composer class loader. This is done by placing a file at `composer/autoload.php`. If Nextcloud finds this file for an app, no generic class loader will be registered. The following contents will wire the file to Composer's generated ``autoloader.php`` file: