mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-03-28 17:42:57 +01:00
fixes #1392 improve performances to find related albums
* new conf setting related_albums_maximum_items_to_compute (1000 by default). Beyond this number of photos in current set, do not try to find related albums. * new conf setting related_albums_display_limit : only display the heaviest (most related) albums.
This commit is contained in:
@@ -643,6 +643,19 @@ $conf['tags_default_display_mode'] = 'cloud';
|
||||
// tag_letters_column_number: how many columns to display tags by letter
|
||||
$conf['tag_letters_column_number'] = 4;
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Related albums |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
// beyond this limit, do not try to find related albums. If there are too
|
||||
// many items, the SQL query will be slow and the results irrelevant,
|
||||
// because showing too many related albums.
|
||||
$conf['related_albums_maximum_items_to_compute'] = 1000;
|
||||
|
||||
// once found the related albums, how many to show in the menubar? We take
|
||||
// the heaviest (with more relations).
|
||||
$conf['related_albums_display_limit'] = 20;
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Notification by mail |
|
||||
// +-----------------------------------------------------------------------+
|
||||
|
||||
@@ -718,9 +718,9 @@ SELECT
|
||||
|
||||
function get_related_categories_menu($items, $excluded_cat_ids=array())
|
||||
{
|
||||
global $page;
|
||||
global $page, $conf;
|
||||
|
||||
$common_cats = get_common_categories($items, null, $excluded_cat_ids);
|
||||
$common_cats = get_common_categories($items, $conf['related_albums_display_limit'], $excluded_cat_ids);
|
||||
// echo '<pre>'; print_r($common_cats); echo '</pre>';
|
||||
|
||||
if (count($common_cats) == 0)
|
||||
|
||||
@@ -104,7 +104,12 @@ function initialize_menu()
|
||||
//------------------------------------------------------------ related categories
|
||||
$block = $menu->get_block('mbRelatedCategories');
|
||||
|
||||
if ($block != null and !empty($page['items']))
|
||||
if (
|
||||
isset($page['items'])
|
||||
and count($page['items']) < $conf['related_albums_maximum_items_to_compute']
|
||||
and $block != null
|
||||
and !empty($page['items'])
|
||||
)
|
||||
{
|
||||
$exclude_cat_ids = array();
|
||||
if (isset($page['category']))
|
||||
|
||||
Reference in New Issue
Block a user