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

file_opds Nextcloud14 compatibility #109

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

file_opds Nextcloud14 compatibility #109

wants to merge 3 commits into from

Conversation

hcharbonnier
Copy link

This should fix files_opds app in nextcloud 14

@hcharbonnier
Copy link
Author

Hi,
I'm definitely not a dev, so if I did anything wrong, don't hesitate to tell me.

@dev4223
Copy link

dev4223 commented Oct 12, 2018

Hi @hcharbonnier , seems to work on the server. Got to check it in an ebook reader. But many thanks so far.

@hcharbonnier
Copy link
Author

On chunky reader on IPAD, it works (pdf, cbz, cbr).

@thomas2403
Copy link

It works on Moon+ Reader on Android. Many thanks for fixing this.

@plinss
Copy link

plinss commented Dec 10, 2018

Please note that Nextcloud 15 has been released. Hopefully this is still compatible but will need the max version bumped in info.xml.

Config::set('id', Util::genUuid());

\OCP\JSON::success(
\OC_JSON::success(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works for now, but it is internal API, which might break at any point in time. Best is to move away from this style over to a app framework based controller, that can accomplish the same: https://docs.nextcloud.com/server/stable/developer_manual/app/requests/controllers.html

@@ -64,7 +64,7 @@ public static function isValid($meta) {
protected static function load($id) {
$sql = 'SELECT * FROM `*PREFIX*opds_metadata` WHERE id = ?';
$args = array($id);
$query = \OCP\DB::prepare($sql);
$query = \OC_DB::prepare($sql);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for this. This is internal API now, that can change at any point in time. Best is to use the DB connection: https://github.com/nextcloud/server/pull/8985/files#diff-47cd1c326a2fae00c6f0e1e088c994bbL430 and there the query builder is currently the way to go: https://docs.nextcloud.com/server/stable/developer_manual/app/storage/database.html (there is one more abstraction layer in the docs: the mapper and entities - you don't need them, but inside them is basically all the DB logic that you need and then your code is better separated. You could use the DB access also without mapper and entity - it's just a best practice here)

@noci2012
Copy link

Updated for Nextcloud 16 now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants