global search review and extension for physical files

This commit is contained in:
diml 2007-07-09 21:12:16 +00:00
parent cf0b12ac83
commit 2f338ab5b0
28 changed files with 3903 additions and 1485 deletions

View file

@ -1,33 +1,39 @@
<?php
/* This file serves as a splash-screen (entry page) to the indexer script -
* it is in place to prevent accidental reindexing which can lead to a loss
* of time, amongst other things.
* */
/**
* Global Search Engine for Moodle
* Michael Champanis (mchampan) [cynnical@gmail.com]
* review 1.8+ : Valery Fremaux [valery.fremaux@club-internet.fr]
* 2007/08/02
*
* This file serves as a splash-screen (entry page) to the indexer script -
* it is in place to prevent accidental reindexing which can lead to a loss
* of time, amongst other things.
**/
require_once('../config.php');
require_once("$CFG->dirroot/search/lib.php");
require_once('../config.php');
require_once("$CFG->dirroot/search/lib.php");
require_login();
require_login();
if (empty($CFG->enableglobalsearch)) {
error('Global searching is not enabled.');
}
if (empty($CFG->enableglobalsearch)) {
error(get_string('globalsearchdisabled', 'search'));
}
if (!isadmin()) {
error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
} //if
if (!isadmin()) {
error(get_string('beadmin', 'search'), "$CFG->wwwroot/login/index.php");
}
//check for php5 (lib.php)
if (!search_check_php5()) {
//check for php5 (lib.php)
if (!search_check_php5()) {
$phpversion = phpversion();
mtrace("Sorry, global search requires PHP 5.0.0 or later (currently using version $phpversion)");
exit(0);
} //if
}
require_once("$CFG->dirroot/search/indexlib.php");
$indexinfo = new IndexInfo();
require_once("$CFG->dirroot/search/indexlib.php");
$indexinfo = new IndexInfo();
if ($indexinfo->valid()) {
if ($indexinfo->valid()) {
mtrace("<pre>The data directory ($indexinfo->path) contains $indexinfo->filecount files, and\n"
."there are ".$indexinfo->dbcount." records in the <em>search_documents</em> table.\n"
."\n"
@ -42,7 +48,8 @@
."<a href='tests/index.php'>Test indexing</a> or "
."<a href='indexer.php?areyousure=yes'>Continue indexing</a> or <a href='index.php'>Back to query page</a>."
."</pre>");
} else {
}
else {
header('Location: indexer.php?areyousure=yes');
} //else
}
?>