nextcloud-metadata
nextcloud-metadata copied to clipboard
Small Bug app.php deprecated error message
Hey there,
Just doing some maintenance and trying to clear my NC error log. I noticed that your app leaves this error message in my log:
{"reqId":"Yp5jDSRvIDQU4afxJvGeCgAARhY","level":0,"time":"June 06, 2022 20:26:53","remoteAddr":"192.168.61.1","user":"fathertimetest","app":"metadata","method":"PUT","url":"/index.php/apps/user_status/heartbeat","message":"/appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36","version":"24.0.1.1"}
I am on NC24, Ubuntu 20.04, running php7.4-fpm
Hi! Thanks for the information, I'll take a look, though removal of app.php will break compatibility with older NC versions, so I need to check when it was deprecated and how it's better to proceed.
[…] removal of app.php will break compatibility with older NC versions […]
Maybe it's possible to call a method from your Application class in app.php
only if Nextcloud version is <=19?
Reference: https://docs.nextcloud.com/server/latest/developer_manual/app_development/bootstrap.html
My reading of https://help.nextcloud.com/t/app-files-sharing-message-migrate-everything-from-app-php-to-the-application-class/130570 is that maybe you don't have to check for the server version, because:
/appinfo/app.php is not loaded when \OCP\AppFramework\Bootstrap\IBootstrap on the application class is used.
@bencomp but Nextcloud will log that message, and that would be annoying as well? Really need to test 😟
Actually, "level":0
should mean Debug level message. What loglevel
do you have in your config.php
? With the default 2
I don't seem to have such messages.
Oh, I see. It looks like that is even an error, not just a debug message. The app development documentation about the bootstrap process is unclear about providing support for Nextcloud 19 and 20(+) in the same version of an app.
I am clearly not a Nextcloud app developer; I just recently noticed that most log messages in my Nextcloud log are about the deprecation of using appinfo/app.php
, similar to the issue author described. (I also see it in the Draw.io app, like https://github.com/pawelrojek/nextcloud-drawio/issues/185 – each request produces two debug messages about this deprecation, one for each app.)
Of course, I could increase the log level to make such messages go away, but I figured there is a reason for them.
Wondering how other apps support Nextcloud 19 and up with the same app version, I found that the Cookbook app checks the server version when constructing the Application
class: https://github.com/nextcloud/cookbook/blob/v0.9.13/lib/AppInfo/Application.php
It doesn't look great to do it like this, to me at least. Several other apps require upgrading to Nextcloud 20 or later for their apps to receive updates. I don't know if dropping support for older Nextcloud versions is the only way forward for app developers...
Thanks for the detailed information, I'll take a look.
@gino0631 app.php can be removed without any issues. I have tried it on my local machine and your app continues to work for any modern, supported Nextcloud versions.
@derritter88 and on not-so-modern, or even ownCloud?
@derritter88 and on not-so-modern, or even ownCloud?
All Nextcloud versions which are still in support (https://nextcloud.com/changelog/) do use successor of app.php which is deprecated for them.
Owncloud is out of my personal scope as I do not use it.
@gino0631 are there any updates on this? The messages are generating a lot of noises on my nextcloud log
@flo-mic not at the moment, but the issue will be resolved in the next release.