rogue "albums" in database

Hi guys, hoping somebody might know what I can do to fix this. If I check out my gallery statistics, about halfway down the page I get a large paragraph of a string of these errors:

The album Places/Florence/DSCF2959.JPG cannot be found.Error: The album Places/Jordan/IMG_0315.JPG cannot be found.Error: The album Places/England 2000-12/Dscf1553.jpg

I also use the zenphotopress plugin for Wordpress, and in the album list in that plugin, the same list of rogue "albums" shows up. These aren't albums, of course, they're just picture files (that do appear in the album in question) that somehow got listed somewhere as albums.

Refreshing the database via the admin overview doesn't fix it, and these picture-albums don't show up in the albums list of the admin page or the folder list on the server. It seems to just be a database thing. Any ideas on what happened, or how I can prune these "albums" out?

Thanks!

Comments

  • acrylian Administrator, Developer
    You can always delete database entries via tools like phpmyadmin directly (your host probably provides that).

    Please always tell us which Zenphoto version you are using. If it isn't 1.2.5 please upgrade.
  • Sorry about that; I am using the latest, 1.2.5.

    I will take a gander at it through phpmyadmin; I've been in it before, but not often, because I don't know enough about databases not to screw them up. Hurrah for backing things up first.

    Thanks for the advice, I'll let you know how I fare.
  • I looked at the database refresh code. Seems it tests for an album's existence but does not verify that it is a folder. That would be why the refresh does not purge these entries.

    Change line 341 of class-gallery.php to `if (!is_dir($albumfolder.internalToFilesystem($row['folder'])) || in_array($row['folder'], $live)) {` Changes from `file_exists` to `is_dir`. that should let you clean out the DB.

    As to how these came about. There is a similar oversite in the class-album script. So perhaps you are doing a `New Album()` passing the image name rather than the image basedir.
  • Thanks! I think I will try this first, as I'd rather let it maintain its own database before I get in there and start chopping.

    I've never altered the code before, so I'm not sure how these errors slipped in. I've created new albums since, with no resulting errors, so it must have been a temporary hiccup. The errors would have been generated a few versions ago, but I had thought it was an issue with the Wordpress plugin, since that's the only place I saw them until now.
  • Just got a chance to try this. Changing the appropriate line in class-gallery.php (which was line 342 for me, but maybe my text editor was weird) worked. I was able to run the database cleanup and the "albums" no longer show up as errors on the gallery statistics, nor do they show up in the zenphotopress plugin.

    Thank you so much for looking into this and offering the solution.
  • You are welcome. That solution is not totally correct--it will not properly process dynamic albums. The full correction has been released to the nightly builds.

    We have seen that some editors seem to count differently from others. I normally use circa with line numbers for that reason. Just did not do so in this post.
Sign In or Register to comment.