Commit ce571e0fd0fcaff2bd8fef5ad2f5c8355064857a

Authored by Jonathan Byrne
1 parent 9bc595e4

KTS-2505

"Database configuration issues cause horrible knowledgetree failure"

Fixed
Added a check to stop any database calls in search if there is a database error.

Committed By: Jonathan Byrne
Reviewed By: Jalaloedien Abrahams

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7687 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 8 additions and 0 deletions
search2/search/search.inc.php
... ... @@ -263,6 +263,14 @@ class SearchHelper
263 263  
264 264 public static function getSavedSearches($userID)
265 265 {
  266 +
  267 + // need to test for broken db configuration so that the queries dont fail
  268 + // and so that we can be redirected to the db error page
  269 + // TODO: maybe best to have a special db error page rather than the default template when logged in
  270 +
  271 + global $default;
  272 + if (is_null($default->_db) || PEAR::isError($default->_db)) return array();
  273 +
266 274 $sql = "SELECT id, name FROM search_saved WHERE type='S'";
267 275  
268 276 // if we are not the system admin, then we get only ours or shared searches
... ...