Advanced search  

News:

cpg1.5.46 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter recently discovered vulnerabilities. It is important that all users who run version cpg1.5.44 or older update to this latest version as soon as possible.
[more]

Pages: [1] 2   Go Down

Author Topic: Can I bridge two Coppermine galleries  (Read 13871 times)

0 Members and 1 Guest are viewing this topic.

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Can I bridge two Coppermine galleries
« on: August 22, 2007, 08:19:47 pm »

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)
« Last Edit: August 28, 2007, 02:04:35 pm by Nibbler »
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #1 on: August 22, 2007, 08:59:20 pm »

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)

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Can I bridge two Coppermine galleries
« Reply #2 on: August 23, 2007, 07:35:19 am »

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
Code: [Select]
$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: [Select]
// 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?

Coppermine version: cpg1.4.10
Most recent stable release is cpg1.4.12 - upgrade!
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #3 on: August 23, 2007, 01:44:22 pm »

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)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Can I bridge two Coppermine galleries
« Reply #4 on: August 23, 2007, 05:12:51 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"?

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.

The 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.

Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #5 on: August 23, 2007, 05:54:52 pm »

What is "SMP"?

Sorry SMF.

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.

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)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Can I bridge two Coppermine galleries
« Reply #6 on: August 23, 2007, 06:36:38 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.

I'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.

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.
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.
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #7 on: August 23, 2007, 07:52:16 pm »

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)
Logged

Nibbler

  • Guest
Re: Can I bridge two Coppermine galleries
« Reply #8 on: August 23, 2007, 08:08:28 pm »

Code: [Select]
// 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.
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #9 on: August 24, 2007, 02:57:34 pm »

Great. Thanks a lot GauGau

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

Mimer  8)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47844
  • aka "GauGau"
    • gaugau.de
Re: Can I bridge two Coppermine galleries
« Reply #10 on: August 24, 2007, 04:41:01 pm »

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.
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #11 on: August 24, 2007, 11:54:15 pm »

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

Mimer  8)
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #12 on: August 27, 2007, 12:34:29 am »

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:
Code: [Select]
$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:
Code: [Select]
$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
Code: [Select]
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)
Logged

Nibbler

  • Guest
Re: Can I bridge two Coppermine galleries
« Reply #13 on: August 27, 2007, 01:00:52 am »

Where did this come from?

Code: [Select]
$connection = mysql_connect("mysql1044.servage.net",
                            "gallery_a",
                            "rollover");
mysql_select_db("gallery_a", $connection);

Remove it.
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #14 on: August 27, 2007, 01:48:32 am »

Code removed.

I get:
Code: [Select]
Fatal error :
I am not sure, where to setup permission for the mysql user to access Database1.

From init.inc.php in gallery_b:
Code: [Select]
$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)
Logged

Nibbler

  • Guest
Re: Can I bridge two Coppermine galleries
« Reply #15 on: August 27, 2007, 02:02:53 am »

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.
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #16 on: August 27, 2007, 10:33:46 am »

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:
Quote
I 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:
Quote
I am sorry to say that a second user for a database cannot be created.

Me:
Quote
Can 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:
Quote
No, 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)
Logged

Nibbler

  • Guest
Re: Can I bridge two Coppermine galleries
« Reply #17 on: August 27, 2007, 12:40:35 pm »

You'll have to use the same database then.
Logged

Mimer

  • Translator
  • Coppermine frequent poster
  • **
  • Offline Offline
  • Gender: Male
  • Posts: 129
    • Fjotte
Re: Can I bridge two Coppermine galleries
« Reply #18 on: August 28, 2007, 02:03:30 pm »

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)
Logged

krzysiek1015

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Can I bridge two Coppermine galleries
« Reply #19 on: September 05, 2008, 12:30:42 pm »

Code: [Select]
// 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 :'(
Logged
Pages: [1] 2   Go Up
 

Page created in 0.03 seconds with 20 queries.