restoring a single album with subalbums from recent backup and preserving itemId

j080428

Joined: 2011-03-17
Posts: 4
Posted: Thu, 2011-03-17 00:46


Gallery version (not just "2"):2.2.6
PHP version (e.g. 5.1.6): 5.3.1
PHPInfo Link (see FAQ):
Webserver (e.g. Apache 1.3.33): 2.2.13 (Linux/SUSE)
Database (e.g. MySql 5.0.32): 5.1.36
Activated toolkits (e.g. NetPbm, GD): GD
Operating system (e.g. Linux): Linux
Browser (e.g. Firefox 2.0): Firefox 3.6.15

Hi,

A user recently accidentally deleted their gallery from the top level. I have a complete backup of the albums tarred up from a few days ago. I know I can restore it from server as indicated in your FAQ. What I need to know is, will the itemId of the restored pictures be preserved? It will be restored to a running gallery in maintenance mode.

I also have a db backup made at the same time, as well as the main gallery program.

I'm asking because another application calls gallery with the itemId in order to display it. That application still holds the old itemIds.

thanks

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2011-03-17 01:39
Quote:
I have a complete backup of the albums tarred up from a few days ago

Quote:
I also have a db backup made at the same time

You'd have to restore both, and you would lose any changes made since. But the itemIds would match.

Best bet is to create a new album for the user and perform an add from local server to restore their content and not disturb any other user's content.
But the itemIds would no longer match

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
j080428

Joined: 2011-03-17
Posts: 4
Posted: Thu, 2011-03-17 02:02

Hi, thanks for answering

Just an idea, but with this work to preserve itemId? I have shell access and I'm root.

1. untar the backup someplace
2. locate the user in the backup
3. copy that across to the location they would occupy in the new gallery data
4. make gallery rebuild thumbnails, database etc

thanks

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2011-03-17 02:10

every item in gallery has an ID be it an album, photo, thumbnail, resize, movie, user, module, theme.... these are numeric and consecutive based on creation order.
This means that your user's items will have ids spread across the the entire id range and it would be extremely difficult to sort them out.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2011-03-17 02:12

Of course someone with the right skills and lots of spare time could write a script to do what is needed.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
j080428

Joined: 2011-03-17
Posts: 4
Posted: Thu, 2011-03-17 02:53
Quote:
every item in gallery has an ID be it an album, photo, thumbnail, resize, movie, user, module, theme.... these are numeric and consecutive based on creation order.

OK. This information - is it just located within g2-data or is it also in the directory where gallery is installed?

thanks again

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2011-03-17 03:13

this information is in the DB.
for instance a single photo may have a g2_entityId == 2200
but the thumbnail(a derivative and child) may or may not have been the next item depending on the site traffic at the time may or may not be 2201
and if resizes were checked to be built on upload or first view may or may not have ids of 2202 and 2203.

if another user was also adding items at the same time, these ids may be way out of sequence.

Honestly without tracing the true trail there is no easy way to restore an album.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2011-03-17 03:24

Previously I wrote a script to restore an old DB from the XML backup.
This may work for your needs w/ some modification.
http://gallery.menalto.com/node/94122

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
j080428

Joined: 2011-03-17
Posts: 4
Posted: Thu, 2011-03-17 03:51

Many thanks for your help, I'll let you know how I get on.