[ Index ]

PHP Cross Reference of Moodle 1.9.3 [Build 15-Oct-2008]

title

Body

[close]

/search/ -> indexersplash.php (source)

   1  <?php
   2  /**
   3  * Global Search Engine for Moodle
   4  *
   5  * @package search
   6  * @category core
   7  * @subpackage search_engine
   8  * @author Michael Champanis (mchampan) [cynnical@gmail.com], Valery Fremaux [valery.fremaux@club-internet.fr] > 1.8
   9  * @date 2008/03/31
  10  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  11  *
  12  * This file serves as a splash-screen (entry page) to the indexer script -
  13  * it is in place to prevent accidental reindexing which can lead to a loss
  14  * of time, amongst other things.
  15  */
  16  
  17  /**
  18  * includes and requires
  19  */
  20  require_once ('../config.php');
  21  require_once("$CFG->dirroot/search/lib.php");
  22  
  23  /// check global search is enabled 
  24  
  25      require_login();
  26      
  27      if (empty($CFG->enableglobalsearch)) {
  28          error(get_string('globalsearchdisabled', 'search'));
  29      }
  30      
  31      if (!isadmin()) {
  32          error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
  33      } 
  34      
  35  /// check for php5 (lib.php)
  36  
  37      if (!search_check_php5()) {
  38          $phpversion = phpversion();
  39          mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version ".phpversion().")");
  40          exit(0);
  41      }
  42      
  43      require_once("$CFG->dirroot/search/indexlib.php");
  44      $indexinfo = new IndexInfo();
  45      
  46      if ($indexinfo->valid()) {
  47          $strsearch = get_string('search', 'search');
  48          $strquery  = get_string('stats');
  49          
  50          $navlinks[] = array('name' => $strsearch, 'link' => "index.php", 'type' => 'misc');
  51          $navlinks[] = array('name' => $strquery, 'link' => "stats.php", 'type' => 'misc');
  52          $navlinks[] = array('name' => get_string('runindexer','search'), 'link' => null, 'type' => 'misc');
  53          // if ($CFG->version <= 2007021541){ // 1.8 branch stable timestamp NOT RELIABLE
  54          if (!function_exists('build_navigation')){ // 1.8 branch stable timestamp
  55              $navigation = '';
  56          } else {
  57              $navigation = build_navigation($navlinks);
  58          }
  59          $site = get_site();
  60          print_header("$strsearch", "$site->fullname" , $navigation, "", "", true, "&nbsp;", navmenu($site));
  61       
  62          mtrace("<pre>The data directory ($indexinfo->path) contains $indexinfo->filecount files, and\n"
  63                ."there are ".$indexinfo->dbcount." records in the <em>block_search_documents</em> table.\n"
  64                ."\n"
  65                ."This indicates that you have already succesfully indexed this site. Follow the link\n"
  66                ."if you are sure that you want to continue indexing - this will replace any existing\n"
  67                ."index data (no Moodle data is affected).\n"
  68                ."\n"
  69                ."You are encouraged to use the 'Test indexing' script before continuing onto\n"
  70                ."indexing - this will check if the modules are set up correctly. Please correct\n"
  71                ."any errors before proceeding.\n"
  72                ."\n"
  73                ."<a href='tests/index.php'>Test indexing</a> or "
  74                ."<a href='indexer.php?areyousure=yes'>Continue indexing</a> or <a href='index.php'>Back to query page</a>."
  75                ."</pre>");
  76          print_footer();
  77      } 
  78      else {
  79          header('Location: indexer.php?areyousure=yes');
  80      }
  81  ?>


Generated: Wed Jan 14 11:33:29 2009 Cross-referenced by PHPXref 0.7