Esempio n. 1
0
 /**
  * Return a user from its username
  * @param $username The username to search to
  * @param int $client_id Manually specify the client_id, -1 to select the first
  * @return User|null
  */
 public static function fromUsername($username, $client_id = -1)
 {
     if (User::$autoIncrement == null) {
         User::buildCache();
     }
     if ($client_id == -1) {
         return count(User::$cache[$username]) > 0 ? array_values(User::$cache[$username])[0] : null;
     } else {
         return isset(User::$cache[$username][$client_id]) ? User::$cache[$username][$client_id] : null;
     }
 }
 public static function runAnalysis()
 {
     UserCollapser::$K1 = Config::get("analyzers.UserCollapser.K1", UserCollapser::K1);
     UserCollapser::$K2 = Config::get("analyzers.UserCollapser.K2", UserCollapser::K2);
     UserCollapser::$IP_SUBNET = Config::get("analyzers.UserCollapser.ip_subnet", UserCollapser::IP_SUBNET);
     UserCollapser::$MERGE_THRESHOLD = Config::get("analyzers.UserCollapser.merge_threshold", UserCollapser::MERGE_THRESHOLD);
     UserCollapser::$MERGE_FIXED_THRESHOLD = Config::get("analyzers.UserCollapser.merge_fixed_threshold", UserCollapser::MERGE_FIXED_THRESHOLD);
     $startTime = microtime(true);
     UserCollapser::$users = UserCollapser::prepare();
     $endTime = microtime(true);
     Logger::log("    prepare() ->", $endTime - $startTime);
     $startTime = microtime(true);
     UserCollapser::loop();
     $endTime = microtime(true);
     Logger::log("    loop() ->", $endTime - $startTime);
     UserCollapser::saveResults();
     User::buildCache();
 }