Can I bridge two Coppermine galleries Can I bridge two Coppermine galleries
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Can I bridge two Coppermine galleries

Started by Mimer, August 22, 2007, 08:19:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Mimer

I've searched the support forum and googled all day, but cannot find any answer.
Is it possible to bridge two or more Coppermine galleries, but NO BBS?

I need to transfer info about members between my galleries. That is login info, group info, profile info etc.

I cannot do this from a BBS, since I need my members to be in more than one group.
If I bridge coppermine with a BBS, the members can only be in the group transfered from the BBS.
Example:
Member1 in PictureGroup
Member2 in PictureGroup and VideoGroup

So if I can use Coppermine Gallery 1 as a master gallery, is there a way to transfere all settings and auto-login to Coppermine Gallery 2?

Best regards

Mimer  8)

NB no links to sites, because I haven't bridged anything yet, right? (The mandetory stuff)

Mimer

Well anyway:

Coppermine install: http://fjotte.dk/galleryd/
Forum install:
Coppermine version: cpg1.4.10
Forum version:
Test user account: tester / tester

BridgeManager settings:
Forum URL:
Relative path to your BBS's config file:
Use post-based groups?:

Mimer  8)
Cookie name/preifx (if applicable)


Joachim Müller

If both galleries reside on the same server (needed for cookie authentification) and the both galleries use the same database, then yes: you can share the users and groups tables between two coppermine installs. Edit include/init,inc.php of the coppermine gallery that is suppossed to abandon their users and groups and share it with the other gallery. Let's assume that you chose "cpg14xA_" as the table prefix for gallery A and "cpg14xB_" for gallery B. Gallery B is suppossed to share users and groups with gallery A. As suggested above, edit include/init.inc.php of gallery B, find$CONFIG['TABLE_USERGROUPS'] = $CONFIG['TABLE_PREFIX'].'usergroups';
$CONFIG['TABLE_VOTES']      = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']      = $CONFIG['TABLE_PREFIX'].'users';
$CONFIG['TABLE_BANNED']     = $CONFIG['TABLE_PREFIX'].'banned';
and replace with// code changed to bridge two galleries - needs to be re-done every time you upgrade
$CONFIG['TABLE_USERGROUPS'] = 'cpg14xA_'.'usergroups';
$CONFIG['TABLE_VOTES']      = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']      = 'cpg14xA_'.'users';
$CONFIG['TABLE_BANNED']     = 'cpg14xA_'.'banned';

Explanation: usually, the code section we just changed means: use the table prefix you chose during install with the table prefix chosen during coppermine's install. With the code change, you specify that some tables will be used from another install (uisng another prefix).

However: this has been asked before, and we have advised users similarly. When taking a closer look it became obvious though that the idea to have two separate galleries was not a bright idea in the first place and that the goal the user had in mind would have been achievable with only one gallery as well. Subsequently, my question would be: what's the point in maintaining two galleries on your server?

Quote from: Mimer on August 22, 2007, 08:59:20 PM
Coppermine version: cpg1.4.10
Most recent stable release is cpg1.4.12 - upgrade!

Mimer

All galleries upgradet to Coppermine version: cpg1.4.12

Both (All) galleries reside on the same server, and on the same domain, but don't use the same database.
Is there a way to use or transfere the info from one database to another?

There is several reasons for me to use more than one gallery:
1. Limitations in MySQL. The size of the database will become HUGE. The first gallery must hold more than 60.000 pictures and videos, with both thumbs and mid pictures.
2. Maintenance of Coppermine. My galleries have nine categories, each with subcategories from A-Z, each with several "Persons" subcategories and each have at least a "Picture Album" and a "Video Album".
If I double or trible this it will become almost imposible to maintain. I already have time out problems.
(ex. Home > Danish Pornmodels > Danish Pornmodels K > Kira Eggers > Kira Eggers Pictures Solo)

It's a workaround instead of bridging with PHP-Fusion. Members at my BBS must have access to my galleries "Danish Gallery", "International Gallery" and "Adult Gallery", but not all member can have access to "Adult Gallery" since they are not +18 of age. Other members can watch pictures but not videos - managed in different groups.
If I can use or transfere the user info from one gallery to another, members "only" have to register once in the BBS and once in the galleries.

