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 * @return string
*/ */
public function get_index_location() { public function get_index_location() {
if(!self::$index_location) if(!self::$index_location) {
self::$index_location = DOCSVIEWER_DIR; self::$index_location = DOCSVIEWER_DIR;
}
return Controller::join_links( return Controller::join_links(
TEMP_FOLDER, TEMP_FOLDER,

View File

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

View File

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