Page 1 of 1

Make a few changes to config.php, please?

Posted: Mon Feb 07, 2011 12:10 pm
by chrishvmp
Hi Team!

After quite a few installations and management (a total with more then 150..), i want to give some input about the config.php regarding the Path Settings. Currently, these settings are in the following format: (Stripped down for reading purposes)

Code: Select all

$config['root_path'] = '/home/httpd/vhosts/domain.nl/httpdocs';
$config['admin_dir'] = 'admin';
$config['previews_path'] = '/home/httpd/vhosts/domain.nl/httpdocs/tmp/cache';
$config['uploads_path'] = '/home/httpd/vhosts/domain.nl/httpdocs/uploads';
$config['uploads_url'] = $config['root_url'] . '/uploads';
And later on (Image Settings)

Code: Select all

$config['image_uploads_path'] = '/home/httpd/vhosts/domain.nl/httpdocs/uploads/images';
$config['image_uploads_url'] = $config['root_url'] . '/uploads/images';
This method is good ofcourse, however, when changing to a different host (moving between different domains or hosting) you need to adjust all settings.

It would be far more logical, if you could do something like the following:

Code: Select all

# Admin is a dir, not a path, so it should be either on top or bottom, not somewhere in between.. I suggest right after the [i]root_url[/i] setting.
$config['admin_dir'] = 'admin';
# Same for the uploads URL
$config['uploads_url'] = $config['root_url'] . '/uploads';
# And why is the image_uploads_url any different? It's a path, and it should be kept here..
$config['image_uploads_url'] = $config['root_url'] . '/uploads/images';

# Take this path as a root, and use it in the next settings. That way you don't need to edit all paths...
$config['root_path'] = '/home/httpd/vhosts/domain.nl/httpdocs';
$config['previews_path'] = $config['root_path'].'tmp/cache';
$config['uploads_path'] = $config['root_path'].'uploads';
# Image_uploads_path is a path, so keep it here..
$config['image_uploads_path'] = $config['root_path'].'images';
I'm not quite sure if this has been proposed before, but i didn't make sense the way it is right now. If it has been proposed, what was the reason it was rejected?

Thanks in advance, and i really look forward to see this feature in 1.9.4!

Re: Make a few changes to config.php, please?

Posted: Fri Feb 11, 2011 10:19 pm
by leif
I mostly agree with chrishvmp, but I would like to take it a small step further. One of the first files that is read in is 'fileloc.php'. If that file gets an extra line:

Code: Select all

define('ROOT_PATH', dirname(__FILE__));
then the root_path could be defined as

Code: Select all

$config['root_path'] = ROOT_PATH;
which would make it independent of the specific installation. Always a good thing.

Perhaps I don't believe in 1.9.4, but sometime?

Re: Make a few changes to config.php, please?

Posted: Sat Feb 12, 2011 12:33 am
by Dr.CSS
Sounds like you know what you are doing so go for it, since you are knowledgeable enough to figure these things out guess you wont be coming around for any support, if you do just remember we can't really do support on CMSMS that has any hacked core files...

Re: Make a few changes to config.php, please?

Posted: Sat Feb 12, 2011 3:25 am
by jmcgin51
I don't think editing config.php can necessarily be counted as "hacking the core"... I have seen posts from Dev Team members recommending adding items to config.php. Surely they wouldn't recommend something that would result in the system be unsupportable... due to said officially-sanctioned "hack"... ;-)

the OP's post was just a logical reorganization of the existing config variables, as near as I can tell. The second poster's suggestion could be more accurately construed as a hack.

to the OP and the first responder - how about filing these as FRs for the Core in the Forge?

Re: Make a few changes to config.php, please?

Posted: Sat Feb 12, 2011 5:51 pm
by Dr.CSS
The only thing I've seen posted from Dev. about changing config.php has been settings that already exist in the config file, if someone were to change the order of those calls or something like that and then had problems but never bothered to tell they had done these changes it could be a big round and round till it gets figured out...

Yes if you think it's a good idea put in a FR...

Re: Make a few changes to config.php, please?

Posted: Thu Feb 24, 2011 3:39 am
by replytomk3
I was thinking of the same idea, and I second it.

Re: Make a few changes to config.php, please?

Posted: Fri Feb 25, 2011 9:32 am
by chrishvmp
Dr.CSS wrote:The only thing I've seen posted from Dev. about changing config.php has been settings that already exist in the config file, if someone were to change the order of those calls or something like that and then had problems but never bothered to tell they had done these changes it could be a big round and round till it gets figured out...

Yes if you think it's a good idea put in a FR...
And how can i do this?

Re: Make a few changes to config.php, please?

Posted: Fri Feb 25, 2011 9:37 am
by Jos