I have made changes and it seems to work fine for language files, database connection settings and configuration settings, but I still have problems with CSS files.
Here are the changes I made:
$ svn diff include/constants.php include/template.class.php Index: include/constants.php =================================================================== --- include/constants.php (revision 8719) +++ include/constants.php (working copy) @@ -27,6 +27,7 @@ define('PHPWG_DEFAULT_TEMPLATE', 'Sylvia'); define('PHPWG_THEMES_PATH', $conf['themes_dir'].'/'); +define('PWG_COMBINED_DIR', PWG_LOCAL_DIR.'combined/'); // Required versions define('REQUIRED_PHP_VERSION', '5.0.0'); Index: include/template.class.php =================================================================== --- include/template.class.php (revision 8719) +++ include/template.class.php (working copy) @@ -797,13 +797,13 @@ $css = array(); foreach ($smarty->get_template_vars('themes') as $theme) { - $f = 'local/css/'.$theme['id'].'-rules.css'; + $f = PWG_LOCAL_DIR.'css/'.$theme['id'].'-rules.css'; if (file_exists(PHPWG_ROOT_PATH.$f)) { array_push($css, "{combine_css path='$f' order=10}"); } } - $f = 'local/css/rules.css'; + $f = PWG_LOCAL_DIR.'css/rules.css'; if (file_exists(PHPWG_ROOT_PATH.$f)) { array_push($css, "{combine_css path='$f' order=10}"); @@ -1133,7 +1133,7 @@ /*Allows merging of javascript and css files into a single one.*/ final class FileCombiner { - const OUT_SUB_DIR = 'local/combined/'; + const OUT_SUB_DIR = PWG_COMBINED_DIR; private $type; // js or css private $files = array(); private $versions = array();
but:
[pierrick@pierrick-desktop] ~/public_html/piwigo/dev/trunk
$ cat local/combined/uw2xo6.css | grep '^\/\*BEGIN'
/*BEGIN themes/default/theme.css */
/*BEGIN themes/default/print.css */
/*BEGIN themes/clear/theme.css */
/*BEGIN local2/css/clear-rules.css */
/*BEGIN local2/css/rules.css */
the local combined script uses the local2 CSS files :-/
Offline
I'not sure to understand... what are the expected results ?
Offline
grum wrote:
I'not sure to understand... what are the expected results ?
[pierrick@pierrick-desktop] ~/public_html/piwigo/dev/trunk
$ cat local/combined/123abc.css | grep '^\/\*BEGIN'
/*BEGIN themes/default/theme.css */
/*BEGIN themes/default/print.css */
/*BEGIN themes/clear/theme.css */
/*BEGIN local/css/clear-rules.css */
/*BEGIN local/css/rules.css */
[pierrick@pierrick-desktop] ~/public_html/piwigo/dev/trunk
$ cat local2/combined/456def.css | grep '^\/\*BEGIN'
/*BEGIN themes/default/theme.css */
/*BEGIN themes/default/print.css */
/*BEGIN themes/clear/theme.css */
/*BEGIN local2/css/clear-rules.css */
/*BEGIN local2/css/rules.css */
Offline
you have to keep the hard coded 'local' lines, something like :
@@ -797,13 +797,13 @@ $css = array(); foreach ($smarty->get_template_vars('themes') as $theme) { $flocal = 'local/css/'.$theme['id'].'-rules.css'; $flocal_galery = PWG_LOCAL_DIR.'css/'.$theme['id'].'-rules.css'; if (file_exists(PHPWG_ROOT_PATH.$flocal)) { array_push($css, "{combine_css path='$flocal' order=10}"); } if (file_exists(PHPWG_ROOT_PATH.$flocal_galery)) { array_push($css, "{combine_css path='$flocal_galery' order=10}"); } } $flocal = 'local/css/rules.css'; $flocal_galery = PWG_LOCAL_DIR.'css/rules.css';
and you will have 2 files :
one in the local directory
another one in the LOCAL_DIR directory
the best way seems to implement a function with one paramete and called twice (with 'local' and LOCAL_DIR as parameter)
Offline
That seems to be the way for having a common local + site local, but this is not the problem. The problem is that the site with "local" as local dir should use the local/css/* files and not the local2/css/* files.
Offline
I've commited my current code in [Subversion] r8722
Offline
rvelices wrote:
it seems ok to me ...
You mean you made the test with a local/config/multisite.inc.php with the following code:
<?php $conf['local_dir_site'] = 'local2/'; ?>
and you didn't see any problem?
(and change again to local3 for example)
Offline
plg wrote:
rvelices wrote:
it seems ok to me ...
You mean you made the test with a local/config/multisite.inc.php with the following code:
Code:
<?php $conf['local_dir_site'] = 'local2/'; ?>and you didn't see any problem?
(and change again to local3 for example)
no, i didn't make those tests. to be honest i don't get exactly what you are trying to do - it seems to me you are doing more than just replace 'local' with 'local2', otherwise i don't see why it should not work
Offline
rvelices wrote:
no, i didn't make those tests. to be honest i don't get exactly what you are trying to do - it seems to me you are doing more than just replace 'local' with 'local2', otherwise i don't see why it should not work
After another investigation, I noticed that the list of CSS files was correct if I purge compiled templates each time I change the $conf['local_dir_site']. If I set $conf['template_force_compile'] = true then it's OK (but it's not a solution).
I suppose the list of CSS files is in the compiled template and that the template "key" is not related to the $conf['local_dir_site'] (of course).
This it not a big deal, since I consider each site should have a distinct _data directory, once you set a distinct $conf['local_data_dir'] for each site, the problem disappears. We will have to make it obvious in the documentation.
Offline
plg wrote:
After another investigation, I noticed that the list of CSS files was correct if I purge compiled templates each time I change the $conf['local_dir_site']. If I set $conf['template_force_compile'] = true then it's OK (but it's not a solution).
I suppose the list of CSS files is in the compiled template and that the template "key" is not related to the $conf['local_dir_site'] (of course).
This it not a big deal, since I consider each site should have a distinct _data directory, once you set a distinct $conf['local_data_dir'] for each site, the problem disappears. We will have to make it obvious in the documentation.
It is normal because the local css is a smarty prefilter. A smarty prefilter is called only when compiling the template. I have asked P@t to use a prefilter so that we don't look at every page hit weather the local css file is there
Offline
Offline