We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36763
    • 70 Posts
    Hi all.

    Today I broke my site, and got it back again. However in doing so, I was manually configuring the config.inc.php file, and I noticed something a little strange.

    For example we have settings like this:

    $database_type = 'mysql';
    $database_server = 'db.server.com';
    $database_user = 'database_user';
    $database_password = '$password!';
    $database_connection_charset = 'utf8';
    $dbase = 'database_name';
    $table_prefix = 'modx_';
    


    However, when we get to $database_dsn we find that it repeats the same content, only manually entered again.

    $database_dsn = 'mysql:host=db.server.com;dbname=database_name;charset=utf8';
    


    Why isn't it defined like the following instead using the previously defined variables?

    $database_dsn = 'mysql:host=' . $database_server . ';dbname=' . $dbase . ';charset=' . $database_connection_charset;
    [ed. note: vrdriver last edited this post 11 years ago.]
      • 3749
      • 24,544 Posts
      I've wondered that myself. I can't think of a good reason for doing it this way, but that doesn't mean there isn't one.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
        • 36763
        • 70 Posts
        Yeah, it's a little strange. I'm sure there's a good reason for it, but I'm just curious. smiley
          • 18373 ☆ A M B ☆
          • 3,141 Posts
          Mark Hamstra Reply #4, 11 years ago
          Sounds like a good candidate for a pull request smiley
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.