multiple cpg installations using the same database? multiple cpg installations using the same database?
 

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

multiple cpg installations using the same database?

Started by Lara, December 21, 2005, 05:41:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Lara

I am just wondering if it is possible installing coppermine in multiple directories using one single database? The reason therefor is that I run a multilingual website and wouldn't like to have my structure "destroyed" placing the gallery outside the language directories. Instead I would prefer installing coppermine in each of my two language folders but using a single database for it. Would that work at all?

Tranz

Yes, you just need to use a different table prefix for the second installation.

Lara

Maybe I expressed myself a bit confusing. I want to use one database and one table(prefix) = same content for all installations. It should only be placed in different directories due to my structure. I am just a bit uncertain about this because in the coppermine configuration I need to  insert the path of the installation which is saved in the database (I suppose). Does it have any negative effects if place cpg in different directories using one database/table_prefix but the path of the installation is only saved once in the database?


the structure should be like this:

de
--news
--photos
-----photos/cmg
--links
--contact

en
--news
--photos
-----photos/cmg
--links
--contact

BUT using a single database / table structure

Nibbler

Say for example you have Coppermine 'A' and Coppermine 'B'. First install these using different prefixes and check it all works. Then you can tell Coppermine B to use some of the tables that belong to Coppermine A by changing this code 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'] = $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';
$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';


For example you can do this:


$CONFIG['TABLE_PICTURES']   = 'prefix_of_coppermine_a'.'pictures';
$CONFIG['TABLE_ALBUMS']     = 'prefix_of_coppermine_a'.'albums';
$CONFIG['TABLE_COMMENTS']   = 'prefix_of_coppermine_a'.'comments';
$CONFIG['TABLE_CATEGORIES'] = 'prefix_of_coppermine_a'.'categories';
$CONFIG['TABLE_CONFIG']     = $CONFIG['TABLE_PREFIX'].'config';
$CONFIG['TABLE_USERGROUPS'] = 'prefix_of_coppermine_a'.'usergroups';
$CONFIG['TABLE_VOTES']      = 'prefix_of_coppermine_a'.'votes';
$CONFIG['TABLE_USERS']      = 'prefix_of_coppermine_a'.'users';
$CONFIG['TABLE_BANNED']     = 'prefix_of_coppermine_a'.'banned';
$CONFIG['TABLE_EXIF']       = 'prefix_of_coppermine_a'.'exif';
$CONFIG['TABLE_FILETYPES']  = 'prefix_of_coppermine_a'.'filetypes';
$CONFIG['TABLE_ECARDS']     = 'prefix_of_coppermine_a'.'ecards';
$CONFIG['TABLE_TEMPDATA']   = 'prefix_of_coppermine_a'.'temp_data';
$CONFIG['TABLE_FAVPICS']    = 'prefix_of_coppermine_a'.'favpics';
$CONFIG['TABLE_BRIDGE']     = 'prefix_of_coppermine_a'.'bridge';
$CONFIG['TABLE_VOTE_STATS'] = 'prefix_of_coppermine_a'.'vote_stats';
$CONFIG['TABLE_HIT_STATS']  = 'prefix_of_coppermine_a'.'hit_stats';


That will link them together but also allow them to have different config settings.

Lara


Abbas Ali

Another approach would be....

First install coppermineA. Then just copy coppermine files to coppermineB (don't install coppermineB).

Copy coppermineA/includes/config.inc.php to coppermineB/includes/config.inc.php

Then remove/rename coppermineB/albums folder and create a symlink coppermineB/albums poiting to coppermineA/albums  If you don't have ssh access to your site then you will need to ask your webhost to create symlink.

Doing above steps will ensure that both installations use same database as well as share same photos.
Chief Geek at Ranium Systems

dolomites

I tried this (with 1.5) with two galleries A & B

tables on same database with different prefixes

on B same data of A on config.php with different prefixes

init.inc.php of 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']    = 'prefix of A_'.'usergroups';
$CONFIG['TABLE_VOTES']         = $CONFIG['TABLE_PREFIX'].'votes';
$CONFIG['TABLE_USERS']         = 'prefix of A_'.'users';
$CONFIG['TABLE_BANNED']        = 'prefix of A_'.'banned';
$CONFIG['TABLE_EXIF']          = $CONFIG['TABLE_PREFIX'].'exif';
$CONFIG['TABLE_FILETYPES']     = $CONFIG['TABLE_PREFIX'].'filetypes';
$CONFIG['TABLE_ECARDS']        = $CONFIG['TABLE_PREFIX'].'ecards';
$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';
$CONFIG['TABLE_TEMP_MESSAGES'] = $CONFIG['TABLE_PREFIX'].'temp_messages';
$CONFIG['TABLE_CATMAP']        = $CONFIG['TABLE_PREFIX'].'categorymap';
$CONFIG['TABLE_LANGUAGE']      = $CONFIG['TABLE_PREFIX'].'languages';
$CONFIG['TABLE_DICT']          = $CONFIG['TABLE_PREFIX'].'dict';

same cookies name

and It doesn't work....users are created on A users but login of B doesn't recognize users.....it's incredible! Why?