[pLog-svn] r6112 - plog/branches/lifetype-1.2/class/config
Mark Wu
markplace at gmail.com
Thu Jan 3 10:43:22 EST 2008
Hi Jon:
See \class\database\ltdb.class.php line 65 ...
$driver = $fileConfig->getValue( "db_driver", DEFAULT_DATABASE_DRIVER );
$db = PDb::getDriver( $driver );
**$driver will be "", becasue $config['db_driver'] exist, and
isset($config['db_driver'] ) will return true, the default value won't
assign to $db_driver.
If we want to adapt your fix, then we should change the above code to:
$driver = $fileConfig->getValue( "db_driver" );
if($driver == "" )
$driver = DEFAULT_DATABASE_DRIVER
As I told you, I can adapt this change, but I can not make sure how many
this kind of problem exist in 2.0 :(
So, I revert it in 2.0 becasue I can take care other problems first ...
If you think there is no problem in 1.2, then I think I can adapt this
change any time.
Mark
> -----Original Message-----
> From: plog-svn-bounces at devel.lifetype.net
> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
> Sent: Thursday, January 03, 2008 11:32 PM
> To: LifeType Developer List
> Subject: Re: [pLog-svn] r6112 -
> plog/branches/lifetype-1.2/class/config
>
> Can you show me the file that doesn't work? Maybe the
> pdb should have a $val = getValue(db_driver); if($val == "")
> $val = "mysql";
>
> or whatever?
>
> Maybe the configfile needs the isset() check like the
> configdb has? Oh, right - it does, because the code in
> configdb and properties is duplicated.
>
> So, you are saying the config file explicitly sets it to
> null, but you want it to ignore that, and set a different
> value? I think that should be done in the pdb driver file.
>
> I think if the config file is explicitly set to a value, the
> code should use that value. If they don't set the value at
> all, then the default value should be used.
>
>
> On Thu, 3 Jan 2008, Mark Wu wrote:
>
> > Hi Jon:
> >
> > I think your fix is okay in most case.
> >
> > The probolem is becasue in 2.0 PDB class, we need to set
> the default
> > db driver if the $config['db_drvier'] = '';
> >
> > With your fix, the db_driver will always be empty and no
> way to assign
> > it to the default value for example 'mysql', becasue the
> > $config['db_drvier'] does exist, isset() will return true...
> >
> > So, I have to revert your fix in 2.0.
> >
> > and, I also have no idea this fix cause any problems in
> 1.2 or not ....
> >
> > If you can make sure it won't cause any problem in 1.2, I
> think I can
> > apply this change to 2.0, and modify PDB to adapt this change.
> >
> > Mark
> >
> >> -----Original Message-----
> >> From: plog-svn-bounces at devel.lifetype.net
> >> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
> >> Sent: Thursday, January 03, 2008 9:10 PM
> >> To: LifeType Developer List
> >> Subject: Re: [pLog-svn] r6112 -
> >> plog/branches/lifetype-1.2/class/config
> >>
> >> I see that I didn't copy the code from configdbstorage, since it
> >> looked more complex than was needed. Perhaps you want to
> copy that
> >> code directly?
> >>
> >> On Thu, 3 Jan 2008, Jon Daley wrote:
> >>
> >>> What problems does it cause?
> >>>
> >>> The bug that it fixes is that you can't set any value in a
> >>> configuration file to 0 or false, if the code provides a default.
> >>> This code is simply copying the code change from
> >> configdbstorage - we
> >>> fixed that a long time ago, and never noticed that we should have
> >>> copied it into file storage as well.
> >>>
> >>> On Thu, 3 Jan 2008, Mark Wu wrote:
> >>>
> >>>> Hi Jon:
> >>>>
> >>>> When did you meet this bug?
> >>>>
> >>>> this change casue a big problem in 2.0 and takes me
> >> several hours to
> >>>> track why the problem happend ....
> >>>>
> >>>> I am not sure this change will cause any problems in 1.2
> >> or not. But,
> >>>> I will revert it in 2.0 first to make 2.0-dev works ...
> >>>>
> >>>> Mark
> >>>>
> >>>>> -----Original Message-----
> >>>>> From: plog-svn-bounces at devel.lifetype.net
> >>>>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of
> >>>>> jondaley at devel.lifetype.net
> >>>>> Sent: Sunday, December 16, 2007 1:48 AM
> >>>>> To: plog-svn at devel.lifetype.net
> >>>>> Subject: [pLog-svn] r6112 -
> >> plog/branches/lifetype-1.2/class/config
> >>>>>
> >>>>> Author: jondaley
> >>>>> Date: 2007-12-15 12:47:42 -0500 (Sat, 15 Dec 2007) New Revision:
> >>>>> 6112
> >>>>>
> >>>>> Modified:
> >>>>>
> >>>>>
> >> plog/branches/lifetype-1.2/class/config/configfilestorage.class.php
> >>>>> Log:
> >>>>> fixed bug where you couldn't use 0 or false in file
> based config
> >>>>> files, else the default value would always be used.
> >>>>> Removed getTempFolder() function, since the parent
> class already
> >>>>> defines it identically
> >>>>>
> >>>>> Modified:
> >>>>>
> >> plog/branches/lifetype-1.2/class/config/configfilestorage.class.php
> >>>>>
> >> ===================================================================
> >>>>> ---
> >>>>> plog/branches/lifetype-1.2/class/config/configfilestorage.cl
> >>>>> ass.php 2007-12-15 17:17:34 UTC (rev 6111)
> >>>>> +++
> >>>>> plog/branches/lifetype-1.2/class/config/configfilestorage.cl
> >>>>> ass.php 2007-12-15 17:47:42 UTC (rev 6112)
> >>>>> @@ -64,7 +64,6 @@
> >>>>> $this->_props = new Properties();
> >>>>> $result = false;
> >>>>> }
> >>>>> -
> >>>>> return( $result );
> >>>>> }
> >>>>>
> >>>>> @@ -248,10 +247,7 @@
> >>>>>
> >>>>> function getValue( $key, $defaultValue = null )
> >>>>> {
> >>>>> - $value = $this->_props->getValue( $key );
> >>>>> - if( $value == "" || $value == null )
> >>>>> - if(isset($defaultValue))
> >>>>> - $value = $defaultValue;
> >>>>> + $value = $this->_props->getValue( $key,
> $defaultValue );
> >>>>>
> >>>>> return $value;
> >>>>> }
> >>>>> @@ -299,19 +295,5 @@
> >>>>>
> >>>>> return true;
> >>>>> }
> >>>>> -
> >>>>> - /**
> >>>>> - * shortcut for one of the most sought after config
> >>>>> keys: temp_folder
> >>>>> - *
> >>>>> - * not really needed, but it makes my life easier
> >>>>> since I never remember
> >>>>> - * whether it is tmp_folder, temp_folder, temp_dir,
> >>>>> or whatever :)
> >>>>> - *
> >>>>> - * @return The name of the folder used for
> >> temporary storage
> >>>>> - */
> >>>>> - function getTempFolder()
> >>>>> - {
> >>>>> - return $this->getValue( "temp_folder" );
> >>>>> - }
> >>>>> -
> >>>>> }
> >>>>> ?>
> >>>>>
> >>>>> _______________________________________________
> >>>>> pLog-svn mailing list
> >>>>> pLog-svn at devel.lifetype.net
> >>>>> http://limedaley.com/mailman/listinfo/plog-svn
> >>>>
> >>>> _______________________________________________
> >>>> pLog-svn mailing list
> >>>> pLog-svn at devel.lifetype.net
> >>>> http://limedaley.com/mailman/listinfo/plog-svn
> >>>>
> >>>
> >>> --
> >>> Jon Daley
> >>> http://jon.limedaley.com/
> >>>
> >>> He who asks is a fool for five minutes, but he who does not ask
> >>> remains a fool forever.
> >>> -- Chinese proverb
> >>> _______________________________________________
> >>> pLog-svn mailing list
> >>> pLog-svn at devel.lifetype.net
> >>> http://limedaley.com/mailman/listinfo/plog-svn
> >>>
> >>
> >> --
> >> Jon Daley
> >> http://jon.limedaley.com/
> >>
> >> Always be sincere, even when you don't mean it.
> >> -- Irene Peter
> >> _______________________________________________
> >> pLog-svn mailing list
> >> pLog-svn at devel.lifetype.net
> >> http://limedaley.com/mailman/listinfo/plog-svn
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://limedaley.com/mailman/listinfo/plog-svn
> >
>
> --
> Jon Daley
> http://jon.limedaley.com/
>
> The cure for boredom is curiosity. There is no cure for curiosity.
> -- Ellen Parr
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://limedaley.com/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list