3 * Global Search Engine for Moodle
7 * @subpackage search_engine
8 * @author Michael Champanis (mchampan) [cynnical@gmail.com], Valery Fremaux [valery.fremaux@club-internet.fr] > 1.8
10 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
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.
18 * includes and requires
20 require_once('../config.php');
21 require_once("$CFG->dirroot/search/lib.php");
23 /// check global search is enabled
27 if (empty($CFG->enableglobalsearch
)) {
28 error(get_string('globalsearchdisabled', 'search'));
32 error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
35 /// check for php5 (lib.php)
37 if (!search_check_php5()) {
38 $phpversion = phpversion();
39 mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version ".phpversion().")");
43 require_once("$CFG->dirroot/search/indexlib.php");
44 $indexinfo = new IndexInfo();
46 if ($indexinfo->valid()) {
47 $strsearch = get_string('search', 'search');
48 $strquery = get_string('stats');
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
57 $navigation = build_navigation($navlinks);
60 print_header("$strsearch", "$site->fullname" , $navigation, "", "", true, " ", navmenu($site));
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"
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"
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"
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>."
79 header('Location: indexer.php?areyousure=yes');