hi!
on a multisite installation, as I described in [Forum, topic 22170] multisite, wrong documentation in wiki, physical albums will access from every single multisite the same galleries directory.
so, for example, with Tools -> Site Manager two different single multisites can just choose the same galleries directory. which is in fact already immediatly after installing the single multisite, because first directory is always ./galleries/.
the only simple way I see to correct this is at that time when the user setups a new galleries directory with automatically prefixing the path with the multisites path.
--- admin/site_manager.php 2013-01-01 13:35:02.000000000 +0100 +++ admin/site_manager.php 2013-05-30 22:24:05.000000000 +0200 @@ -55,6 +55,10 @@ } $url = preg_replace('/[\/]*$/', '', $_POST['galleries_url']); $url.= '/'; + if (isset($conf['site_dir'])) + { + $url = $conf['site_dir'] . '/' . $url; + } if ( ! (strpos($url, '.') === 0 ) ) { $url = './' . $url;
and set site_dir in local/config/config.inc.php
if (preg_match('/^piwigo.kmp.or.at$/', $_SERVER['SERVER_NAME'])) { $site_dir = 'gallery/kmp'; } if (isset($site_dir)) { define('PWG_LOCAL_DIR', $site_dir.'/local/'); $conf['upload_dir'] = './'.$site_dir.'/upload'; $conf['data_location'] = $site_dir.'/_data/'; $conf['site_dir'] = $site_dir; # in case there is a specific configuration file for each "site" @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php'); }
in any case you need to adapt the path of the first galleries directory ./galleries in the database itself.
what Do you think of my solution?
gre3tings, Klaus
Offline
I think you should add it in the wiki first
Offline
I fully agree that multisite feature is not compatible with synchronization. I have implemented it with synchronization disabled in mind.
I think the idea of introducing $conf['site_dir'] is smart.
I'm not sure that it's what you meant, but it would be good if the site_dir was invisible to the user. For example, we should have only "galleries" and it would automatically mean $conf['site_dir']/galleries (in site_update + site_manager)
I would also like that (if multisite) directories added in the directory manager could only be within site_dir. The idea is to avoid ../others_site/galleries if you understand what I mean.
Offline
hugh!
plg wrote:
I think the idea of introducing $conf['site_dir'] is smart.
thanks, it was just the fastest way for me.
plg wrote:
I'm not sure that it's what you meant, but it would be good if the site_dir was invisible to the user. For example, we should have only "galleries" and it would automatically mean $conf['site_dir']/galleries (in site_update + site_manager)
you are completly right for a huge site as piwigo.com, but I'd like to host here maximum 6 piwigos. and all of them are friends. :-) and anyhow, you will get the path from the html source code eg:
<link rel="stylesheet" type="text/css" href="gallery/kmp/_data/combined/15bx769.css">
plg wrote:
I would also like that (if multisite) directories added in the directory manager could only be within site_dir. The idea is to avoid ../others_site/galleries if you understand what I mean.
understood, but this shoud be achievable with just some normalizing the path. means some regex in removing everything with . and / afterwards, multiple / and / at beginning and end.
--- admin/site_manager.php 2013-01-01 13:35:02.000000000 +0100 +++ admin/site_manager.php 2013-05-31 17:06:31.000000000 +0200 @@ -33,6 +33,11 @@ // +-----------------------------------------------------------------------+ check_status(ACCESS_ADMINISTRATOR); +if (!$conf['enable_synchronization']) +{ + die ('synchronization is disabled'); +} + if (!empty($_POST) or isset($_GET['action'])) { check_pwg_token(); @@ -53,8 +58,12 @@ { fatal_error('remote sites not supported'); } - $url = preg_replace('/[\/]*$/', '', $_POST['galleries_url']); + $url = preg_replace(array('/\/+/', '/(\.+\/)|(^\/)|(\/$)/'), array('/', ''), $_POST['galleries_url']); $url.= '/'; + if (isset($conf['site_dir'])) + { + $url = $conf['site_dir'] . '/' . $url; + } if ( ! (strpos($url, '.') === 0 ) ) { $url = './' . $url;
gre3tings, Klaus
Offline
hi to all!
just documented also that topic in Wiki: Multiple Site (Multisite) - Physical Albums.
I would be pleased to receive your feedback.
gre3tings, Klaus
Offline