Announcement

  •  » Engine
  •  » Why is the child album ID is also included in its uppercats?

#1 2023-12-08 15:26:43

Crythes
Member
2020-01-23
112

Why is the child album ID is also included in its uppercats?

Hello/Hi/Greetings,

If album "A" has an id of 9 and it belongs to album "B" of id 10, why in the uppercats cell in the piwigo_categories table its own is also included?

That is, the uppercats for album "A" are 9,10, where it should be just 10.

So if I use the Piwigo function get_subcat_ids(), it will always return a subcat because every album is its own uppercat.

It seems curious to have it be written this way. Is there a reason for this?

Also, if my database is borken and it shouldn't work like that please let me know as well. :)

Thank you.

Last edited by Crythes (2023-12-08 15:27:12)

Offline

 

#2 2023-12-08 19:51:50

erAck
Only trying to help
2015-09-06
2070

Re: Why is the child album ID is also included in its uppercats?

Think of it as a path to reach the album, or a tree's branch that includes the leaf node. You'll also see that when B(10) would be a sub-album of C(8) then the sequence would be 8,10,9.

Btw, your example of A(9) belonging to (being a sub-album of) B(10) and uppercats 9,10 is reverse, it should be 10,9 instead.

But I don't know why this decision to include the very album was made.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2023-12-09 16:16:47

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13795

Re: Why is the child album ID is also included in its uppercats?

erAck wrote:

But I don't know why this decision to include the very album was made.

I don't remember but I think it's a good choice :-) It's like the "path" of a directory: it includes the directory itself.

Code:

~/git/Piwigo/plugins/TakeATour[master|✔] % pwd
/Users/plg/git/Piwigo/plugins/TakeATour

I'm in the "TakeATour" directory and when I ask to "print working directory", it includes the directory "TakeATour" itself.

The piwigo_images.uppercats data is just like the directory path, but with album (category) identifiers.

Offline

 

#4 2023-12-09 16:34:11

Crythes
Member
2020-01-23
112

Re: Why is the child album ID is also included in its uppercats?

I see, thanks for the explanations, it does make sense.

Offline

 
  •  » Engine
  •  » Why is the child album ID is also included in its uppercats?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact