owncloud-apps icon indicating copy to clipboard operation
owncloud-apps copied to clipboard

Fix deprecated calls in files_reader app

Open e-alfred opened this issue 6 years ago • 24 comments

Hello,

I fixed up the deprecated OCP\JSON and OCP\Config calls for Nextcloud 14+.

e-alfred avatar Sep 27 '18 13:09 e-alfred

Hmm … now I have problem with OPDS.

Internal server error → https://github.com/Yetangitu/owncloud-apps/tree/cf484a2ab4a77c350be63522cd03bb8e7fd76074/files_reader

Błąd wewnętrzny serwera
Serwer nie był w stanie dokończyć Twojego żądania.

Jeśli to się powtórzy, wyślij proszę szczegóły techniczne administratorowi serwera.

Więcej szczegółów można znaleźć w logu serwera.

Szczegóły techniczne
Adres zdalny: my ip
ID żądania: kHDtPoAPvyQwwtDJx2RK
Typ: Error
Kod: 0
Komunikat: Class 'OCP\Config' not found
Plik: /usr/home/www/nextcloud/public_html/apps/files_opds/lib/config.php
Linia: 28

Ślad
#0 /usr/home/www/nextcloud/public_html/apps/files_opds/personal.php(20): OCA\Files_Opds\Config::get('enable', false)
#1 /usr/home/www/nextcloud/public_html/lib/private/legacy/app.php(622): include('/usr/home/onlin...')
#2 /usr/home/www/nextcloud/public_html/lib/private/Settings/Manager.php(365): OC_App::getForms('personal')
#3 /usr/home/www/nextcloud/public_html/settings/Controller/CommonSettingsTrait.php(93): OC\Settings\Manager->getPersonalSections()
#4 /usr/home/www/nextcloud/public_html/settings/Controller/CommonSettingsTrait.php(46): OC\Settings\Controller\PersonalSettingsController->formatPersonalSections('personal', 'personal-info')
#5 /usr/home/www/nextcloud/public_html/settings/Controller/CommonSettingsTrait.php(125): OC\Settings\Controller\PersonalSettingsController->getNavigationParameters('personal', 'personal-info')
#6 /usr/home/www/nextcloud/public_html/settings/Controller/PersonalSettingsController.php(57): OC\Settings\Controller\PersonalSettingsController->getIndexResponse('personal', 'personal-info')
#7 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/Http/Dispatcher.php(166): OC\Settings\Controller\PersonalSettingsController->index('personal-info')
#8 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/Http/Dispatcher.php(99): OC\AppFramework\Http\Dispatcher->executeController(Object(OC\Settings\Controller\PersonalSettingsController), 'index')
#9 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/App.php(118): OC\AppFramework\Http\Dispatcher->dispatch(Object(OC\Settings\Controller\PersonalSettingsController), 'index')
#10 /usr/home/www/nextcloud/public_html/lib/private/AppFramework/Routing/RouteActionHandler.php(47): OC\AppFramework\App::main('OC\\Settings\\Con...', 'index', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#11 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
#12 /usr/home/www/nextcloud/public_html/lib/private/Route/Router.php(297): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
#13 /usr/home/www/nextcloud/public_html/lib/base.php(987): OC\Route\Router->match('/settings/user')
#14 /usr/home/www/nextcloud/public_html/index.php(42): OC::handleRequest()
#15 {main}

Of course without fixed files_reader OPDS works. For info.

onliniak avatar Oct 04 '18 17:10 onliniak

I'm getting this error with these commits: ArgumentCountError: Too few arguments to function OCP\Util::connectHook(), 3 passed in /srv/http/nextcloud/apps/files_reader/lib/Hooks.php on line 22 and exactly 4 expected