I thought of using the bridge (MOD) Coppermine -> SMP and the bridge SMP -> coppermine. I could then use the SMP for login to the galleries, but there must be a simpler way.

Best regards
Mimer  8)

Joachim Müller

Quote from: Mimer on August 23, 2007, 01:44:22 PM
I thought of using the bridge (MOD) Coppermine -> SMP and the bridge SMP -> coppermine. I could then use the SMP for login to the galleries, but there must be a simpler way.
What is "SMP"?

Quote from: Mimer on August 23, 2007, 01:44:22 PM
Both (All) galleries reside on the same server, and on the same domain, but don't use the same database.
Is there a way to use or transfere the info from one database to another?
Sure, use phpMyAdmin.

Quote from: Mimer on August 23, 2007, 01:44:22 PMThe first gallery must hold more than 60.000 pictures and videos
Coppermine can handle much larger galleries. In fact, this depends on the power of your server. Workarounds with two separate installs on shared webhosting will not perform nearly as well as one gallery on one powerfull dedicated server.


Mimer

Quote from: GauGau on August 23, 2007, 05:12:51 PM
What is "SMP"?

Sorry SMF.

Quote from: GauGau on August 23, 2007, 05:12:51 PM
Sure, use phpMyAdmin.

OK, maybe it wasn't that clear what I ment. I don't need a onetime transfere of data from one database to another.
I'll try to make it more clear:
1. When a new member register in one gallery, they don't have to register to second or third gallery (the same data are used, but in another database).
2. When members login to one gallery, they don't need to login to second or third gallery.
3. All settings for a member are the same in the second or third gallery, as in the gallery they login to.

Quote from: GauGau on August 23, 2007, 05:12:51 PM
Coppermine can handle much larger galleries. In fact, this depends on the power of your server. Workarounds with two separate installs on shared webhosting will not perform nearly as well as one gallery on one powerfull dedicated server.

I've expirenced that if the database gets larger than 20 MB it's real faulty and slow.

Anyway, this is mostly for fun. My way to learn more about PHP, SQL, BBS and Coppermine. Possiblities and limitations.
I guess I have to make somekind of script to extract data from one database and put it in another. I read som thread yesterday about auto-register, maybe this is the way to do it.

http://forum.coppermine-gallery.net/index.php?topic=45867.msg218152#msg218152

Best regards

Mimer  8)

Joachim Müller

Quote from: Mimer on August 23, 2007, 05:54:52 PM
OK, maybe it wasn't that clear what I ment. I don't need a onetime transfere of data from one database to another.
I'll try to make it more clear:
1. When a new member register in one gallery, they don't have to register to second or third gallery (the same data are used, but in another database).
2. When members login to one gallery, they don't need to login to second or third gallery.
3. All settings for a member are the same in the second or third gallery, as in the gallery they login to.
That's what my code changes in my first reply are supposed to do. It's not a one-time-importer, but a permanent solution.

Quote from: Mimer on August 23, 2007, 05:54:52 PMI've expirenced that if the database gets larger than 20 MB it's real faulty and slow.
Can not replicate. mySQL is capable to easily handle database with that size. If it gets slow, you should look for better webhosting with better server resources (more RAM, more CPU cycles). If you want your site to become a busy adult site with a lot of material and a lot of visitors you better consider getting decent webhosting as well that can handle the traffic and server load.

Quote from: Mimer on August 23, 2007, 05:54:52 PMAnyway, this is mostly for fun. My way to learn more about PHP, SQL, BBS and Coppermine. Possiblities and limitations.
I guess I have to make somekind of script to extract data from one database and put it in another. I read som thread yesterday about auto-register, maybe this is the way to do it.
As I suggested: run everything in one gallery instead of trying to come up with wannabe-solutions that just doctor the symptoms instead of finding a cure. Just get more server power. Can't recommend any of those workarounds.

Mimer

Thanks. All your help are apreciated.

I will try your first solution.

A final question:
Is there a simulare solution, but keeping separate databases.

Mimer  8)

Nibbler


// code changed to bridge two galleries - needs to be re-done every time you upgrade
$CONFIG['TABLE_USERGROUPS'] = 'databasename.cpg14xA_'.'usergroups';
$CONFIG['TABLE_VOTES']      = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']      = 'databasename.cpg14xA_'.'users';
$CONFIG['TABLE_BANNED']     = 'databasename.cpg14xA_'.'banned';


