[pLog-svn] r3318 - plog/trunk/class/dao
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Tue May 2 10:16:01 GMT 2006
Author: jondaley
Date: 2006-05-02 10:16:00 +0000 (Tue, 02 May 2006)
New Revision: 3318
Modified:
plog/trunk/class/dao/articles.class.php
Log:
1.1 has a new function for getting an article by title, so my addition in rev 3314 isn't needed.
Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php 2006-05-02 04:13:38 UTC (rev 3317)
+++ plog/trunk/class/dao/articles.class.php 2006-05-02 10:16:00 UTC (rev 3318)
@@ -69,30 +69,7 @@
return $article;
}
- /**
- * Check to see if an article title already exists. Used
- * when article urls don't have dates in them, so post names
- * must be unique across the entire blog.
- *
- * @param artTitle Identifier of the article we want to fetch
- * @param blogId If set, the article must belong to the given blog
- * @return Returns an Article object or 'false' otherwise.
- */
- function checkBlogArticleTitle( $artTitle, $blogId = -1, $artId = -1 )
- {
- $prefix = $this->getPrefix();
- $query = "SELECT a.id FROM {$prefix}articles a ";
-
- $query .= "WHERE a.slug = '".Db::qstr($artTitle)."'";
- if( $blogId != -1 )
- $query .= " AND a.blog_id = ".Db::qstr($blogId);
- if( $artId != -1 )
- $query .= " AND a.id != $artId;";
-
- return $this->_getBlogArticleFromQuery( $query, false, true );
- }
-
- /**
+ /**
* Gets an article from the database, given its slug, this is used
* with the fancy permalinks
*
@@ -135,10 +112,8 @@
/**
* @private
- * onlyCheck == true means to not bother actually getting the row, but
- * just check if the article exists
*/
- function _getBlogArticleFromQuery( $query, $includeHiddenFields, $onlyCheck=false )
+ function _getBlogArticleFromQuery($query, $includeHiddenFields)
{
// we send the query and then fetch the first array with the result
$result = $this->Execute( $query );
@@ -149,11 +124,6 @@
if ( $result->RecordCount() == 0)
return false;
- if($onlyCheck){
- $result->Close();
- return true;
- }
-
$row = $result->FetchRow( $result );
$article = $this->mapRow( $row, $includeHiddenFields );
@@ -789,7 +759,8 @@
$slug = $newArticle->getPostSlug();
$i = 1;
// check if there already is a blog with the same mangled name
- while($this->checkBlogArticleTitle($slug, $newArticle->getBlog()))
+ while($this->getBlogArticleByTitle($slug,
+ $newArticle->getBlog()))
{
$i++;
// and if so, assign a new one
@@ -944,8 +915,8 @@
$slug = $article->getPostSlug();
$i = 1;
// check if there already is a blog with the same mangled name
- while($this->checkBlogArticleTitle($slug, $article->getBlog(),
- $article->getId()))
+ while($this->getBlogArticleByTitle($slug,
+ $newArticle->getBlog()))
{
$i++;
// and if so, assign a new one
More information about the pLog-svn
mailing list