[pLog-svn] r3133 - plog/trunk/class/dao
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Mon Mar 27 03:41:42 GMT 2006
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;
More information about the pLog-svn
mailing list