coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: bbm on August 14, 2007, 12:44:33 PM

Title: Merge 2 galleries (and 2 databases) into 1 single gallery.
Post by: bbm on August 14, 2007, 12:44:33 PM
I run 2 galleries on my site, they run in the /pix2 and /pixu directories.
Both run CPG 1.4.12 and they run very nicely. :)
/pix2 has 1800 pics (previously ran cpg149_) and
/pixu has 4000 pics (previously ran cpg132_)  ;D

I have created a an "interface" for navigating between these galleries.
(visit www.bombelman.com to see this)

I would like to be able to use RSS in the future, but 1 for the whole site,
not one separare for each gallery.  :o

I would thus like to merge both Coppermines + DBs into 1 single gallery.
This for reasons other the the RSS-thingy alone.
Like having to change each theme, whenever the other also changes.
(I did hack both galleries to use one single theme.  :P ;D)

I (re)searched the threads about this subject and there were a few
users wanting to do this, but there is no mod, plugin or fixed script
available to modify, copy and merge the databases into eachoter.
(pic-ID's need to be copied and be unique).
In other words, there was no real solution other then to dive into
the DB itself and merge the DB manualy.  :D

I'm wiling to do this for the "few" pics I currently host, before it
gets even BIGGER !  ::)

Here is what I plan to do:
1) Clone the galleries into a test-dir where I will perform the ritual.
2) Clone DBs to test-dbs.
3) Make back-ups of both galleries AND both databases (just in case).

Next, I copy the albums from /pixu gallery to the /pix2.
I would then need top copy the "info" from my cpg132_pictures
to the cpg149_pictures. (BTW, I'm the only one publishing pics.)

Here's the big question:
Is "PID" the only field that should be unique, and can I just change
these numbers to number that were not yet used in cpg149_, without
risking this info to be overwritten when uploading new pics ?

Would I do the same for the Albums ?

The Priority for merging is:
1) pictures
2) comments+hits (maybe ratings?)

next chapter:
3) users
4) e-cards etc.

Let's hope this works. Thanks everyone in advance for your input.
Title: Re: Merge 2 galleries (and 2 databases) into 1 single gallery.
Post by: Nibbler on August 14, 2007, 03:14:29 PM
You need to update the other tables that refer to the pid with the updated values.
Title: Re: Merge 2 galleries (and 2 databases) into 1 single gallery.
Post by: bbm on August 14, 2007, 03:52:19 PM
Some updates:

I would also need to update the AID (Album ID).

Here's a question, which could save me time if it's doable:
For the PIDs and AIDs I copy into an existing DB, before I
copy then, can I place prefixes before them, for instance
that all AIDs and PIDs from the to be merged DB get a letter
like "A" ? This would mean I would need to change the int(11)
to varchar255, or can I use a numerical prefix like "90" ?

The first AID of the to merge DB would be either "A1" or "901".

Would using any prefix at all have any effect on the
functionality of Coppermine ?

Cheers !!
Title: Re: Merge 2 galleries (and 2 databases) into 1 single gallery.
Post by: Nibbler on August 14, 2007, 03:58:01 PM
You can't use letters, that would mess everything up.
Title: Re: Merge 2 galleries (and 2 databases) into 1 single gallery.
Post by: bbm on August 14, 2007, 04:03:56 PM
Ok, no letters.
But you did not say if using "90" as a prefix for AID or PID is better or less worse ?  ???
Title: Re: Merge 2 galleries (and 2 databases) into 1 single gallery.
Post by: Nibbler on August 14, 2007, 04:27:10 PM
Just add 1000 to them or something.