/** * test several mandatory elements in the system. * if one of them doesn't work - DIE ! * this will prevent users to see half baked pages */ private function healthCheck() { try { $request = $this->getContext()->getRequest(); $r = new sfWebRequest(); if ($request->isXmlHttpRequest()) { // don't tdo the heavy tests for ajax return; } // memcache $dummy_cache = new myCache("healthCheck"); // TODO - performance // DB $c = new Criteria(); $c->add(kshowPeer::ID, 1); $id_list = kshowPeer::selectIdsForCriteria($c); } catch (Exception $ex) { // on error - redirect to maintenance page $context = $this->getContext(); return $context->getController()->redirect(self::ERROR_URL); } }