From 463b23baee010be33c82bca41c1028d1ea6f988c Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 23 Mar 2011 12:16:40 +1300 Subject: [PATCH] MINOR Exception when SiteTree or File are not present in MySQLDatabase->searchEngine() --- core/model/MySQLDatabase.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/model/MySQLDatabase.php b/core/model/MySQLDatabase.php index d721fe19a..9f5e70ca5 100755 --- a/core/model/MySQLDatabase.php +++ b/core/model/MySQLDatabase.php @@ -751,6 +751,9 @@ class MySQLDatabase extends SS_Database { * @param string $keywords Keywords as a string. */ public function searchEngine($classesToSearch, $keywords, $start, $pageLength, $sortBy = "Relevance DESC", $extraFilter = "", $booleanSearch = false, $alternativeFileFilter = "", $invertedMatch = false) { + if(!class_exists('SiteTree')) throw new Exception('MySQLDatabase->searchEngine() requires "SiteTree" class'); + if(!class_exists('File')) throw new Exception('MySQLDatabase->searchEngine() requires "File" class'); + $fileFilter = ''; $keywords = Convert::raw2sql($keywords); $htmlEntityKeywords = htmlentities($keywords, ENT_NOQUOTES, 'UTF-8');