Autarchy of the Private Cave

Tiny bits of bioinformatics, [web-]programming etc

    Gallery2 with URL Rewrite and DHTML Album Select and Statistics module produces two forward slashes instead of the album select

    25th February 2008

    Problem report at menalto forum. Another one, also with no solution.

    I can confirm – URL rewrite + DHTML Album Select produces two forward slashes in the Matrix theme, in my gallery 2.2.4 setup, after a single use of the Recalculate button in Disk statistics tab in Statistics plugin from Community repository.

    In my exact case, generating single gallery page with two forward slashes instead of Album Select produced this error:

    [25-Feb-2008 04:57:50] PHP Fatal error: Call to a member function onLoad() on a non-object in /modules/core/classes/helpers/GalleryEntityHelper_simple.class on line 91

    I did run the integrity check… it had shown 7 missing files in the Notification module (all from the phpunit test framework), and 7 modified files (in publishxp, webcam, and flashvideo renderer; of those, I remember modifying only the last one).

    PublishXP and webcam are not even installed – so I just manually deleted their folders. Then I reinstalled Notification module.
    As expected, this didn’t help with the Album Select problem – though “modified files” verification problems are now gone (except for flashvideo, which I did modify). Notification must have some kind of internal trouble, as it still shows the phpunit files as missing.

    Next, I tried disabling URL Rewrite, and having a look if that error is still generated: NO!!! This means, that the error is clearly associated with URL Rewrite being enabled. It’s only totally unclear, what kind of association it is.

    It’s possible, that only some rules in URL Rewrite are causing problems. So I’ll disable all the rules first: now album select works.

    Next, enabling rules one-by-one:

    • add comment: still fine
    • view comments: still fine
    • updates album: still fine
    • popular album: still fine
    • random album: still fine
    • keyword album: still fine
    • permalinks: still fine
    • rating album: still fine (at this point I started thinking that it’ll just work after I enable all the rules; this way I’ll fix Album Select problem for some time, but won’t find the cause)
    • show item: oops! Doesn’t work! Disabling: now works again! moving on to next rules for now.
    • download item: OK
    • site admin: OK
    • 404: OK
    • Simple RSS feed and RSS feed: both OK
    • sitemap: OK
    • view slideshow: OK
    • tag cloud and tag virtual album: both OK
    • watermark hotlinked items: OK

    Intermediate summary: problem is only with the show item rule. As suggested at the menalto forums, this might be due to the individual items names/filenames.

    So, for now: if you want URL Rewrite in Gallery2 with Album Select, and you only get two forward slashes – disable the show item rule. It gives you functional Album Select at the cost of disabled rewrites for single items.

    Next, I had a peek at the code around line 91:

    1. /* Let each entity do its post-load procedure */
    2. foreach ($onLoad as $id) {
    3.     $ret = $cached[$id]->onLoad();
    4.     if ($ret) {
    5.     return array($ret, null);
    6.     }
    7.     GalleryDataCache::put("GalleryEntityHelper::loadEntitiesById($id)", $cached[$id]);
    8. }

    From what I understood, this line

    1. $ret = $cached[$id]->onLoad();

    in the code context calls the onLoad() function on each of the needed items, which are retrieved from the cache. So, as only one error is generated, it looks as if single item is either not in the ‘cached’ array when it should be, or is not of the expected type. So far, I do not understand how this might be associated with item names/filenames.

    Update: there was a plugin/module, which wasn’t present in the fresh and full G2 install: Statistics. After I installed Statistics onto a fresh Gallery2, and recalculated ‘disk usage’, I’m now seeing two slashes in that “freshly installed” G2!
    Other symptoms are exactly the same: URL Rewrite’s “show item” rule switches two-slashes on and off. Thus, Statistics module might be the cause.
    Strangely, but deactivating/uninstalling/deleting Statistics doesn’t fix the problem…

    Update: here is the sequence of actions to reproduce the problem:

    • install full gallery
    • during install, activate these plugins: album select, add items, integrity check, permalinks, url rewrite, gd
    • configure/activate URL rewrite module (apache mod_rewrite)
    • activate all url rewrite rules
    • edit root album->theme: add dhtml album select to ‘album pages’
    • tree doesn’t show: add album ‘test’. Now the album tree will be shown
    • install Statistics plugin (from Community repository)
    • go to Statistics menu in Site Admin, choose Disk statistics tab, press Recalculate
    • when recalculation is complete – two slashes will be seen

    I’ll keep looking for the solution. Comments from Gallery2 developers are highly appreciated.

    Share

    Leave a Reply

    XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>