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
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.
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
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.
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!
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".
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.
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.