[pLog-svn] r2547 - plog/branches/plog-1.0.2/class/dao

Oscar Renalias oscar at renalias.net
Thu Nov 10 04:55:01 GMT 2005


Sorry,  but this is going to break too much stuff.

Offsets are calculated dynamically when the article is loaded so that  
users see the right time for their article no matter what the time  
offset settings were when the article was added. If you look at  
Articles::_fillArticleInformation, there's a bunch of code dedicated  
to calculate the offset dynamically based on the current blog settings.

While your fix is correct, I think we should revert it. At least  
until we get round to storing timestamps in UTC, which is the right way.

Oscar

On 10 Nov 2005, at 04:10, jondaley at devel.plogworld.net wrote:

> Author: jondaley
> Date: 2005-11-10 02:09:26 +0000 (Thu, 10 Nov 2005)
> New Revision: 2547
>
> Modified:
>    plog/branches/plog-1.0.2/class/dao/articles.class.php
> Log:
> added code to get blog specific time offset when adding an  
> article.  This seems strange that it wasn't already here - people  
> use this, right?  removed unused textFilter object.
>
> Modified: plog/branches/plog-1.0.2/class/dao/articles.class.php
> ===================================================================
> --- plog/branches/plog-1.0.2/class/dao/articles.class.php	 
> 2005-11-09 15:33:44 UTC (rev 2546)
> +++ plog/branches/plog-1.0.2/class/dao/articles.class.php	 
> 2005-11-10 02:09:26 UTC (rev 2547)
> @@ -695,13 +695,18 @@
>           */
>          function addArticle( &$newArticle )
>          {
> -            // first, we build up the query
> -            $filter = new Textfilter();
> +                // all this just to get the blog offset.
> +            $blogInfo = $this->blogs->getBlogInfo( $newArticle- 
> >getBlog() );
> +            $blogSettings = $blogInfo->getSettings();
> +            $timeDiff = $blogSettings->getValue( 'time_offset' );
> +            $articleDate = Timestamp::getDateWithOffset 
> ( $newArticle->getDate(), -($timeDiff));
> +
> +                // first, we build up the query
>              $query = "INSERT INTO ".$this->getPrefix()."articles 
> ( user_id,blog_id,status,date,properties, slug )
>                        VALUES ( ".$newArticle->getUser().",".
>                        $newArticle->getBlog().",'".
>                        $newArticle->getStatus()."','".
> -                      $newArticle->getDate()."','".
> +                      $articleDate."','".
>                        serialize($newArticle->getProperties())."','".
>  					  $newArticle->getPostSlug()."');";
>              // and then we send it to the db
> @@ -822,7 +827,6 @@
>          {
>              // we have to build up the query, which will be pretty  
> long...
>              $articleDate = Timestamp::getDateWithOffset( $article- 
> >getDate(), -($article->getTimeOffset()));
> -            $filter = new Textfilter();
>
>              $query = "UPDATE ".$this->getPrefix()."articles SET id  
> = ".$article->getId().
>                       ", user_id = ".$article->getUser().
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.plogworld.net
> http://devel.plogworld.net/mailman/listinfo/plog-svn
>




More information about the pLog-svn mailing list