SCORM MDL-25891 typo causing general exception for some SCORM objects - thanks to...
[moodle.git] / search / indexersplash.php
blob78ac128d71f6df5bb7d701a6b27ad2b2e05aeee0
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 * @version prepared for 2.0
11 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
13 * This file serves as a splash-screen (entry page) to the indexer script -
14 * it is in place to prevent accidental reindexing which can lead to a loss
15 * of time, amongst other things.
18 /**
19 * includes and requires
21 require_once('../config.php');
23 /// makes inclusions of the Zend Engine more reliable
24 ini_set('include_path', $CFG->dirroot.DIRECTORY_SEPARATOR.'search'.PATH_SEPARATOR.ini_get('include_path'));
26 require_once($CFG->dirroot.'/search/lib.php');
28 /// check global search is enabled
30 require_login();
32 if (empty($CFG->enableglobalsearch)) {
33 print_error('globalsearchdisabled', 'search');
36 if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
37 print_error('beadmin', 'search', get_login_url());
40 require_once("$CFG->dirroot/search/indexlib.php");
41 $indexinfo = new IndexInfo();
43 if ($indexinfo->valid()) {
44 $strsearch = get_string('search', 'search');
45 $strquery = get_string('stats');
47 // print page header
48 $site = get_site();
50 $PAGE->set_url('/search/indexersplash.php');
51 $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
52 $PAGE->navbar->add($strsearch, new moodle_url('/search/index.php'));
53 $PAGE->navbar->add($strquery, new moodle_url('/search/stats.php'));
54 $PAGE->navbar->add(get_string('runindexer','search'));
55 $PAGE->set_title($strsearch);
56 $PAGE->set_heading($site->fullname);
57 echo $OUTPUT->header();
59 mtrace("<pre>The data directory ($indexinfo->path) contains $indexinfo->filecount files, and\n"
60 ."there are ".$indexinfo->dbcount." records in the <em>block_search_documents</em> table.\n"
61 ."\n"
62 ."This indicates that you have already succesfully indexed this site. Follow the link\n"
63 ."if you are sure that you want to continue indexing - this will replace any existing\n"
64 ."index data (no Moodle data is affected).\n"
65 ."\n"
66 ."You are encouraged to use the 'Test indexing' script before continuing onto\n"
67 ."indexing - this will check if the modules are set up correctly. Please correct\n"
68 ."any errors before proceeding.\n"
69 ."\n"
70 ."<a href='tests/index.php'>Test indexing</a> or "
71 ."<a href='indexer.php?areyousure=yes'>Continue indexing</a> or <a href='index.php'>Back to query page</a>."
72 ."</pre>");
73 echo $OUTPUT->footer();
74 } else {
75 header('Location: indexer.php?areyousure=yes');