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

Source for file refresh.php

Documentation is available at refresh.php

  1. <?php
  2. /**
  3.  * $Header$
  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 below for details and a complete list of authors.
  9.  *  Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
  10.  *
  11.  *  $Id$
  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.             // if blogs is active, let's always refresh
  43.             random_refresh_index("blogs");
  44.             $locs['random_refresh_index']="blog_posts";
  45.         }
  46.  
  47.         // comments can be everywhere?
  48.         $locs['random_refresh_index'"comments";
  49.         // some refreshes to enhance the refreshing stats
  50.         $locs['refresh_index_oldest'"";
  51.         $key array_rand$locs );
  52.         // random refresh
  53.  
  54.         // hack around php database driver issues when a different database from bitweaver is accessed elsewhere during page  render
  55.         // this happens in the phpBB package when phpBB is in a different db from bitweaver in MySQL
  56.         // This only works on some databases
  57.         global $gBitSystem$gBitDbName;
  58.         $gBitSystem->mDb->mDb->SelectDB$gBitDbName );
  59.  
  60.         if !empty ($key) )
  61.             call_user_func$key$locs[$key);
  62.     }
  63. }
  64.  
  65. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:18 +0000 by phpDocumentor 1.5.0-lsces