diff options
| author | MW <joasch@users.sourceforge.net> | 2007-12-04 17:42:09 +0000 |
|---|---|---|
| committer | MW <joasch@users.sourceforge.net> | 2007-12-04 17:42:09 +0000 |
| commit | f25323480ca8496e65c25e636e403d45187875be (patch) | |
| tree | b486c4b16393a036ce8f95d9f82079e0a2c17d93 | |
| parent | 125e17ff1a6266dca9366f4965013f1a15e2c63a (diff) | |
| download | search-f25323480ca8496e65c25e636e403d45187875be.tar.gz search-f25323480ca8496e65c25e636e403d45187875be.tar.bz2 search-f25323480ca8496e65c25e636e403d45187875be.zip | |
Blogs is now part of LibertyContent so use correct index method in search package and get rid of some legacy code
| -rw-r--r-- | refresh.php | 11 | ||||
| -rw-r--r-- | refresh_functions.php | 43 |
2 files changed, 12 insertions, 42 deletions
diff --git a/refresh.php b/refresh.php index c2c6a3b..40bc081 100644 --- a/refresh.php +++ b/refresh.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_search/refresh.php,v 1.6 2006/02/08 20:21:32 lsces Exp $ + * $Header: /cvsroot/bitweaver/_bit_search/refresh.php,v 1.7 2007/12/04 17:42:09 joasch Exp $ * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org @@ -8,12 +8,12 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: refresh.php,v 1.6 2006/02/08 20:21:32 lsces Exp $ + * $Id: refresh.php,v 1.7 2007/12/04 17:42:09 joasch Exp $ * @author Luis Argerich (lrargerich@yahoo.com) * @package search * @subpackage functions */ - + /** * refresh_search_index */ @@ -40,9 +40,8 @@ function refresh_search_index() { $locs[''] = ARTICLES_PKG_NAME; } if( $gBitSystem->isPackageActive( 'blogs' ) ) { - //Can't use the new random function with blogs - they aren'tin liberty_content yet. - $locs['random_refresh_index_blogs'] = ''; - //Can use new function for blog_posts though ... + // if blogs is active, let's always refresh + random_refresh_index("blogs"); $locs['random_refresh_index']="blog_posts"; } diff --git a/refresh_functions.php b/refresh_functions.php index 8ca0927..0959a94 100644 --- a/refresh_functions.php +++ b/refresh_functions.php @@ -1,6 +1,6 @@ <?php /** - * $Header: /cvsroot/bitweaver/_bit_search/refresh_functions.php,v 1.29 2006/12/26 17:10:46 squareing Exp $ + * $Header: /cvsroot/bitweaver/_bit_search/refresh_functions.php,v 1.30 2007/12/04 17:42:09 joasch Exp $ * * Copyright (c) 2004 bitweaver.org * Copyright (c) 2003 tikwiki.org @@ -8,7 +8,7 @@ * All Rights Reserved. See copyright.txt for details and a complete list of authors. * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details * - * $Id: refresh_functions.php,v 1.29 2006/12/26 17:10:46 squareing Exp $ + * $Id: refresh_functions.php,v 1.30 2007/12/04 17:42:09 joasch Exp $ * @author Luis Argerich (lrargerich@yahoo.com) * @package search * @subpackage functions @@ -33,6 +33,9 @@ function random_refresh_index($pContentType = "") { case "wiki" : $table = "wiki_pages"; break; + case "blogs" : + $table = "blogs"; + break; case "blog_posts" : $table = "blog_posts"; break; @@ -79,41 +82,9 @@ function refresh_index( $pContentObject = null ) { } } -// Legacy index handlers - blogs (blog headers) are not in liberty_content yet -// so we can't handle them like the others - -function random_refresh_index_blogs() { - global $gBitSystem; - if( $gBitSystem->isPackageActive( 'blogs' ) ) { - require_once( BLOGS_PKG_PATH.'BitBlog.php' ); - // get random blog - $cant = $gBitSystem->mDb->getOne("SELECT COUNT(*) FROM `".BIT_DB_PREFIX."blogs`", array()); - if($cant > 0) { - $query = "SELECT `blog_id` FROM `" . BIT_DB_PREFIX . "blogs`"; - $blogId = $gBitSystem->mDb->getOne($query, array(), 1, rand(0, $cant - 1)); - refresh_index_blogs($blogId); - } - } -} - -function refresh_index_blogs( $pBlogId = 0 ) { - global $gBitSystem; - if( $pBlogId > 0 and $gBitSystem->isPackageActive( 'blogs' ) ) { - require_once( BLOGS_PKG_PATH.'BitBlog.php' ); - $query = "SELECT `title`, `data`, uu.`login` AS `user_login`, uu.`real_name` - FROM `".BIT_DB_PREFIX."blogs` b - INNER JOIN `".BIT_DB_PREFIX."liberty_content` lc ON b.`content_id` = lc.`content_id` - INNER JOIN `".BIT_DB_PREFIX."users_users` uu ON uu.`user_id` = lc.`user_id` - WHERE `blog_id` = ? "; - $res = $gBitSystem->mDb->getRow($query, array($pBlogId)); - $words = prepare_words($res["title"]." ".$res["user_login"]." ".$res["real_name"]." ".$res["data"]); - insert_index($words, BITBLOG_CONTENT_TYPE_GUID, -1, $pBlogId); - } -} - function refresh_index_oldest(){ global $gBitSystem; - $contentId = $gBitSystem->mDb->getOne("SELECT `content_id` FROM `" . BIT_DB_PREFIX . + $contentId = $gBitSystem->mDb->getOne("SELECT `content_id` FROM `" . BIT_DB_PREFIX . "search_index` ORDER BY `last_update`", array()); if ( isset($contentId) ) { refresh_index($contentId); @@ -170,7 +141,7 @@ function delete_index_content_type($pContentType) { $sql = "DELETE FROM `" . BIT_DB_PREFIX . "search_index`"; $array = array(); if ( $pContentType <> "pages" ) { - $sql .= " WHERE `content_id` IN (SELECT `content_id` FROM `" . BIT_DB_PREFIX . + $sql .= " WHERE `content_id` IN (SELECT `content_id` FROM `" . BIT_DB_PREFIX . "liberty_content` where `content_type_guid` = ?)"; $array = array($pContentType); } |
