Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
FIX: prevent notice while doing search request.
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Sep 9, 2012
1 parent b4dc440 commit 4ffa1c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion code/DocumentationSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ public function set_index($index) {
* @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,
Expand Down
7 changes: 4 additions & 3 deletions code/controllers/DocumentationViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

class DocumentationViewer extends Controller {

static $allowed_actions = array(
public static $allowed_actions = array(
'home',
'LanguageForm',
'doLanguageForm',
Expand Down Expand Up @@ -135,8 +135,9 @@ public function handleAction($request) {
*/
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();
Expand Down
2 changes: 2 additions & 0 deletions code/tasks/RebuildLuceneDocsIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ function rebuildIndexes($quiet = false) {
$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";
Expand Down

0 comments on commit 4ffa1c7

Please sign in to comment.