FIX: prevent notice while doing search request.

This commit is contained in:
Will Rossiter 2012-09-09 18:05:06 +12:00
parent b4dc440650
commit 4ffa1c71e6
3 changed files with 8 additions and 4 deletions

View File

@ -182,8 +182,9 @@ class DocumentationSearch {
* @return string
*/
public function get_index_location() {
if(!self::$index_location)
if(!self::$index_location) {
self::$index_location = DOCSVIEWER_DIR;
}
return Controller::join_links(
TEMP_FOLDER,

View File

@ -14,7 +14,7 @@
class DocumentationViewer extends Controller {
static $allowed_actions = array(
public static $allowed_actions = array(
'home',
'LanguageForm',
'doLanguageForm',
@ -135,8 +135,9 @@ class DocumentationViewer extends Controller {
*/
public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
// if we submitted a form, let that pass
if(!$request->isGET() || isset($_GET['action_results']))
return parent::handleRequest($request);
if(!$request->isGET() || isset($_GET['action_results'])) {
return parent::handleRequest($request, $model);
}
$firstParam = ($request->param('Action')) ? $request->param('Action') : $request->shift();
$secondParam = $request->shift();

View File

@ -32,6 +32,8 @@ class RebuildLuceneDocsIndex extends BuildTask {
$lock = DocumentationSearch::get_index_location() .'/write.lock.file';
$lockFileFresh = (file_exists($lock) && filemtime($lock) > (time() - (60 * 60 * 24)));
echo "Building index in ". DocumentationSearch::get_index_location() . PHP_EOL;
if($lockFileFresh && !isset($_REQUEST['flush'])) {
if(!$quiet) {
echo "Index recently rebuilt. If you want to force reindex use ?flush=1";