Then setup permissions for the mysql user to access the other db.

Mimer

Great. Thanks a lot GauGau

I'll post the final result before closing this topic, right?

Mimer  8)

Joachim Müller

Last reply was made by Nibbler, not me ::).
Yes, we welcome users who start a thread resolving them as well. So please reply here with something like "worked as expected" or similar. A moderator will then mark this thread accordingly.

Mimer

...and thanks to Nibbler too! You guys rock.

Mimer  8)

Mimer

Quote from: Nibbler on August 23, 2007, 08:08:28 PM
Then setup permissions for the mysql user to access the other db.

Hm, I cannot really figure that out.

I have setup two galleries and two databases for testing:
http://www.fjotte.com/gallery_a/
http://www.fjotte.com/gallery_b/
Database1: gallery_a with table prefix cpg14xA_
Database2: gallery_b with table prefix cpg14xb_
cookie set to the same on both galleries: cpg141

Account for gallery_a:
Username: tester
Password: tester

To access Database1 I use this code in init.inc.php:
$connection = mysql_connect("mysql1044.servage.net",
                            "gallery_a",
                            "rollover");
mysql_select_db("gallery_a", $connection);


No errors

With Nibblers code I get this in init.inc.php:
$CONFIG['TABLE_PICTURES']   = $CONFIG['TABLE_PREFIX'].'pictures';
$CONFIG['TABLE_ALBUMS']     = $CONFIG['TABLE_PREFIX'].'albums';
$CONFIG['TABLE_COMMENTS']   = $CONFIG['TABLE_PREFIX'].'comments';
$CONFIG['TABLE_CATEGORIES'] = $CONFIG['TABLE_PREFIX'].'categories';
$CONFIG['TABLE_CONFIG']     = $CONFIG['TABLE_PREFIX'].'config';
$CONFIG['TABLE_USERGROUPS'] = 'gallery_a.cpg14xA_'.'usergroups';
$CONFIG['TABLE_VOTES']      = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']      = 'gallery_a.cpg14xA_'.'users';
$CONFIG['TABLE_BANNED']     = 'gallery_a.cpg14xA_'.'banned';
$CONFIG['TABLE_EXIF']       = $CONFIG['TABLE_PREFIX'].'exif';
$CONFIG['TABLE_FILETYPES']  = $CONFIG['TABLE_PREFIX'].'filetypes';
$CONFIG['TABLE_ECARDS']     = $CONFIG['TABLE_PREFIX'].'ecards';
$CONFIG['TABLE_TEMPDATA']   = $CONFIG['TABLE_PREFIX'].'temp_data';
$CONFIG['TABLE_FAVPICS']    = $CONFIG['TABLE_PREFIX'].'favpics';
$CONFIG['TABLE_BRIDGE']     = $CONFIG['TABLE_PREFIX'].'bridge';
$CONFIG['TABLE_VOTE_STATS'] = $CONFIG['TABLE_PREFIX'].'vote_stats';
$CONFIG['TABLE_HIT_STATS']  = $CONFIG['TABLE_PREFIX'].'hit_stats';
// Connect to database
($CONFIG['LINK_ID'] = cpg_db_connect()) || die('<b>Coppermine critical error</b>:<br />Unable to connect to database !<br /><br />MySQL said: <b>' . mysql_error() . '</b>');
$connection = mysql_connect("mysql1044.servage.net",
                            "gallery_a",
                            "rollover");
mysql_select_db("gallery_a", $connection);
// Retrieve DB stored configuration
$results = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CONFIG']}");
while ($row = mysql_fetch_array($results)) {
    $CONFIG[$row['name']] = $row['value'];
} // while
mysql_free_result($results);


I get this
Fatal error:

I am not sure, where to setup permission for the mysql user to access the other db.

Can you give me a clue, Nibbler?

Best regards
Mimer  8)

Nibbler

Where did this come from?


$connection = mysql_connect("mysql1044.servage.net",
                            "gallery_a",
                            "rollover");
mysql_select_db("gallery_a", $connection);


Remove it.

Mimer

