3

I am trying to understand the Drupal database schema because I need to access the database via MySQL by another system and I do not have access to the original Drupal developer of the site nor do I know Drupal well at this point (I did work with it 8 years ago) and it will be much easier to access with MySQL than to set up a server to have to host a PHP-based API or similar.

file_managed

In the file_managed table there is a field uri where the data all appears to be in the same of two formats:

  • public://<filename>, OR
  • public://<directory>/<filename>

My two questions related to file_managed are:

  1. What is public:// mean here? Does it translate to some root URL like http://example.com/files or similar?
  2. When there is a directory in the uri, what do they represent?

UPDATE: I do not have access to the working Drupal system, I only have access to the database.

  • Welcome to Drupal Answers :) I see you're a veteran of the network so you probably already know that this is too much for a single question (I can literally count over 10 questions just skimming through). Please break this down a bit and ask separate questions about the different concepts; I understand there's no point in asking a single separate question for everything, but there's way too much to answer in one question here and it's inevitably going to be closed – Clive Apr 26 '16 at 8:24
  • Hi Clive, funny, this was me trying to ask fewer questions rather than more. I have numerous other questions I plan to ask about the database for which I would expect 2, 3 or 4 more questions. Given that, is this question still to much? If I break it down then I might end up for 10 to 20 questions... – MikeSchinkel Apr 26 '16 at 8:28
  • I will ask another question because @Free Radical only answered the first half and requested I add a different question. – MikeSchinkel Apr 26 '16 at 8:33
  • Well it looks like you've already done exactly what I was going to suggest - break the three headings down into a question each - so that's great, thanks. I'm not sure the system will let you ask 20 questions in quick succession, but broadly speaking yes, it's be better to break each query down into its smallest bit and ask multiple questions, rather than a single broad one. It lets answers be more detailed snput that one little thing, and winds up being more useful to the greater Drupal community when everything's not buried in context – Clive Apr 26 '16 at 8:39
  • Thanks Clive. BTW, I won't ask them all in one night. :-) – MikeSchinkel Apr 26 '16 at 8:54
2

I am just going to answer your first two questions (about file_managed). Please ask a separate questions for the second set (about file_usage) and about the relation between the tables.

What is public:// mean here? Does it translate to some root URL like http://example.com/files or similar?

Navigate to Administration » Configuration » Media » File system. Take a look at the value for "Public file system path" (default is sites/default/files). this is the path to public:// from your site root.

When there is a directory in the uri, what do they represent?

The path below the public file system root.

So, given the that the public path is the default, public://foobar/image.jpg, this expands to the path sites/default/files/foobar/image.jpg, or the URL http://example.com/sites/default/files/foobar/image.jpg

  • I don't have access to a working Drupal system, I only have the SQL database. Where can I find "Public file system path" in the database? – MikeSchinkel Apr 26 '16 at 8:24
  • You said "Navigate to Administration » Configuration » Media » File system. Take a look at the value for "Public file system path" (default is sites/default/files)." I don't have access to an admin console for this site to go look for that. – MikeSchinkel Apr 26 '16 at 8:30
  • It will be hard to work with a Drupal site without having access to the admin console. However. if you have write access to the DB, it is trivial to hack into the main admin account and gain access. – Free Radical Apr 26 '16 at 9:18
  • I don't have to write to the DB, I just have to read it. And for that I am trying to make sure I get all the joins handled correctly. – MikeSchinkel Apr 26 '16 at 9:19
  • Maybe I should have said, I am getting periodic database dumps. I have no access to the MySQL server. – MikeSchinkel Apr 26 '16 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.