[pLog-svn] r3133 - plog/trunk/class/dao
Oscar Renalias
oscar at renalias.net
Mon Mar 27 06:07:25 GMT 2006
I will take a look at the code.
Just one thing: there can be more than one blog using the same custom
domain, right?
Oscar
On 3/27/06, Jon Daley <plogworld at jon.limedaley.com> wrote:
> Not really sure about this caching stuff. Oscar, can you look at
> this? Also, see my change for blogs->update, where I always return true.
> It seems reasonable that the user might hit the update button because he
> forgot whether he changed something or not, and then be confused when the
> operation fails.
> Perhaps the model->update should not return false either in that
> case? There could be some other return code if the caller wanted to check
> if rows were changed in the database?
>
> On Mon, 27 Mar 2006, jondaley at devel.lifetype.net wrote:
> > Author: jondaley
> > Date: 2006-03-27 03:41:40 +0000 (Mon, 27 Mar 2006)
> > New Revision: 3133
> >
> > Modified:
> > plog/trunk/class/dao/blogs.class.php
> > Log:
> > first shot at new custom domain stuff. currently, there isn't a UI for this at all, but you can edit the database manually. (note, a new column is added to the database - not sure what lifetype will do with a missing column - so, you need to run 'ALTER TABLE plog_blogs ADD COLUMN custom_domain VARCHAR(50)' on your database
> >
> > Modified: plog/trunk/class/dao/blogs.class.php
> > ===================================================================
> > --- plog/trunk/class/dao/blogs.class.php 2006-03-27 01:42:23 UTC (rev 3132)
> > +++ plog/trunk/class/dao/blogs.class.php 2006-03-27 03:41:40 UTC (rev 3133)
> > @@ -5,6 +5,7 @@
> >
> > define( "CACHE_BLOGINFOS", "bloginfo" );
> > define( "CACHE_BLOGIDBYNAME", "bloginfo_idbyname" );
> > + define( "CACHE_BLOGIDBYDOMAIN","bloginfo_idbydomain" );
> >
> > /**
> > * \ingroup DAO
> > @@ -28,7 +29,10 @@
> > function getBlogInfo( $blogId )
> > {
> > require_once( PLOG_CLASS_PATH . 'class/dao/bloginfo.class.php' );
> > - return( $this->get( "id", $blogId, CACHE_BLOGINFOS, Array( CACHE_BLOGIDBYNAME => "getMangledBlogName" )));
> > + return( $this->get( "id", $blogId,
> > + CACHE_BLOGINFOS,
> > + Array( CACHE_BLOGIDBYNAME => "getMangledBlogName",
> > + CACHE_BLOGIDBYDOMAIN => "getCustomDomain")));
> > }
> >
> > /**
> > @@ -40,8 +44,17 @@
> > function getBlogInfoByName( $blogName, $extendedInfo = false )
> > {
> > require_once( PLOG_CLASS_PATH . 'class/dao/bloginfo.class.php' );
> > - return( $this->get( "mangled_blog", $blogName, CACHE_BLOGIDBYNAME, Array( CACHE_BLOGINFOS => "getId" )));
> > + return( $this->get( "mangled_blog", $blogName,
> > + CACHE_BLOGIDBYNAME,
> > + Array( CACHE_BLOGINFOS => "getId" )));
> > }
> > +
> > + function getBlogInfoByDomain($blogDomain, $extendedInfo = false){
> > + require_once(PLOG_CLASS_PATH . 'class/dao/bloginfo.class.php');
> > + return( $this->get( "custom_domain", $blogDomain,
> > + CACHE_BLOGIDBYDOMAIN,
> > + Array( CACHE_BLOGINFOS => "getId" )));
> > + }
> >
> > /**
> > * @see Model::getSearchConditions
> > @@ -62,9 +75,10 @@
> > {
> > // load the previous version of this blog
> > $prevVersion = $this->getBlogInfo( $blog->getId());
> > -
> > if( ($result = $this->update( $blog ))) {
> > // reset the caches
> > + // TODO: jondaley: is this doing the right thing?
> > + $this->_cache->removeData( $blog->getCustomDomain(), CACHE_BLOGIDBYDOMAIN );
> > $this->_cache->removeData( $blog->getMangledBlogName(), CACHE_BLOGIDBYNAME );
> > $this->_cache->removeData( $blog->getId(), CACHE_BLOGINFOS );
> >
> > @@ -87,7 +101,9 @@
> > }
> > }
> >
> > - return $result;
> > + // always return true,
> > + // $result is only false if nothing was changed, but that really isn't an error?
> > + return true;
> > }
> >
> > /**
> > @@ -170,6 +186,7 @@
> > // and cache whatever we loaded for later use, just in case
> > $this->_cache->setData( $blog->getId(), CACHE_BLOGINFOS, $blog );
> > $this->_cache->setData( $blog->getMangledBlogName(), CACHE_BLOGIDBYNAME, $blog );
> > + $this->_cache->setData( $blog->getCustomDomain(), CACHE_BLOGIDBYDOMAIN, $blog );
> > }
> >
> > return $blogs;
> > @@ -294,7 +311,8 @@
> > $blogInfo->setTotalComments( $row['num_comments'] );
> > // mangled blog
> > $blogInfo->setMangledBlogName( $row['mangled_blog'] );
> > - // show in summary or not
> > + $blogInfo->setCustomDomain( $row['custom_domain'] );
> > + // show in summary or not
> > $blogInfo->setShowInSummary( $row['show_in_summary'] );
> >
> > return $blogInfo;
> _______________________________________________
> 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