e-alfred / epubreader

EPUB/CBR/PDF reader app for Nextcloud
GNU Affero General Public License v3.0
81 stars 21 forks source link

NC22 server error #36

Closed psjbeisler closed 3 years ago

psjbeisler commented 3 years ago

Updated from NC21 to NC22 and could not log in due to 500 errors

"version":"22.0.0.11","exception":{"Exception":"Error","Message":"Class 'OCP\\User' not found","Code":0,"Trace":[{"file":"/var/www/html/custom_apps/epubreader/lib/Hooks.php","line":41,"function":"get","class":"OCA\\Epubreader\\Config","type":"::","args":["epub_enable","true"]}

had to

occ app:disable epubreader

https://github.com/nextcloud/server/issues/26407

human-blip commented 3 years ago

Two instances of \OCP\User in lib/config.php

do they need to be replaced? - as per https://nextcloud-server.netlify.app/classes/ocp-user#method_getUser

pbek commented 3 years ago

Any news on this? 😸

voyageur commented 3 years ago

I can send a PR in a few days (my main system is off for a few days), but changing these 2 instances in lib/config.php is indeed enough for me:

diff -Naur epubreader.git/lib/config.php epubreader/lib/config.php
--- epubreader.git/lib/config.php   2021-08-02 11:36:25.073961784 +0200
+++ epubreader/lib/config.php   2021-07-06 14:43:30.407356502 +0200
@@ -25,7 +25,7 @@
     * @return string retrieved value or default
     */
    public static function get($key, $default) {
-       return \OC::$server->getConfig()->getUserValue(\OCP\User::getUser(), 'epubreader', $key, $default);
+       return \OC::$server->getConfig()->getUserValue(\OC_User::getUser(), 'epubreader', $key, $default);
    }

    /**
@@ -36,7 +36,7 @@
     * @return bool success
     */
    public static function set($key, $value) {
-       return \OC::$server->getConfig()->setUserValue(\OCP\User::getUser(), 'epubreader', $key, $value);
+       return \OC::$server->getConfig()->setUserValue(\OC_User::getUser(), 'epubreader', $key, $value);
    }

    /**
Goddard commented 3 years ago

yeah couldn't install because of the error.