Gallery restore from backup
dargaud
Joined: 2008-02-13
Posts: 33 |
Posted: Tue, 2011-10-25 21:37 |
Hello all, I backup Gallery2 from the interface (it creates a file g2data/backups/gallery2...xml). I also keep the /var/www/gallery structure and its config files. I also backup the entire sql structure. Maybe I shouldn't have, I can't restore it without errors: hundreds of megs, plenty of users, databases, a mess. Maybe I can extract the part specific to G2, but I have no idea how to do that. I of course keep a copy of the g2data directory. Now I've read this, but nowhere in it does it say how to restore from the g2data dir and the backup xml file. Trying to piece it together, it seems that you reinstall and then restore the file. But when I reinstall but running the install script again, I get to a point where it says 2.3: "The G2 storage directory has a versions.dat file of an old install. But the Gallery database tables don't exist. Select a clean install to erase all data in the Gallery storage directory and advance to the next step." I don't think I want to [Erase data for a clean install] ! Should I install instead into an empty g2data directory and then copy everything into it and then import the xml file ? |
|
Posts: 8339
simply install gallery2 to your target location.
after its working to your liking, edit gallery2/config.php to point to your old g2data and your old DB creds.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 33
I can't restore the DB itself. Is the xml backup a replacement, and if so how do you use it ?
Posts: 8339
to restore a gallery xml backup, head to yoursite.com/gallery2/lib/support/
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 33
Thank you, this is exactly the info I was looking for. Why isn't it mentionned on the 'restore from backup' page ?
But when I do it, this happens immediately:
I see nothing obvious in there.
Posts: 8339
So your backup is from a pre 2.3.x version?
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 33
No, the version is exactly the same as the one before. It's the same /var/www/gallery/ directory which I just copied back, no change at all.
$ grep gallery-version g2data/backups/gallery2_f50b5_2011_10_22_2329.xml
<export schema-version="1.1" tables="47" core-version="1.3.0.1" gallery-version="2.3.1">
$ cat g2data/versions.dat
1.3.0.1
2.3.1
$ grep release /var/www/gallery/*
Gallery/README.html: Welcome to Gallery 2. This is the official release of Gallery 2.3.1,
Posts: 8339
is the database name same as the prior install?
I've actually never used this function, I always restore from SQL exports.
The latest phpMyAdmin can handle xml imports as well.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 33
I've tried restoring without any database/user present. And I've tried with the same database and user. Same error message. Like I said the complete backup I did of the database failed on restore (it was a lot more than just my Gallery). Now I've rebuild some of the rest from other sources, and I don't know how to extract a single database from a complete backup. I thought that was a job for the xml file. Does it expect to find a database+user already ?
Posts: 8339
looking through one of my G2 backups it looks like the plugin status check is making sure the same plugins are installed/active
check yours.
If all else fails I have a method that has helped others.
http://gallery.menalto.com/node/94122
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 33
OK, I did a clean install: both from an empty database, empty g2data dir and fresh /var/www/gallery. Then I substituted with my full g2data dir and old (but same version, same passwords, etc) /var/www/gallery. I went to reimport my xml backup and this time it completed successfully.
Clicking on [continue] brought "Maintenance - Site is temporarily down for maintenance". And then the login box. When I login, I'm still in an empty gallery. No images at all.
I do an admin login, remove [Maintenance mode], [Optimize database] but still nothing. All the images are still present in my g2data dir. What happened ? Why isn't the backup restored ? Is there a log of the restore process ?
Posts: 33
I also tried your importXML.php script. It said "Done!" immediately, no error in /var/log/apache2/error.log, but still the gallery remains empty...
Your script did about 47 iterations in the $items loop, 3 iterations in the $relevantTables loop and 12100 iterations in the $entities loop. But then the $ids loop is never executed. I assume $ids is empty.
The database is populated with lots of g2_* tables, but whether they have been modified since the clean install is an open question (I have phpmyadmin installed so I can look some up if you wish).
Thanks.
Posts: 8339
your restored g2data must be readable/writable recursively.
chmod _R 0777 /path/to/g2data
Also check that the g2_Entity table has been populated with all your data
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 33
The g2data dir has correct permissions (www-data user, 755 on dirs, 644 on files).
The g2_entity table contains 9 lines with the columns named g_id g_creationTimestamp g_isLinkable g_linkId g_modificationTimestamp g_serialNumber g_entityType g_onLoadHandlers
Posts: 8339
so your import did not succeed as there should be an entry for each photo you've ever uploaded
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 8339
my importXML.php works like this:
this method works well as it will keep your album structure the same ass the old gallery, respecting directory relationships.
If all goes well, my script should transfer title, descriptions, keywords to your gallery items.
-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2
Posts: 33
Should the path pointed by line 14 be the same as the g2data directory already set in the config.php file ? I assume your script updates the database without touching the g2data image store.
I've been adding print statements to your code to try to figure out what's missing, but if I know a bit of Php+Sql, I don't know anything about the internals of Gallery2.
I just don't know what to think when 3 different methods of backup restoration all fail.
I'll be off the grid for the next 3 weeks. Hopefully you'll still be willing to give me a hand when I get back !