module)) { $limit = 0; if(isset($GLOBALS['sugar_config']['resource_management'])) { $res = $GLOBALS['sugar_config']['resource_management']; if(!empty($res['special_query_modules']) && in_array($observer->module, $res['special_query_modules']) && !empty($res['special_query_limit']) && is_int($res['special_query_limit']) && $res['special_query_limit'] > 0) { $limit = $res['special_query_limit']; } else if(!empty($res['default_limit']) && is_int($res['default_limit']) && $res['default_limit'] > 0) { $limit = $res['default_limit']; } } //if if($limit) { $db = DBManagerFactory::getInstance(); $db->setQueryLimit($limit); $observer->setLimit($limit); $this->_observers[] = $observer; } return true; } return false; } /** * notifyObservers * This method notifies the registered observers with the provided message. * @param $msg Message from language file to notify observers with */ public function notifyObservers($msg) { if(empty($this->_observers)) { return; } //Notify observers limit has been reached if(empty($GLOBALS['app_strings'])) { $GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']); } $limitMsg = $GLOBALS['app_strings'][$msg]; foreach( $this->_observers as $observer) { $limit = $observer->limit; $module = $observer->module; eval("\$limitMsg = \"$limitMsg\";"); $GLOBALS['log']->fatal($limitMsg); $observer->notify($limitMsg); } } /* * getObservers * Returns the observer instances that have been setup for the ResourceManager instance * @return Array of ResourceObserver(s) */ function getObservers() { return $this->_observers; } } ?>