MDL-10873 If both site default and user pref are empty for studentsperpage, we assume...
[moodle-pu.git] / search / indexersplash.php
blob26b7763a34f9615f07d309b01566f0de2fbed3bb
1 <?php
2 /**
3 * Global Search Engine for Moodle
4 * Michael Champanis (mchampan) [cynnical@gmail.com]
5 * review 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr]
6 * 2007/08/02
8 * This file serves as a splash-screen (entry page) to the indexer script -
9 * it is in place to prevent accidental reindexing which can lead to a loss
10 * of time, amongst other things.
11 **/
13 require_once('../config.php');
14 require_once("$CFG->dirroot/search/lib.php");
16 require_login();
18 if (empty($CFG->enableglobalsearch)) {
19 error(get_string('globalsearchdisabled', 'search'));
22 if (!isadmin()) {
23 error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
26 //check for php5 (lib.php)
27 if (!search_check_php5()) {
28 $phpversion = phpversion();
29 mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version $phpversion)");
30 exit(0);
33 require_once("$CFG->dirroot/search/indexlib.php");
34 $indexinfo = new IndexInfo();
36 if ($indexinfo->valid()) {
37 mtrace("<pre>The data directory ($indexinfo->path) contains $indexinfo->filecount files, and\n"
38 ."there are ".$indexinfo->dbcount." records in the <em>block_search_documents</em> table.\n"
39 ."\n"
40 ."This indicates that you have already succesfully indexed this site. Follow the link\n"
41 ."if you are sure that you want to continue indexing - this will replace any existing\n"
42 ."index data (no Moodle data is affected).\n"
43 ."\n"
44 ."You are encouraged to use the 'Test indexing' script before continuing onto\n"
45 ."indexing - this will check if the modules are set up correctly. Please correct\n"
46 ."any errors before proceeding.\n"
47 ."\n"
48 ."<a href='tests/index.php'>Test indexing</a> or "
49 ."<a href='indexer.php?areyousure=yes'>Continue indexing</a> or <a href='index.php'>Back to query page</a>."
50 ."</pre>");
52 else {
53 header('Location: indexer.php?areyousure=yes');