Code removed.

I get:
Fatal error :

I am not sure, where to setup permission for the mysql user to access Database1.

From init.inc.php in gallery_b:
$CONFIG['TABLE_PICTURES']   = $CONFIG['TABLE_PREFIX'].'pictures';
$CONFIG['TABLE_ALBUMS']     = $CONFIG['TABLE_PREFIX'].'albums';
$CONFIG['TABLE_COMMENTS']   = $CONFIG['TABLE_PREFIX'].'comments';
$CONFIG['TABLE_CATEGORIES'] = $CONFIG['TABLE_PREFIX'].'categories';
$CONFIG['TABLE_CONFIG']     = $CONFIG['TABLE_PREFIX'].'config';
$CONFIG['TABLE_USERGROUPS'] = 'gallery_a.cpg14xA_'.'usergroups';
$CONFIG['TABLE_VOTES']      = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']      = 'gallery_a.cpg14xA_'.'users';
$CONFIG['TABLE_BANNED']     = 'gallery_a.cpg14xA_'.'banned';
$CONFIG['TABLE_EXIF']       = $CONFIG['TABLE_PREFIX'].'exif';
$CONFIG['TABLE_FILETYPES']  = $CONFIG['TABLE_PREFIX'].'filetypes';
$CONFIG['TABLE_ECARDS']     = $CONFIG['TABLE_PREFIX'].'ecards';
$CONFIG['TABLE_TEMPDATA']   = $CONFIG['TABLE_PREFIX'].'temp_data';
$CONFIG['TABLE_FAVPICS']    = $CONFIG['TABLE_PREFIX'].'favpics';
$CONFIG['TABLE_BRIDGE']     = $CONFIG['TABLE_PREFIX'].'bridge';
$CONFIG['TABLE_VOTE_STATS'] = $CONFIG['TABLE_PREFIX'].'vote_stats';
$CONFIG['TABLE_HIT_STATS']  = $CONFIG['TABLE_PREFIX'].'hit_stats';
// Connect to database
($CONFIG['LINK_ID'] = cpg_db_connect()) || die('<b>Coppermine critical error</b>:<br />Unable to connect to database !<br /><br />MySQL said: <b>' . mysql_error() . '</b>');
// Retrieve DB stored configuration
$results = cpg_db_query("SELECT * FROM {$CONFIG['TABLE_CONFIG']}");
while ($row = mysql_fetch_array($results)) {
    $CONFIG[$row['name']] = $row['value'];
} // while
mysql_free_result($results);


Mimer  8)

Nibbler

http://coppermine-gallery.net/tutorial/debug_mode.php

Set permissions in whatever way your host makes available for you to do so. Alternatively use the same user for both.

Mimer

Thanks for your patience  :D

debug mode enabled for gallery_b

I have asked my host about how to setup permission for the mysql user.
Me:
QuoteI have two databases:
Database1 and Database2

Each with their own mysql users:
name1 and name2

How can I setup permission for the mysql user name2 to access Database1?

My host:
QuoteI am sorry to say that a second user for a database cannot be created.

Me:
QuoteCan I setup the same username in the two databases?

That is:

I have two databases:
Database1 and Database2

With mysql user:
name1
password1

My host:
QuoteNo, the databasename and the username will be the same and it cannot be changed.

Is there anyway to get around this, Nibbler?
I am not sure, that I am asking for the right information.

Best regards
Mimer  8)

Nibbler

You'll have to use the same database then.

Mimer

OK, back to where I started.

If I have to use one database I might as well use one gallery, as stated by GauGau.

Thanks again for your support and keep up the good work.

You can close this threat.

Best regards

Mimer  8)

krzysiek1015

Quote from: Nibbler on August 23, 2007, 08:08:28 PM

// code changed to bridge two galleries - needs to be re-done every time you upgrade
$CONFIG['TABLE_USERGROUPS'] = 'databasename.cpg14xA_'.'usergroups';
$CONFIG['TABLE_VOTES']      = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']      = 'databasename.cpg14xA_'.'users';
$CONFIG['TABLE_BANNED']     = 'databasename.cpg14xA_'.'banned';


Then setup permissions for the mysql user to access the other db.
No error but not work :-[
The second base isn't taking users from the first base :'(