[pLog-svn] r2091 - plog/branches/plog-1.1-ben/class/dao

Oscar Renalias phunkphorce at gmail.com
Mon May 30 10:55:12 GMT 2005


On second thoughts, we really need all the parameters.
ViewArticleActions uses them all at some point, take a look...

Oscar

On 5/29/05, Oscar Renalias <oscar at renalias.net> wrote:
> Did a quick check in the plugins... The only plugin that requires
> more than the article id and blog id parameters is the karma plugin.
> In line 42 of plugins/karma/class/action/
> viewmoderateddownaction.class.php:
> 
>              $article  = $articles->getBlogArticle( $this-
>  >_articleId, $this->_blogInfo->getId(),
>                                                     false, -1, -1,
> -1, POST_STATUS_KARMA_MODERATED_DOWN );
> 
> I think that we only need to load a post with
> POST_STATUS_KARMA_MODERATED_DOWN, but I suppose we can just load a
> post and check its status later on.
> 
> I think that this change is fine :)
> 
> Oscar
> 
> On 29 May 2005, at 16:44, ork at devel.plogworld.net wrote:
> 
> > Author: ork
> > Date: 2005-05-29 13:44:17 +0000 (Sun, 29 May 2005)
> > New Revision: 2091
> >
> > Modified:
> >    plog/branches/plog-1.1-ben/class/dao/articles.class.php
> > Log:
> > as far as i see this, getBlogArticle will just be called with an
> > id, so we do not need to have that many parameters here. didn't
> > find any place in the code where getBlogArticle was fetched with
> > more than 2 parameters. didn't check the plugins, though ..
> >
> >
> > Modified: plog/branches/plog-1.1-ben/class/dao/articles.class.php
> > ===================================================================
> > --- plog/branches/plog-1.1-ben/class/dao/articles.class.php
> > 2005-05-29 13:25:43 UTC (rev 2090)
> > +++ plog/branches/plog-1.1-ben/class/dao/articles.class.php
> > 2005-05-29 13:44:17 UTC (rev 2091)
> > @@ -70,30 +70,22 @@
> >           * @param blogId If set, the article must belong to the
> > given blog
> >           * @return Returns an Article object or 'false' otherwise.
> >           */
> > -        function getBlogArticle( $artId, $blogId = -1,
> > $includeHiddenFields = true, $date = -1, $categoryId = -1, $userId
> > = -1, $status = null )
> > +        function getBlogArticle( $artId, $blogId = -1 )
> >          {
> > +            // TBD: remove me
> > +            // function getBlogArticle( $artId, $blogId = -1,
> > $includeHiddenFields = true, $date = -1, $categoryId = -1, $userId
> > = -1, $status = null )
> > +            // $this->log->info("called getBlogArticle with:
> > $artId, $blogId, $includeHiddenFields, $date, $categoryId, $userId,
> > $status");
> >              $prefix = $this->getPrefix();
> >              $query = "SELECT a.id, a.date,
> >
> > a.user_id,a.blog_id,a.status,a.properties,
> >                               a.num_reads, a.slug FROM {$prefix}
> > articles a ";
> >              // thanks jon for the tip :) You're right that the
> > amount of rows will be too big
> >              // if we don't really need these fields!
> > -            if($categoryId != -1 && $blogId != -1) {
> > -                $query .= ", {$prefix}articles_categories c,
> > {$prefix}article_categories_link l ";
> > -            }
> >
> >              $query .= "WHERE a.id = ".Db::qstr($artId);
> >
> > -            if( $blogId != -1 )
> > +            if( $blogId != -1 ) {
> >                  $query .= " AND a.blog_id = ".Db::qstr($blogId);
> > -            if( $date != -1 )
> > -                $query .= " AND a.date+0 LIKE '$date%'";
> > -            if( $userId != -1 )
> > -                $query .= " AND a.user_id = ".Db::qstr($userId);
> > -            if( $categoryId != -1 )
> > -                $query .= " AND c.id = ".Db::qstr($categoryId)."
> > AND c.id = l.category_id AND a.id = l.article_id";
> > -            if( $status != null && $status !=
> > POST_STATUS_PUBLISHED ) {
> > -                $query .= " AND a.status = $status;";
> >              }
> >
> >              return $this->_getBlogArticleFromQuery( $query,
> > $includeHiddenFields );
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.plogworld.net
> > http://devel.plogworld.net/mailman/listinfo/plog-svn
> >
> >
> 
> _______________________________________________
> 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