I think this is the relevant section of Hooks.php: class Hooks {

20
21     public static function register() {
22         Util::connectHook('js', 'OCA\Files_Reader\Hooks', 'announce_settings');
23
24         \OC::$server->getRootFolder()->listen('\OC\Files', 'preDelete', function (Node $node) {
25             $fileId = $node->getId();
26             $connection = \OC::$server->getDatabaseConnection();
27             self::deleteFile($connection, $fileId);
28         });
29         \OC::$server->getUserManager()->listen('\OC\User', 'preDelete', function (User $user) {
30             $userId = $user->getUID();
31             $connection = \OC::$server->getDatabaseConnection();
32             self::deleteUser($connection, $userId);
33         });
34     }
35

scurrvy2020 avatar Oct 07 '18 02:10 scurrvy2020

@onliniak @scurrvy2020 I've managed to get this to work, you can get my version here: https://github.com/manvalls/owncloud-apps/blob/master/dist/files_reader-1.2.3-patched-4-NC.tar.gz?raw=true https://github.com/manvalls/owncloud-apps/blob/master/dist/files_opds-1.2.3-patched-4-NC.tar.gz?raw=true

Related code: https://github.com/manvalls/owncloud-apps/commit/8bdd623ca431d4c43148e2fb6abb5928e1d34d3c

manvalls avatar Oct 07 '18 15:10 manvalls

@manvalls Sorry, but files_opds still seems to have a problem. When I try to enter settings as admin I'm getting:

Error: Call to undefined method OCP\User::getDisplayName()

thomas2403 avatar Oct 08 '18 10:10 thomas2403

Right, didn't test opds. But hey, at least the reader is working! :D

manvalls avatar Oct 08 '18 11:10 manvalls

@manvalls Your version works well, except that it doesn't open *.cbr/cbz files even if they are enabled in the settings menu.

e-alfred avatar Oct 08 '18 11:10 e-alfred

I fixed files_opds, if any of you is interested : https://github.com/hcharbonnier/owncloud-apps

hcharbonnier avatar Oct 12 '18 19:10 hcharbonnier

Alright guys I've merged @hcharbonnier's changes and fixed the cbr/cbz issue:

https://github.com/manvalls/owncloud-apps/blob/master/dist/files_reader-1.2.3-patched-5-NC.tar.gz?raw=true

https://github.com/manvalls/owncloud-apps/blob/master/dist/files_opds-1.2.3-patched-5-NC.tar.gz?raw=true

manvalls avatar Oct 12 '18 22:10 manvalls

@manvalls are all of your changes in a pull request? (I'm just curious)

Thanks so much for making these changes so it will work in 14.

scurrvy2020 avatar Oct 13 '18 01:10 scurrvy2020

Seems to be having issues saving settings and opening to last page opened.

psychodogg avatar Nov 19 '18 21:11 psychodogg

How is it looking for this app and NC15? Has anyone tried it?

scurrvy2020 avatar Dec 11 '18 14:12 scurrvy2020

The new grid view button introduced by Nextcloud 15 overlaps the close button of this app, otherwise it works pretty well.

e-alfred avatar Dec 11 '18 14:12 e-alfred

Ok, I've upgraded and it works just fine. The grid view button gets in the way of other apps as well.

scurrvy2020 avatar Dec 15 '18 02:12 scurrvy2020

@e-alfred I've been using your patches through NC16 and it was working great. However, with NC17 there are some changes and it seems the frame to display the book isn't being handled correctly.

Are you still trying to maintain this app?

I noticed on mobile (chrome and firefox) the app will open in a new tab and everything renders correctly. Do you know of a way to get it to open a new tab on desktop?

scurrvy2020 avatar Nov 24 '19 10:11 scurrvy2020

i took a stab @ files_opds https://github.com/Yetangitu/owncloud-apps/pull/121

noci2012 avatar Nov 24 '19 14:11 noci2012

@scurrvy2020 I still use @manvalls release which is more complete than my quick fix. I can reproduce your problem and mobile works because it loads the viewer in a new tab without the Files app interfering.

e-alfred avatar Nov 24 '19 17:11 e-alfred

@scurrvy2020 I fixed this in https://github.com/e-alfred/owncloud-apps/commit/0678c795e235ce56649eaec715a8d9e72bde8f4c. It loads in a new tab now instead of an Iframe.

e-alfred avatar Nov 24 '19 19:11 e-alfred

Thanks a lot! I'll add it to @manvalis fork.

scurrvy2020 avatar Nov 25 '19 05:11 scurrvy2020

@scurrvy2020 I could start to maintain this app and push a new version to the app store (under a different name) if some people want to help me fix problems that arise.

Maybe @manvalls @noci2012 @hcharbonnier want to help out?

e-alfred avatar Nov 25 '19 10:11 e-alfred

why not. (i am no wizard on the Nextcloud API, maybe an apprentice, if a can help i will).

noci2012 avatar Nov 25 '19 11:11 noci2012

@e-alfred I'm in! I think it would be great. I was thinking of doing that myself, but I'm still too novice.

scurrvy2020 avatar Nov 26 '19 00:11 scurrvy2020

I will publish the app into the app store once again and therefore already requested a certificate for it: https://github.com/nextcloud/app-certificate-requests/pull/293

If anynone wants to help me maintaining the app, all PRs are welcome on my repository.

e-alfred avatar Mar 20 '20 22:03 e-alfred

Thanks! Still working fine with your latest patches.

On Sat, 21 Mar 2020, 06:11 e-alfred, [email protected] wrote:

I will publish the app into the app store once again and therefore already requested a certificate for it: nextcloud/app-certificate-requests#293 https://github.com/nextcloud/app-certificate-requests/pull/293

If anynone wants to help me maintaining the app, all PRs are welcome on my repository.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Yetangitu/owncloud-apps/pull/108#issuecomment-601931833, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE5J4B3I7UFMEHEDPYUNZWDRIPSYTANCNFSM4FXSOY5A .

scurrvy2020 avatar Mar 24 '20 22:03 scurrvy2020

Future app development will happen in this repository: https://github.com/e-alfred/epubreader

@manvalls @noci2012 @everybody Any help is appreciated to continue the the development of this app.

e-alfred avatar Apr 21 '20 21:04 e-alfred