search
[ class tree: search ] [ index: search ] [ all elements ]

Source for file refresh.php

Documentation is available at refresh.php

  1. <?php
  2. /**
  3.  * $Header: /cvsroot/bitweaver/_bit_search/refresh.php,v 1.6 2006/02/08 20:21:32 lsces Exp $
  4.  *
  5.  * Copyright (c) 2004 bitweaver.org
  6.  * Copyright (c) 2003 tikwiki.org
  7.  * Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  8.  * All Rights Reserved. See copyright.txt for details and a complete list of authors.
  9.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details
  10.  *
  11.  * $Id: refresh.php,v 1.6 2006/02/08 20:21:32 lsces Exp $
  12.  * @author  Luis Argerich (lrargerich@yahoo.com)
  13.  * @package search
  14.  * @subpackage functions
  15.  */
  16.  
  17. /**
  18.  * refresh_search_index
  19.  */
  20. function refresh_search_index({
  21.     global $gBitSystem;
  22.     // first write close the session. refreshing can take a huge amount of time
  23.  
  24.     // check if we have to run. Run every n-th click:
  25.     global $search_refresh_rate$gBitSystem;
  26.  
  27.     //$search_refresh_rate=1; //debug
  28.     list($usec$secexplode(" ",microtime());
  29.     srand (ceil($sec+100*$usec));
  30.     if(rand(1,$search_refresh_rate)==1{
  31.         require_once('refresh_functions.php');
  32.         // get a random location
  33.         $locs=array();
  34.         if$gBitSystem->isPackageActive'wiki' ) ) {
  35.             // if wiki is active, let's always refresh
  36.             random_refresh_index("wiki");
  37.         }
  38.         if$gBitSystem->isPackageActive'articles' ) ) {
  39.             $locs[''ARTICLES_PKG_NAME;
  40.         }
  41.         if$gBitSystem->isPackageActive'blogs' ) ) {
  42.             //Can't use the new random function with blogs - they aren'tin liberty_content yet.
  43.             $locs['random_refresh_index_blogs''';
  44.             //Can use new function for blog_posts though ...
  45.             $locs['random_refresh_index']="blog_posts";
  46.         }
  47.  
  48.         // comments can be everywhere?
  49.         $locs['random_refresh_index'"comments";
  50.         // some refreshes to enhance the refreshing stats
  51.         $locs['refresh_index_oldest'"";
  52.         $key array_rand$locs );
  53.         // random refresh
  54.  
  55.         // hack around php database driver issues when a different database from bitweaver is accessed elsewhere during page  render
  56.         // this happens in the phpBB package when phpBB is in a different db from bitweaver in MySQL
  57.         // This only works on some databases
  58.         global $gBitSystem$gBitDbName;
  59.         $gBitSystem->mDb->mDb->SelectDB$gBitDbName );
  60.  
  61.         if !empty ($key) )
  62.             call_user_func$key$locs[$key);
  63.     }
  64. }
  65.  
  66. ?>

Documentation generated on Thu, 15 Feb 2007 20:48:05 +0000 by phpDocumentor 1.3.0