mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 09:05:56 +00:00
FIX: prevent notice while doing search request.
This commit is contained in:
parent
b4dc440650
commit
4ffa1c71e6
@ -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,
|
||||
|
@ -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();
|
||||
|
@ -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";
|
||||
|
Loading…
x
Reference in New Issue
Block a user