We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34162
    • 1 Posts
    Hey, guys-- as part of my manager overhaul, I had another insane thought.

    Right now we have a

    manager/includes/config.inc.php file


    Which contains pretty much just the DB info and a path setting

    Then we have an
    assets/cache/siteCache.idx.php


    Which contains cached settings

    And then we have
    modx_system_settings


    That contains the live copy of the settings

    And then we have a function that puts those together, along with setting up some additional settings

    Here’s my Dumb Question of the Day:

    Why don’t we make this something like a XML file, residing under assets, that contains all of the settings for the site?

    Pluses:
    Doesn’t require caching
    Eliminates the table
    100% of the site config is in one place
    Moves us another step closer to being able to offer MODx in environment w/ multiple installs on the same manager base.
    Can have versioning as part of the XML spec so that we can detect when the installed version is out of sync w/ the program code and automatically run the upgrade process prior to hitting the DBs.

    Feedback?
      • 25663 MODX Staff
      • 12,272 Posts
      Makes for a smaller, leaner distribution.

      And more importantly ... Moves us closer to 100% buzzword compliance:
      Now with XML configuration goodness!
        Ryan Thrash, MODX Co-Founder
        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Ten years ago my second ex-husband, the Cuban, dragged me kicking and screaming into the sql world. Now I see you are intent on dragging me into the XML world. <sigh> Can’t we just keep it simple, maybe smoke signals or something like in the good ol’ days?

        Other than that, having everything in one place where a body can put their hands on it quickly is a Good Thing.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 4673
          • 577 Posts
          So who is your fifth ex-husband?

          I’d love to here your lovely discriptions of each. Of course, this is a PG site wink

          As for the XML idea. I think it’s great. Even though SQL is such a buzz word these days it’s great to hear of the other also important technology getting it’s fair share of treatment.
            Tangent-Warrior smiley
            • 1764
            • 680 Posts
            I think it would be great to use more XML in the site. I’m not a big fan of the huge arrays that get used for caching and other things. I’ve had an entire site blow up because of one apostrophe in an alias shocked
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I only had two, the jerk and the Cuban (well, stands to reason, if the first one wasn’t a jerk he wouldn’t be an ex). My great-grandmother had five husbands; the last one was a little bitty guy everybody called Duck.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 34162
                • 1 Posts
                I am including a sample XML configuration below. For the sake of space, I removed most of the 66 settings in the application settings area with just a single line elipse. That (obviously) would not appear in the actual file. smiley

                I tried to organize things so they made sense and where things could be added easily in the future. Something else that you can see is that I’m proposing to move some of the path settings into the XML rather than computer them on every load.

                Anyway, here is my proposal. If I could get feedback that would be terrific...

                <?xml version="1.0"?>
                
                <config saveDate="2005-08-20 12:54:09" saveUser="infoclipper" saveIP="127.0.0.1">
                
                	<applicationSettings>
                		<url name="BASE_URL" value="http://www.mysite.com" default="http://www.modxcms.com" />
                
                		<string name="SITE_NAME" value="My Site" default="my site's title" />
                		<string name="SITE_CHARSET" value="iso-8859-1" default="iso-8859-1" />
                
                		<int name="SITE_START" value="5" default="1" />
                		<int name="ERROR_PAGE" value="5" default="1" />
                		...
                		<boolean name="AUTOMATIC_ALIAS" value="ON" default="OFF" />
                		<string name="FCK_EDITOR_TOOLBAR_CUSTOMSET" value="['Bold','Italic','Underline']" value="['Bold','Italic','Underline','-','Link','Unlink']" />
                	</applicationSettings>
                
                	<phpSettings>
                		<int name="MAX_EXECUTION_TIME" value="72" default="30" />
                		<boolean name="DISPLAY_ERRORS" value="ON" default="OFF" />
                		<boolean name="REGISTER_GLOBALS" value="OFF" default="OFF" />
                		<boolean name="MAGIC_QUOTES_GPC" value="OFF" default="OFF" />
                		<string name="ERROR_REPORTING" value="E_ALL ^ E_NOTICE" default="E_ALL ^ E_NOTICE" />
                	</phpSettings>
                
                	<sessionSettings>
                		<session name="SESSION_USER">
                			<alias name="SESSION_ID" value="modxUser" default="_user" />
                			<int name="SESSION_TIMEOUT" value="3600" default="0" />
                		</session>
                		<session name="SESSION_ADMIN">
                			<alias name="SESSION_ID" value="modxAdmin" default="_admin" />
                			<int name="SESSION_TIMEOUT" value="3600" default="3600" />
                		</session>
                	</sessionSettings>
                
                	<fileSettings>
                		<dir name="BASE_PATH" value="/home/httpd/mysite" default="" />
                		<directory name="DIR_LOGS" value="logs/" default="logs/" permissions="0777" />
                		<directory name="DIR_TEMPORARY" value="tmp/" default="/tmp/" permissions="0777" />
                	</fileSettings>
                
                	<debugSettings>
                		<boolean name="DEBUG_MODE" value="OFF" default="ON" />
                		<file name="DEBUG_LOG" value="debug.log" default="debug_log" permissions="0777" />
                	</debugSettings>
                
                	<miscellaneousSettings>
                		<date name="LAST_BACKUP" value="2005-Aug-18 02:12:32" default="" />
                	</miscellaneousSettings>
                
                	<databaseSettings>
                		<string name="DB_TYPE" value="mysql" default="mysql" />
                		<string name="DB_SERVER" value="localhost" default="localhost" />
                		<int name="DB_PORT" value="3306" default="3306" />
                		<string name="DB_USER" value="user" default="user" />
                		<string name="DB_PASSWORD" value="password" default="password" />
                		<string name="DB_TABLE" value="modx" default="modx" />
                		<string name="SQL_TABLE_PREFIX" value="modx_" default="modx_" />
                	</databaseSettings>
                
                </config>
                
                  • 1764
                  • 680 Posts
                  Okay, now you’ve got me thinking smiley

                  I always like to standardize things as much as possible. I find that it makes for a program that is smaller, simpler and more intuitive.

                  It seems to me that we have two different ways of handling configuration settings, the core way and the resource way. Why not combine them into one.

                  I love having the default value included, I think that will be very handy. What if we were also to add title, description, input type and options? Then we could use this same XML format for both core and resource settings. This would also allow us to generate configuration pages dynamically based on nothing more than the XML file.

                  What do you think?
                    • 34162
                    • 1 Posts
                    Adam: I’d originally had a description and option format for exactly that reason. But then I ran into an issue for which I couldn’t figure out the solution:

                    How do you support multilingual descriptions?

                    For what it’s worth, though, my first draft was modelled something like this:
                    <?xml version="1.0"?>
                    
                    <config 
                    	saveDate="2005-08-20 12:54:09" 
                    	saveUser="infoclipper" 
                    	saveIP="127.0.0.1">
                    	<applicationSettings>
                    		<description>
                    		Application Settings.  These change operation of the entire system.
                    		</description>
                    		<string name="SITE_CHARSET"
                    			value="iso-8859-1"
                    			default="iso-8859-1">
                    			<description>
                    			Charset encoding for your site.
                    			</description>
                    		</string>
                    	</applicationSettings>
                    
                    	<debugSettings>
                    		<description>
                    		Debug Settings.  These allow you to turn debugging of your site on or off.
                    		</description>
                    		<options name="DEBUG_OPTIONS">
                    			<description>
                    			If an error occurs, how should we handle the debug messages?  
                    			
                    			NOTE: These only work when debugging is set to ON!
                    			</description>
                    			<value selected="ON" default="ON">
                    				<description>
                    				Errors will sent to the log file</description>
                    				log-file
                    			</value>
                    			<value selected="ON" default="OFF">
                    				<description>
                    				Errors are emailed to the site admin
                    				</description>
                    				email
                    			</value>
                    		</options>
                    	</debugSettings>
                    </config>
                    
                      • 32963
                      • 1,732 Posts
                      Hmmm,

                      The question here is how will this affect speed? Is processing an xml file faster than reading the value from an array?

                      IMO reading the raw php codes via an include file is much faster than using an xml parser to retrieve such values.

                      That’s just my 2 cents
                        xWisdom
                        www.xwisdomhtml.com
                        The fear of the Lord is the beginning of wisdom:
                        MODx Co-Founder - Create and do more with less.