Ignore:
Timestamp:
May 1, 2008, 3:12:34 AM (16 years ago)
Author:
rvelices
Message:
  • move #categories.date_last and nb_images to #user_cache_categories
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/site_manager.php

    r2299 r2324  
    221221
    222222$query = '
    223 SELECT s.*, COUNT(c.id) AS nb_categories, SUM(c.nb_images) AS nb_images
    224   FROM '.SITES_TABLE.' AS s LEFT JOIN '.CATEGORIES_TABLE.' AS c
    225   ON s.id=c.site_id
    226   GROUP BY s.id'.
    227 ';';
     223SELECT c.site_id, COUNT(DISTINCT c.id) AS nb_categories, COUNT(i.id) AS nb_images
     224  FROM '.CATEGORIES_TABLE.' AS c LEFT JOIN '.IMAGES_TABLE.' AS i
     225  ON c.id=i.storage_category_id
     226  WHERE c.site_id IS NOT NULL
     227  GROUP BY c.site_id
     228;';
     229$sites_detail = hash_from_query($query, 'site_id');
     230
     231$query = '
     232SELECT *
     233  FROM '.SITES_TABLE.'
     234;';
    228235$result = pwg_query($query);
    229236
     
    244251      'NAME' => $row['galleries_url'],
    245252      'TYPE' => l10n( $is_remote ? 'site_remote' : 'site_local' ),
    246       'CATEGORIES' => $row['nb_categories'],
    247       'IMAGES' => isset($row['nb_images']) ? $row['nb_images'] : 0,
     253      'CATEGORIES' => (int)@$sites_detail[$row['id']]['nb_categories'],
     254      'IMAGES' => (int)@$sites_detail[$row['id']]['nb_images'],
    248255      'U_SYNCHRONIZE' => $update_url
    249256     );
Note: See TracChangeset for help on using the changeset viewer.