Sort order in recent_cats #1389

Open
opened 2026-10-05 00:41:59 +02:00 by adam · 0 comments
Owner

My Piwigo automatically updated to version 12.1.0 and after that i have a trouble with recent cats (my home page). There is no sort order. Before they where displayed from newest to oldest with limit 40 albums.

In my local config (LocalFiles Editor plugin):

$conf['order_by_custom'] = ' ORDER BY date_creation DESC, file DESC, id DESC';

but it's not working.

Below is my sql statements from admin debuger on home page (/recent_cats). There is no ORDER BY!

SELECT 
  id, name, permalink, nb_images, global_rank,
  date_last, max_date_last, count_images, count_categories
FROM piwigo_categories INNER JOIN piwigo_user_cache_categories
  ON id = cat_id and user_id = 1
WHERE 
(id_uppercat is NULL)
;

SELECT SUBDATE(CURRENT_DATE,INTERVAL 7 DAY)

SELECT
    c.*,
    user_representative_picture_id,
    nb_images,
    date_last,
    max_date_last,
    count_images,
    nb_categories,
    count_categories
  FROM piwigo_categories c
    INNER JOIN piwigo_user_cache_categories ucc
    ON id = cat_id
    AND user_id = 1
  WHERE date_last>=LEAST(SUBDATE(CURRENT_DATE,INTERVAL 7 DAY),SUBDATE('2021-12-19 22:02:34',INTERVAL 1 DAY))


SELECT
    category_id,
    MIN(date_creation) AS `from`,
    MAX(date_creation) AS `to`
  FROM piwigo_image_category
    INNER JOIN piwigo_images ON image_id = id
  WHERE category_id IN (18254,18255,18256,18257,18258,18259,18260,18261,18262,18263,18264,18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,18276)

  GROUP BY category_id
;

SELECT *
  FROM piwigo_images
  WHERE id IN (418810,418846,418906,418925,418943,418973,418991,419053,419070,419087,419100,419109,419115,419123,419210,419232,419248,419269,419291,419338,419412,419414,419447)
;
My Piwigo automatically updated to version 12.1.0 and after that i have a trouble with recent cats (my home page). There is no sort order. Before they where displayed from newest to oldest with limit 40 albums. In my local config (LocalFiles Editor plugin): ``` $conf['order_by_custom'] = ' ORDER BY date_creation DESC, file DESC, id DESC'; ``` but it's not working. Below is my sql statements from admin debuger on home page (/recent_cats). There is no ORDER BY! ```sql SELECT id, name, permalink, nb_images, global_rank, date_last, max_date_last, count_images, count_categories FROM piwigo_categories INNER JOIN piwigo_user_cache_categories ON id = cat_id and user_id = 1 WHERE (id_uppercat is NULL) ; SELECT SUBDATE(CURRENT_DATE,INTERVAL 7 DAY) SELECT c.*, user_representative_picture_id, nb_images, date_last, max_date_last, count_images, nb_categories, count_categories FROM piwigo_categories c INNER JOIN piwigo_user_cache_categories ucc ON id = cat_id AND user_id = 1 WHERE date_last>=LEAST(SUBDATE(CURRENT_DATE,INTERVAL 7 DAY),SUBDATE('2021-12-19 22:02:34',INTERVAL 1 DAY)) SELECT category_id, MIN(date_creation) AS `from`, MAX(date_creation) AS `to` FROM piwigo_image_category INNER JOIN piwigo_images ON image_id = id WHERE category_id IN (18254,18255,18256,18257,18258,18259,18260,18261,18262,18263,18264,18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,18276) GROUP BY category_id ; SELECT * FROM piwigo_images WHERE id IN (418810,418846,418906,418925,418943,418973,418991,419053,419070,419087,419100,419109,419115,419123,419210,419232,419248,419269,419291,419338,419412,419414,419447) ; ``` <!-- github-sync-id:1085226174 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1389