News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Settings.php

Started by Sir Osis of Liver, June 09, 2023, 01:25:56 PM

Previous topic - Next topic

Sir Osis of Liver

Will it do any harm to clean up 2.1 Settings.php?  All the comments and whitespace make it difficult to read.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sesquipedalian

I don't share you sense of aesthetics regarding readability in code, but as long as the file's contents parse correctly and it contains all the necessary information, you can safely change the formatting to suit your preferences.

The updateSettingsFile() function was rewritten in 2.1 to make it much more robust. You would have to work really hard to do something that could trip it up.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Sir Osis of Liver

This is the Cache Info section -


########## Cache Info ##########
/**
 * Select a cache system. You want to leave this up to the cache area of the admin panel for
 * proper detection of memcached, output_cache or SMF file_system
 * (you can add more with a mod).
 *
 * @var string
 */

########## Cache Info ##########
/**
 * Select a cache system. You want to leave this up to the cache area of the admin panel for
 * proper detection of memcached, output_cache, or smf file system
 * (you can add more with a mod).
 *
 * @var string
 */
$cache_accelerator = '';
/**
 * The level at which you would like to cache. Between 0 (off) through 3 (cache a lot).
 *
 * @var int
 */
$cache_enable = 0;
/**
 * This is only used for memcache / memcached. Should be a string of 'server:port,server:port'
 *
 * @var array
 */
$cache_memcached = '';
/**
 * This is only for the 'smf' file cache system. It is the path to the cache directory.
 * It is also recommended that you place this in /tmp/ if you are going to use this.
 *
 * @var string
 */



Thirty seven lines.

These are the actual settings -


$cache_accelerator = '';
$cache_enable = 0;
$cache_memcached = '';


Three lines.  And if you can't see very well, it's difficult to pick them out from all the fluff.

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sesquipedalian

I don't know why you have the first comment block in there twice.

Beyond that, you are correct that the actual settings only occupy three lines. And if you personally know what those settings mean, well and good. But many admins don't know what they mean, so explanatory comments are needed.

If you have eyesight issues that make it hard to differentiate between the comments and the text, I recommend trying a text editor that includes colour-coded syntax highlighting, like this:
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Sir Osis of Liver

Quote from: Sesquipedalian on June 09, 2023, 10:52:18 PMI don't know why you have the first comment block in there twice.

Both of my test installs have duplicate block.  Settings.php in install package does not.  When I do clean install with scratch database, I get this -


########## Cache Info ##########
/**
 * Select a cache system. You want to leave this up to the cache area of the admin panel for
 * proper detection of memcached, output_cache or SMF file_system
 * (you can add more with a mod).
 *
 * @var string
 */

########## Cache Info ##########
/**
 * Select a cache system. You want to leave this up to the cache area of the admin panel for
 * proper detection of memcached, output_cache, or smf file system
 * (you can add more with a mod).
 *
 * @var string
 */


Looking at client install I've been working on, which was upgraded from 2.0, there's only one comment block.


Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Sesquipedalian

Interesting. Must be some minor glitch in the installer, then.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Advertisement: