Permalink
Browse files

MINOR Exception when SiteTree or File are not present in MySQLDatabas…

…e->searchEngine()
  • Loading branch information...
1 parent 357ea56 commit 463b23baee010be33c82bca41c1028d1ea6f988c @chillu chillu committed Mar 22, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 core/model/MySQLDatabase.php
@@ -751,6 +751,9 @@ public function enumValuesForField($tableName, $fieldName) {
* @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');

0 comments on commit 463b23b

Please sign in to comment.