2 /* This file serves as a splash-screen (entry page) to the indexer script -
3 * it is in place to prevent accidental reindexing which can lead to a loss
4 * of time, amongst other things.
7 require_once('../config.php');
8 require_once("$CFG->dirroot/search/lib.php");
12 if (empty($CFG->enableglobalsearch
)) {
13 error('Global searching is not enabled.');
17 error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
20 //check for php5 (lib.php)
21 if (!search_check_php5()) {
22 $phpversion = phpversion();
23 mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version $phpversion)");
27 require_once("$CFG->dirroot/search/indexlib.php");
28 $indexinfo = new IndexInfo();
30 if ($indexinfo->valid()) {
31 mtrace("<pre>The data directory ($indexinfo->path) contains $indexinfo->filecount files, and\n"
32 ."there are ".$indexinfo->dbcount
." records in the <em>search_documents</em> table.\n"
34 ."This indicates that you have already succesfully indexed this site. Follow the link\n"
35 ."if you are sure that you want to continue indexing - this will replace any existing\n"
36 ."index data (no Moodle data is affected).\n"
38 ."You are encouraged to use the 'Test indexing' script before continuing onto\n"
39 ."indexing - this will check if the modules are set up correctly. Please correct\n"
40 ."any errors before proceeding.\n"
42 ."<a href='tests/index.php'>Test indexing</a> or "
43 ."<a href='indexer.php?areyousure=yes'>Continue indexing</a> or <a href='index.php'>Back to query page</a>."
46 header('Location: indexer.php?areyousure=yes');