Piwigo Bugtracker

Piwigo bug tracker has moved to Github

This bugtracker is kept to provide history on old issues.


View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002907Piwigoalbumspublic2013.05.24 22:472013.06.06 16:03
Reporterplg 
Assigned Torvelices 
PrioritynormalSeveritytextReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version2.5.0 
Target Version2.5.2Fixed in Version2.5.2 
Summary0002907: wrong number of sub-albums
DescriptionOn gallery side, next to the album thumbnail, if the album has sub-albums, Piwigo writes "X photos in Y sub-albums".

Due to 0001053 empty albums are removed from user_cache_categories. But the Y (ie user_cache_categories.count_categories) is not modified when empty albums are removed.
TagsNo tags attached.
browserany
Database engine and version
PHP version
Web serverApache 1.3.x
Attached Files

- Relationships

-  Notes
(0006998)
rvelices (developer)
2013.05.25 06:03
edited on: 2013.05.25 06:48

please wait a bit if not started ... I was completely rewriting the "branch" computation algorithm (too cocomplicated today) for bug 0002908

If you want I can do it while I'm at it

(0006999)
plg (manager)
2013.05.25 09:12

I have already fixed the bug, but not commited yet officialy:

===================================================================
--- functions_user.inc.php (revision 1357)
+++ functions_user.inc.php (working copy)
@@ -413,6 +413,7 @@
       $user_cache_cats = get_computed_categories($userdata, null);
       if ( !is_admin($userdata['status']) )
       { // for non admins we forbid categories with no image (feature 1053)
+ $uppercats_of = null;
         $forbidden_ids = array();
         foreach ($user_cache_cats as $cat)
         {
@@ -420,6 +421,33 @@
           {
             $forbidden_ids[] = $cat['cat_id'];
             unset( $user_cache_cats[$cat['cat_id']] );
+
+ if (empty($uppercats_of))
+ {
+ $query = '
+SELECT
+ id,
+ uppercats
+ FROM '.CATEGORIES_TABLE.'
+;';
+ $uppercats_of = simple_hash_from_query($query, 'id', 'uppercats');
+ }
+
+ // if child album is removed, we must decrease the number of
+ // sub-albums of all parent albums (to the root)
+ if (isset($uppercats_of[$cat['cat_id']]))
+ {
+ foreach (explode(',', $uppercats_of[$cat['cat_id']]) as $id)
+ {
+ // the last $id is the current album removed, it will always
+ // fail the following condition because it was removed a few
+ // lines before.
+ if (isset($user_cache_cats[$id]))
+ {
+ $user_cache_cats[$id]['count_categories']--;
+ }
+ }
+ }
           }
         }
         if ( !empty($forbidden_ids) )


For now i'ts only on Piwigo.com, but I planned to commit it on Piwigo.org too, if nobody tells me something is wrong.

Maybe we can apply this fix on 2.5 and have a better way to fix it on 2.6? (I suppose you don't plan a full rewrite of categories cache for 2.5)
(0007003)
rvelices (developer)
2013.05.25 10:50

let me do the trunk. i just rewrote the algo that computes the counters and there will be no need for an aditional query
(0007008)
rvelices (developer)
2013.05.26 21:59

[Subversion] r22879
(0007023)
svn (reporter)
2013.06.06 16:02

[Subversion] r23075 by plg on branch 2.5

-----[Subversion commit log]----------------------------------------------------
bug 2907 fixed (only on 2.5, rvelices did a deeper rewrite for 2.6): wrong number of sub-albums

- Issue History
Date Modified Username Field Change
2013.05.24 22:47 plg New Issue
2013.05.24 22:47 plg Status new => assigned
2013.05.24 22:47 plg Assigned To => plg
2013.05.24 22:47 plg browser => any
2013.05.24 22:47 plg Web server => Apache 1.3.x
2013.05.25 06:03 rvelices Note Added: 0006998
2013.05.25 06:03 rvelices Note Edited: 0006998
2013.05.25 06:03 rvelices Note Edited: 0006998
2013.05.25 06:48 rvelices Note Edited: 0006998
2013.05.25 09:12 plg Note Added: 0006999
2013.05.25 10:50 rvelices Note Added: 0007003
2013.05.26 21:59 rvelices Note Added: 0007008
2013.06.06 16:02 svn Checkin
2013.06.06 16:02 svn Note Added: 0007023
2013.06.06 16:03 plg Assigned To plg => rvelices
2013.06.06 16:03 plg Status assigned => closed
2013.06.06 16:03 plg Resolution open => fixed
2013.06.06 16:03 plg Fixed in Version => 2.5.2


Copyright © 2000 - 2018 MantisBT Team
Contact
Powered by Mantis Bugtracker