print_album_menu.php heavy load

dear author of my favorite photoalbum,
Today, I have discovered not really a bug, but rather a feature request:

please consider, if the code for counting all gallery subitems (line 259 to 276 of the print_album_menu.php) should be interrupted if it takes too long to evaluate. Or if it can be cached somehow.

Under my installation (latest version 1.4.14), there are 12000 photos in 100 albums and it took 14 seconds to enumerate the menu function. With html_static_cache disabled the server was unusable. Static html caching helped, but when cache expires, it takes too long to generate it again.
So I finally decided to disable the $showcount in theme completly, so number of subitems are no longer showing.

I suggest:

1) make a new option in admin panel to toggle the counting feature easily on or off. It can be placed in theme settings or cache settings or menu settings too

2) and/or set the loop iteration limiter (i.e. "500+ photos in this folder...") or set the maximal execution time of the loop

3) or (at least) do not enter the loop if static caching is disabled:
(L259) `if ($showcount && extensionEnabled("static_html_cache")) {`


  • acrylian Administrator
    We will probably not create another option for disabling the count (we really try to avoid "option overload"…) but you can do that yourself via the menu function's parameter as you already noticed gladly.

    #2 and #3 sound like ideas. We will take a look (or you could contribute yourself via a pull request via GitHub).
  • #1. The `printAlbumMenu()` function has a parameter, `$showcount` which is the option you seek. You noted this parameter in your #3 suggestion. You can easily make a modified version of your theme that suppresses these counts.

    #2. This itself would have to be an option since the number of iterations would necessarily be server dependent. (In general you should insure that you have a server capable of handling the load your site will put upon it.)

    #3. Is unnecessary since if a page has been cashed the `printAlbumMenu()` function will not be called. If the page cannot be cashed because of the error, revert to #1.
Sign In or Register to comment.