chamilo-lms icon indicating copy to clipboard operation
chamilo-lms copied to clipboard

Move settings from configuration.php to .env or to the Database

Open jmontoyaa opened this issue 6 years ago • 6 comments

Specifications by @ywarnier:

  • maintain configuration.dist.php in master code until everything has been transfered (starting around param 'aspell_temp_dir', everything can be moved to the database)
  • all DB or file changes in PHP comments should be applied automatically to both the installation of Chamilo 2 and the migration from 1.11
  • any moved setting should progressively be removed from configuration.dist.php so we can see the progress
  • the values used in the database of 2.0 should use the values set in configuration.php in 1.11 (if they exist, and by default be "false")
  • all code using api_get_configuration_value(x) should be changed to api_get_setting(x)

There are chances this requires more than 100h of work because there are currently 497 settings in configuration.dist.php (cat main/install/configuration.dist.php | grep \$_configuration | wc).

Status

Settings removed:

configuration.php Comment
session_stored_in_db
root_web
$extAuthSource["cas"]
$extAuthSource["extldap"]
$_configuration['facebook_auth']
$extAuthSource["external_login"]
memcache_server
session_stored_after_n_times
aspell_bin
aspell_opts
aspell_temp_dir

Settings moved to .env

configuration.php v1 .env name v2
db_host DATABASE_HOST
db_port DATABASE_PORT
main_database DATABASE_NAME
db_user DATABASE_USER
db_password DATABASE_PASSWORD

Settings moved in the Database

configuration.php in v1 Setting in the database v2
default_template display.default_template
session_hide_tab_list session.hide_tab_list
lp_fixed_encoding lp.fixed_encoding
show_invisible_exercise_in_lp_list lp.show_invisible_exercise_in_lp_toc
force_edit_exercise_in_lp lp.allow_edit_exercise_in_lp
announcements_hide_send_to_hrm_users announcement.hide_send_to_hrm_users
hide_my_certificate_link certificate.hide_my_certificate_link
hide_header_footer_in_certificate certificate.hide_header_footer

jmontoyaa avatar Sep 20 '18 07:09 jmontoyaa

So memcache_server will be removed? And using memcache_server configuration is only in the php.ini then?

22phuber avatar Nov 16 '19 12:11 22phuber

@22phuber Not really, you can configure that setting in your Apache vhost (or the php-fpm config for your pool if using nginx). Do you actually use the memcache_server setting from Chamilo?

ywarnier avatar Nov 18 '19 11:11 ywarnier

@ywarnier Well i configured it at least. But i never checked if it does what it should:

$_configuration['memcache_server'] = array(
    0 => array(
        'host' => getenv('MEMCACHED_HOSTNAME'),
        'port' => '11211',
    )
);

I also configured memcache inside the php.ini

session.save_handler    = "memcached"
session.save_path       = "MEMCACHED_HOSTNAME:11211"

I can see values in memcached so i thought that it is working properly.

22phuber avatar Nov 28 '19 06:11 22phuber

Note so self: make a list of settings in configuration.php to either .env or the database. Each has to be analysed.

ywarnier avatar Nov 29 '19 10:11 ywarnier

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '20 18:07 stale[bot]

The DB settings are now in .env file. We will still use configuration.php for the rest of settings, we can move this issue to v3

jmontoyaa avatar Dec 04 '20 15:12 jmontoyaa

Hi @ywarnier , it is moved settings from configuration.php to database and .env in this PR https://github.com/chamilo/chamilo-lms/pull/4613

Thanks for confirmation.

christianbeeznest avatar Feb 19 '23 00:02 christianbeeznest