mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02: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
|
* @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,
|
||||||
|
@ -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();
|
||||||
|
@ -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";
|
||||||
|
Loading…
Reference in New Issue
Block a user