[pLog-svn] r3804 - plog/trunk/class/config
Oscar Renalias
oscar at renalias.net
Wed Jul 26 11:53:04 GMT 2006
Never mind, I was just being thick. I was looking at the commit the wrong way...
On 7/26/06, Jon Daley <plogworld at jon.limedaley.com> wrote:
> The way you typed it is definitely a typo, I will check whether it
> is on my part or yours.
> I will check over it again - we aren't using all of that code at
> the moment, so there might be some lines that are wrong, and we wouldn't
> ever see it. I don't see where you got that line you quoted?
>
> As for your last sentence... This is the file that parses the
> config file. Wherever this file gets include()'d will work fine without
> modification.
>
> On Wed, 26 Jul 2006, Oscar Renalias wrote:
>
> > I don't think I understand this change.
> >
> > If we escape the quotes, then the following row doesn't mean what we
> > think it means:
> >
> > $config[\'key\'] = \'value\;
> >
> > Doesn't this mean a setting whose key is 'key' and whose value is
> > 'value', but *including* the single quotes?
> >
> > I did not follow the original problem that the first commit related to
> > this solved, but can't we just modify the class that parses the config
> > file to accept both single and double quotes?
> >
> > On 7/26/06, jondaley at devel.lifetype.net <jondaley at devel.lifetype.net> wrote:
> >> Author: jondaley
> >> Date: 2006-07-26 03:48:08 +0000 (Wed, 26 Jul 2006)
> >> New Revision: 3804
> >>
> >> Modified:
> >> plog/trunk/class/config/configfilestorage.class.php
> >> Log:
> >> fixes problem with the single and double quotes. configfilestorage can now
> >> handle either. I thought about writing a test case for this, but I think
> >> it is significantly hard -- to have a test case that makes different config
> >> files, and then overwrites them and checks to see if the data is valid,
> >> etc.
> >>
> >> Modified: plog/trunk/class/config/configfilestorage.class.php
> >> ===================================================================
> >> --- plog/trunk/class/config/configfilestorage.class.php 2006-07-25 18:21:17
> >> UTC (rev 3803)
> >> +++ plog/trunk/class/config/configfilestorage.class.php 2006-07-26 03:48:08
> >> UTC (rev 3804)
> >> @@ -89,12 +89,12 @@
> >> #
> >> # database settings
> >> #
> >> - $config["db_host"] = "";
> >> - $config["db_username"] = "";
> >> - $config["db_password"] = "";
> >> - $config["db_database"] = "";
> >> - $config["db_character_set"] = "default";
> >> - $config["db_persistent"] = true;
> >> + $config[\'db_host\'] = \'\';
> >> + $config[\'db_username\'] = \'\';
> >> + $config[\'db_password\'] = \'\';
> >> + $config[\'db_database\'] = \'\';
> >> + $config[\'db_character_set\'] = \'default\';
> >> + $config[\'db_persistent\'] = true;
> >> #
> >> # the database prefix will be appended to the name of each
> >> database tables in case you want
> >> # to have more than one version of plog running at the same
> >> time, such as the stable and
> >> @@ -102,7 +102,7 @@
> >> # coexist in the same unique database. If you change this
> >> after the initial configuration done
> >> # with the installation wizard, please make sure that you also
> >> rename the tables.
> >> #
> >> - $config["db_prefix"] = "";
> >> + $config[\'db_prefix\'] = \'\';
> >> ?>';
> >>
> >> include_once(
> >> PLOG_CLASS_PATH."class/file/file.class.php" );
> >> @@ -149,7 +149,7 @@
> >> $dataString = "false";
> >> }
> >> elseif( $this->_getType( $data ) == TYPE_STRING ) {
> >> - $dataString = "\"$data\"";
> >> + $dataString = "'".$data."'";
> >> }
> >> elseif( $this->_getType( $data ) == TYPE_ARRAY ) {
> >> // arrays can be recursive, so...
> >> @@ -158,7 +158,7 @@
> >>
> >> if( $key != "" ) {
> >> if( !is_numeric($key)) {
> >> - $dataString .= "\"$key\" => ";
> >> + $dataString .= "'".$key."' => ";
> >> }
> >> }
> >>
> >> @@ -169,7 +169,7 @@
> >> else
> >> $dataString .= ")";
> >>
> >> - print("dataString = ".$dataString."<br/>");
> >> + // print("dataString = ".$dataString."<br/>");
> >> }
> >> elseif( $this->_getType( $data ) == TYPE_OBJECT ) {
> >> $dataString = serialize( $data );
> >> @@ -210,12 +210,12 @@
> >> // depending if it's a string or not, we need a different
> >> regexp and a
> >> // expression that will replace the original
> >> if( $this->_getType( $value ) == TYPE_STRING ) {
> >> - $regexp = "/ *\\\$config\[\"$name\"\] *= *\"(.*)\"; */";
> >> - $replaceWith = "\$config[\"$name\"] = $valueString;";
> >> + $regexp = "/ *\\\$config\[[\"']".$name."[\"']\] *=
> >> *[\"'](.*)[\"']; */";
> >> + $replaceWith = "\$config['".$name."'] =
> >> ".$valueString.";";
> >> }
> >> else {
> >> - $regexp = "/ *\\\$config\[\"$name\"\] *= *(.*); */";
> >> - $replaceWith = "\$config[\"$name\"] = $valueString;";
> >> + $regexp = "/ *\\\$config\[[\"']".$name."[\"']\] *= *(.*);
> >> */";
> >> + $replaceWith = "\$config['".$name."'] =
> >> ".$valueString.";";
> >> }
> >>
> >> while( $i < count($contents)) {
> >> @@ -277,7 +277,7 @@
> >> function save()
> >> {
> >> foreach( $this->_props->getAsArray() as $key => $value ) {
> >> - print("saving: $key - ".htmlspecialchars($value)."<br/>");
> >> + //print("saving: $key -
> >> ".htmlspecialchars($value)."<br/>");
> >> $this->saveValue( $key, $value );
> >> }
> >>
> >>
> >> _______________________________________________
> >> pLog-svn mailing list
> >> pLog-svn at devel.lifetype.net
> >> http://devel.lifetype.net/mailman/listinfo/plog-svn
> >>
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
>
> --
> Jon Daley
> http://jon.limedaley.com/
>
> Things should be made as simple as possible, but no simpler.
> -- Albert Einstein
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
More information about the pLog-svn
mailing list