Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Class "OC_DB" not found #14

Closed
andiweidl opened this issue Apr 23, 2023 · 12 comments
Closed

Error: Class "OC_DB" not found #14

andiweidl opened this issue Apr 23, 2023 · 12 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@andiweidl
Copy link

andiweidl commented Apr 23, 2023

Hello all,

i hope anyone can help with my problem.

I updated my Nextcloud to V26 and now i cant see my users from ISPconfig.

My error message when i run "occ user:list":

`#10 {main}root@cloud:/var/www/nextcloud# sudo -u www-data php8.1 /var/www/nextcloud/occ user:list

An unhandled exception has been thrown:

Error: Class "OC_DB" not found in /var/www/nextcloud/apps/user_ispconfig/lib/base.php:140
Stack trace:

#0 /var/www/nextcloud/lib/private/User/Manager.php(306): OCA\user_ispconfig\Base->getUsers()

#1 /var/www/nextcloud/core/Command/User/ListCommand.php(77): OC\User\Manager->search()

#2 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OC\Core\Command\User\ListCommand->execute()

#3 /var/www/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()

#4 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run()

#5 /var/www/nextcloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()

#6 /var/www/nextcloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()

#7 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()

#8 /var/www/nextcloud/console.php(100): OC\Console\Application->run()

#9 /var/www/nextcloud/occ(11): require_once('...')`

Output from Nextcloud.log:

{"reqId":"ea1BN5KT4szUQR5CL57N","level":3,"time":"2023-04-23T18:13:08+02:00","remoteAddr":"","user":"admin","app":"no app in context","method":"GET","url":"/ocs/v2.php/cloud/users/details?offset=0&limit=25&search=","message":"Class "OC_DB" not found in file '/var/www/nextcloud/apps/user_ispconfig/lib/base.php' line 140","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/112.0","version":"26.0.1.1","exception":{"Exception":"Exception","Message":"Class "OC_DB" not found in file '/var/www/nextcloud/apps/user_ispconfig/lib/base.php' line 140","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":64,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":169,"Previous":{"Exception":"Error","Message":"Class "OC_DB" not found","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/User/Manager.php","line":306,"function":"getUsers","class":"OCA\user_ispconfig\Base","type":"->"},{"file":"/var/www/nextcloud/apps/provisioning_api/lib/Controller/UsersController.php","line":186,"function":"search","class":"OC\User\Manager","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":230,"function":"getUsersDetails","class":"OCA\Provisioning_API\Controller\UsersController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":137,"function":"executeController","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":183,"function":"dispatch","class":"OC\AppFramework\Http\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":315,"function":"main","class":"OC\AppFramework\App","type":"::"},{"file":"/var/www/nextcloud/ocs/v1.php","line":64,"function":"match","class":"OC\Route\Router","type":"->"},{"file":"/var/www/nextcloud/ocs/v2.php","line":23,"args":["/var/www/nextcloud/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/user_ispconfig/lib/base.php","Line":140},"CustomMessage":"--"}}`

Thanks to all users

Best Regards from Austria

@joshtrichards
Copy link

OC_DB was deprecated long ago in NC21 and removed outright in NC26. The maintainers of this app (or someone in a fork) will need to update it to work with NC26. It appears the last formal release targeted NC22.

P.S. Not familiar with this app; just ended up here after a potential bug report elsewhere.

@qroac
Copy link
Contributor

qroac commented May 30, 2023

Unfortunatly, I have some changes in my private life that don't give me the time to actively maintain this app.
There is a serious illness in my close family that needs my ongoing support and right now I am blocked by corona.

However, if anyone wants to support, please open a pull request.
If someone willing to overtake maintenance for this project, please talk to me.

@qroac qroac added bug Something isn't working help wanted Extra attention is needed labels May 30, 2023
@siucdude
Copy link

@qroac sending my best wishes to your situation, I will post on few forums and see I can find some help with this app... thanks

@blackd
Copy link

blackd commented Jun 13, 2023

Transplanting the lib/private/legacy/OC_DB.php from 25 and small changes in the source will revive the plugin.
the attached file contains the changes
Archive.tar.gz

@joshtrichards
Copy link

If you wish to eliminate OC_DB you can look at how it was done elsewhere for an example of the differences:

https://github.com/nextcloud/server/pull/23937/files

@qroac
Copy link
Contributor

qroac commented Jun 27, 2023

Thank you for the posted examples.
I started replacing OC_DB with \OC::$server->getDatabaseConnection()->getQueryBuilder();

May take some more days to finish it.

BTW:
getDatabaseConnection is marked as deprecated since NC 20, too.
But because it seems to be used over the entire NC codebase it should buy me some time ;)

@blackd
Copy link

blackd commented Jul 11, 2023

Hi @qroac,

At the time you posted your last message I had just setup a Nextcloud dev environment and converted 2 - 3 database requests to getQueryBuilder, but stopped since i have very minimal PHP knowledge.
If you don't have time to make the change can you just commit the changes you've made and I'll finish the rest.

qroac pushed a commit that referenced this issue Jul 18, 2023
@qroac
Copy link
Contributor

qroac commented Jul 18, 2023

Hi @blackd
thanks for your offer.

I just commited my unfinished and untested migration.
My biggest obstacle at the moment is, I cant find a useful documentation for nextclouds query builder.
If anyone of you knows a good ressource, I'd appreciate a hint.

I need to build queries like:
... WHERE x OR ( y AND z )
or conditions like
LOWER(fieldname) LIKE LOWER(value)

@blackd
Copy link

blackd commented Jul 19, 2023

I'll get to it this weekend.

@conrad784
Copy link
Contributor

conrad784 commented Aug 6, 2023

[...] but stopped since i have very minimal PHP knowledge.

Same here :D

I just found https://github.com/nextcloud/server/blob/master/lib/public/DB/QueryBuilder/IFunctionBuilder.php#L99 is this the function @qroac was missing?

@gkooistra
Copy link

gkooistra commented Aug 29, 2023

At the end of this week, I will post my changes,
The basic functions are working for me (can login with an existing user).

I've found that the documentation of Docterine works (Nextcloud is using Docterine?).

Changes so far: https://github.com/gkooistra/nextcloud-user-ispconfig/blob/1f02e5bca595560ced903fdd0fd877ece70e9ccd/lib/base.php

@qroac
Copy link
Contributor

qroac commented Sep 16, 2023

I just merged PR #17 and uploaded a new release containing the changes made by @gkooistra and @volkarts-dev.
Thanks to you all for your support! I really appreciate it!

@qroac qroac closed this as completed Sep 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants