How nextcloud save data in database

I take a look at nextcloud code but did’t see which part handle the database side. I want to ask how Nextcloud does all the crud operation, is it done through ocs api?

Hello @superlong231!

I am not sure, I get your question right. So sorry, if my answer might not be what you expect. In that case, please feel free to ask.

To formally answer your question, they use doctrine here. This is embedded in the NC core and allows to access the DB in general.

From there the data is delegated through the core to the different apps installed. (yes, the files view that is elemental part of the server is also an app.) The apps provide an API to the clients. Such an API can be a raw HTML page for a browser to render or a REST based for advanced use cases. OCS ist just a protocol on top of REST, basically speaking.

So, any CRUD modifications are routed from the client to the DB through multiple abstraction and implementation layers: the client just uploads a file, while the backend checks permission flags in the database, stores the file in the storage (another abstraction), and finally carries out the insertion of the information about the file in the cache table.

To sum up, there is no single CRUD operation to be identified. Instead, there are CRUD operations on different levels to be done (Create a file vs Create a DB table row).

Does this somehow help you? Any more detailed questions?
Christian

2 Likes