Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Configure::dump()
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mark_story  
View profile  
 More options Apr 20 2012, 9:59 pm
From: mark_story <mark.st...@gmail.com>
Date: Fri, 20 Apr 2012 18:59:08 -0700 (PDT)
Local: Fri, Apr 20 2012 9:59 pm
Subject: Configure::dump()

When configure was reworked and config file format readers were added in
2.0, I made the stupid mistake of not including functionality to write
configuration files. I'm hoping to fix that in 2.2.  While I don't think
its reasonable to modify the underlying interface as doing that will cause
issues for people upgrading.  Instead I think conditionally checking for a
`dump` method on the attached reader objects.  These also have bad names
now, but I think that's something that will need to be solved in a future
version.  Changing the names now would be nice, but causes additional pain
when upgrading.

So far I have things working, but wanted to double check the API I was
considering.

Configure::dump($filename, $config = 'default');

Dumps all the data stored in Configure into $filename.  The $config reader
is used to serialize the data into the appropriate format.  I wonder if
Configure should be writing files, or simply returning the string version
of the data, and let the end developer dump the configuration into a
file/save to the database.

I have the changes in a branch, you can see the diffs at:

https://github.com/markstory/cakephp/compare/2.2...2.2-configure

Let me know what you think.

-Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ADmad  
View profile  
 More options Apr 21 2012, 8:39 am
From: ADmad <admad.co...@gmail.com>
Date: Sat, 21 Apr 2012 05:39:54 -0700 (PDT)
Local: Sat, Apr 21 2012 8:39 am
Subject: Re: Configure::dump()

I missed this feature and never got around to adding it myself, thanks Mark
for adding it. :)

The writing of the file could perhaps be handled differently. As i
commented on github by default I would prefer to have the file being
written into the directory pointed by reader's $_path property instead of
having to provide full path each time. Having the data returned instead of
being written to file could also be useful so perhaps add a third param
$return for it?

-ADmad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mark_story  
View profile  
 More options Apr 21 2012, 9:14 pm
From: mark_story <mark.st...@gmail.com>
Date: Sat, 21 Apr 2012 18:14:37 -0700 (PDT)
Local: Sat, Apr 21 2012 9:14 pm
Subject: Re: Configure::dump()

ADmad: Not a problem, it was easier than I thought it would be.  

I've added another commit to make the file writing happen in the
adapters/reader classes.  Thanks for the feedback on that guys :)

I'm wondering if it makes sense to also allow only saving a set of keys, so
Configure::dump('config.ini', 'ini', array(...));  This would only dump the
defined top level keys.  Defining no keys includes all of them. I think
always dumping all of the configuration values might not always be what's
wanted in a configuration persistence tool.  I'm thinking of a
CMS/application setup where you need to ask the user for some specific
data, that you want to load in later requests.  You probably don't want to
save out all of the current Configure state, and just the keys that section
of the application requires.

-Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ADmad  
View profile  
 More options Apr 22 2012, 2:26 pm
From: ADmad <admad.co...@gmail.com>
Date: Sun, 22 Apr 2012 11:26:01 -0700 (PDT)
Local: Sun, Apr 22 2012 2:26 pm
Subject: Re: Configure::dump()

I very much like the idea of being able to save only specific set of keys.
As you mentioned that would be a common use case in CMS/applications.

-ADmad


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mark_story  
View profile  
 More options Apr 26 2012, 12:35 pm
From: mark_story <mark.st...@gmail.com>
Date: Thu, 26 Apr 2012 09:35:36 -0700 (PDT)
Local: Thurs, Apr 26 2012 12:35 pm
Subject: Re: Configure::dump()

Ok, I'll update the code to allow that. The method signature will end up
looking like.

Configure::dump($identifier, $config = 'default', $keys = null)

Where $keys can be an array of data you want to dump.  By default all keys
are dumped.

-Mark


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »