Please don't laugh: Upgrading from 1.0.1 beta

A client of mine has an ancient version of ZenPhoto. printVersion() reports that it's 1.0.1 beta. I'm not familiar with how ZenPhoto works under the hood, but am planning on writing a PHP script to handle the upgrade.

I found this code in the user guide, which I plan on using as I loop through the 1.0.1 beta tables:

$albumobject = newAlbum("album/path/name");
$imageobject = newImage($albumobject,"name");
$imageobject->setTitle("title");

Here are my questions:

1. Any issues I should be aware of by directly accessing the 1.0.1 beta tables?

2. Does setDescription() exist for both albums and images?

3. How do I include comments for a given album or image?

Any help / direction on how to do this correctly and efficiently is greatly appreciated.

-Jibran

Comments

  • There is some chance that the setup routine can migrate the 1.0.1 database. I would not know for sure, but if you can back-up before trying it would be worth the effort.

    In answer to your questions:

    1. If you plan to do this via Zenphoto you will have to use pure SQL in accessing the old table. The zenphoto routines are wired to a single database.

    2. Yes. in general objects will use the same function name if they provide the same method feature. This is more so in the next release, though, so be aware. This project will be substantial. I suggest you review the Zenphoto object model, etc. So you know how Zenphoto currently works. (Sorry, I don't know what you review to see how 1.0.1 works.)

    3. In current releases the comments table contains an "owner" type and ID that link it back to the object. Don't know about 1.0.1, that is before my time. Presuming it is the same, you would have to instantiate a comment object and fill in the methods/proprieties.
  • The setup routine worked. Thanks, sbillard! Should I delete the 'zen' folder from the 1.0.1 installation? I am guessing this was renamed to 'zp-core'.

    Also, with this particular site my client has 4 separate zen photo installations that need upgrading. I'd like them to be all under one roof. Is there a way to easily merge them, once upgraded?

    -J
  • acrylian Administrator, Developer
    I have successfully upgraded plain 1.0.8.2 sites to 1.4.5 last year. So the chances are quite good.

    regarding "under one roof": If you basically want to have its contents within one install there is no tool for this directly. If it is just albums and images you technically could just drop the contents of their /albums folder within the one install that should remain.

    However be aware that this way no album / image descriptions will travel with those contentes unless they have been incorporated within the image meta data.

    A way would be to use the xmpMetadata.php plugin to generate sidecar xmp files containing that info. This plugin can also read them on the site you moved the contents.
  • Acrylian, thanks for your input. So I had trouble with 2 of the 4 upgrades. All albums, titles and descriptions appear in admin, but no images are showing up when I view the albums. Maybe you know a quick fix for this?

    Either way, how do you get started with programmatically creating galleries, albums and images? What zp-core files do I need to include? I've tried the following but am getting an error:

    include_once("zp-core/class-album.php");
    include_once("zp-core/class-gallery.php");
    include_once("zp-core/class-image.php");

    The error is: Fatal error: Call to undefined function getOption() in /users/jibran/sites/3c/zen-test/zp-core/class-album.php on line 9

    My PHP file is at the root of the ZenPhoto install.

    Thanks for all your help!
  • acrylian Administrator, Developer
    Either way, how do you get started with programmatically creating galleries, albums and images? What zp-core files do I need to include?
    First, "gallery" means the whole Zenphoto site in our terms (we have a glossary btw :). Second, I am not sure what you are trying to do here. An album is created when you upload a folder with/without images and/or other folders. The gallery part of Zenphoto is file system based and it syncs itself on visiting those. Pleasee see the user guide about "caching".
  • You should delete anything left over from the old install.

    Regards several galleries under one roof, perhaps you are looking for the "clone" facility. With it you install Zenphoto once then use its clone tool to install it in the other folders.

    Each separate clone will still need setup run, but once this is done they will all be running form the same set of files. For this to work, though, your server must support "sym-linking".
  • Ok, thanks for the clone instructions. I'll tackle that next.

    One of the upgrades is having a problem where 6 albums are *not* being displayed in the admin, but they *are* being displayed on the front end. So we can't edit / re-sort them.

    Here's a screenshot of the issue (notice that no album footer links are shown):
    http://snag.gy/aAAam.jpg

    Here's a screenshot of one that worked:
    http://snag.gy/7tBaz.jpg

    It looks as if the HTML output is broken by bad data. I've looked at the database of those few albums but all the data looks good.

    Ideas?

    I can give you guys access to the site if that would help.
  • You should check your error logs. Maybe even look at the page source for the page, might have an error displayed there as well.
  • Thanks sbillard. I checked the logs. ZP was throwing errors about filenames with escaped single quotes in the name, i.e. blind\'s.

    These are the steps I used to deal with this issue and successfully upgrade the install.

    1. Fixed the offending filenames
    2. Created a fresh zen photo install
    3. Copied 'albums' folder over to new install
    4. Logged in to admin, verified albums were pulled in correctly
    5. Then to port over the meta data (titles, descriptions) from the old install (art) to the new install (art2) I ran the following sql update. Both installations are in the same database, btw.

    UPDATE art2albums AS art2
    LEFT JOIN artalbums AS art ON art2.folder = art.folder
    SET art2.title = art.title, art2.desc = art.desc;

    UPDATE art2images AS art2
    LEFT JOIN artimages AS art ON art2.filename = art.filename
    SET art2.title = art.title, art2.desc = art.desc;

    There might be a better way to deal with this, but this worked for me.
Sign In or Register to comment.