MINOR Exception when SiteTree or File are not present in MySQLDatabase->searchEngine()

This commit is contained in:
Ingo Schommer 2011-03-23 12:16:40 +13:00
parent 357ea56c02
commit 463b23baee

View File

@ -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');