Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / search / indexersplash.php
blob43755ae2412eeca402c13b7bde1963daf97b96bc
1 <?php
2 /**
3 * Global Search Engine for Moodle
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
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.
17 /**
18 * includes and requires
20 require_once('../config.php');
21 require_once("$CFG->dirroot/search/lib.php");
23 /// check global search is enabled
25 require_login();
27 if (empty($CFG->enableglobalsearch)) {
28 error(get_string('globalsearchdisabled', 'search'));
31 if (!isadmin()) {
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().")");
40 exit(0);
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
55 $navigation = '';
56 } else {
57 $navigation = build_navigation($navlinks);
59 $site = get_site();
60 print_header("$strsearch", "$site->fullname" , $navigation, "", "", true, "&nbsp;", 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"
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();
78 else {
79 header('Location: indexer.php?areyousure=yes');