public function getDeviceFromUA_RIS($userAgent, $tolerance, UserAgentMatcher &$matcher)
 {
     $result = parent::getDeviceFromUA_RIS($userAgent, $tolerance, $matcher);
     $device_list = array();
     $max_match_len = 0;
     if ($result != WurflConstants::NO_MATCH) {
         $query = "\nSELECT mrg.deviceID, mrg.user_agent \nFROM `" . TeraWurflConfig::$TABLE_PREFIX . 'Index' . "` idx \n\tINNER JOIN `" . TeraWurflConfig::$TABLE_PREFIX . 'Merge' . "` mrg ON idx.DeviceID = mrg.DeviceID \nWHERE mrg.match = 1 \n\tAND idx.matcher = " . $this->SQLPrep($matcher->tableSuffix()) . "\n\tAND mrg.user_agent LIKE " . $this->SQLPrep(substr($userAgent, 0, $tolerance) . '%');
         $res = $this->dbcon->query($query) or die($this->dbcon->error);
         while ($row = $res->fetch_assoc()) {
             $diff_index = 0;
             $diff_substr = '';
             // Start at length of shortest string
             $start_len = strlen($row['user_agent']) < strlen($userAgent) ? strlen($row['user_agent']) : strlen($userAgent);
             for ($i = $start_len; $i > 0; $i--) {
                 if (strcmp(substr($userAgent, 0, $i), substr($row['user_agent'], 0, $i)) === 0) {
                     // $i == current length, $i-1 == current char index
                     $diff_index = $i - 1;
                     $diff_substr = substr($userAgent, 0, $i);
                     break;
                 }
             }
             if ($i > $max_match_len) {
                 $max_match_len = $i;
             }
             $device_list[] = array('device_id' => $row['deviceID'], 'user_agent' => $row['user_agent'], 'diff_index' => $diff_index, 'diff_substr' => $diff_substr);
         }
         $res = null;
         // Sort $device_list array by the device's diff_index
         usort($device_list, array($this, 'cmpDiffIndex'));
     }
     self::$match_debug[] = array('matcher' => get_class($matcher), 'user_agent' => $userAgent, 'tolerance' => $tolerance, 'tolerance_ua' => substr($userAgent, 0, $tolerance), 'max_match_len' => $max_match_len, 'method' => 'RIS', 'match_id' => $result, 'device_list' => $device_list);
     return $result;
 }
 public function getDeviceFromUA_RIS($userAgent, $tolerance, UserAgentMatcher &$matcher)
 {
     $return = parent::getDeviceFromUA_RIS($userAgent, $tolerance, $matcher);
     $this->profiler->log();
     return $return;
 }
 /**
  * Let WURFL only deconnect, when the connection is not from TYPO3
  */
 public function __destruct()
 {
     if (!$this->sharedConnection) {
         parent::__destruct();
     }
 }