|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
include_once "$PROJECT_ROOT/languages/language_flags.php";
|
|
|
|
include_once "$PROJECT_ROOT/languages/language_flags.php";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$WEEK_SECONDS = 604800;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Representation of Session Community room.
|
|
|
|
* Representation of Session Community room.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -199,6 +200,28 @@
|
|
|
|
$pubkey_4 = substr($this->server->pubkey, 0, 4);
|
|
|
|
$pubkey_4 = substr($this->server->pubkey, 0, 4);
|
|
|
|
return "$token+$pubkey_4";
|
|
|
|
return "$token+$pubkey_4";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Returns an estimate for the weekly active users of a CommunityRoom.
|
|
|
|
|
|
|
|
* @return int Active user count normalized by tracked timespan of active users.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
function get_weekly_active_users(): int {
|
|
|
|
|
|
|
|
global $WEEK_SECONDS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$active_users = $this->active_users;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($active_users == null) {
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$active_users_cutoff = $this->active_users_cutoff;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($active_users_cutoff == null) {
|
|
|
|
|
|
|
|
return $active_users;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return floor($active_users * $WEEK_SECONDS / $active_users_cutoff);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|