Skip to content

Instantly share code, notes, and snippets.

@alisha
Created July 18, 2018 23:43
Show Gist options
  • Save alisha/bc0c93376e13b00780652206cf428840 to your computer and use it in GitHub Desktop.
Save alisha/bc0c93376e13b00780652206cf428840 to your computer and use it in GitHub Desktop.
<?hh
function workspaces_get_pref_stats_only_admins(workspace_t $workspace): bool {
# Logging with a low sample rate
if (mt_rand(1, 5000) == 7){
log_event('workspaces_prefs_get', array('pref_name' => 'stats_only_admins'));
}
$ret = workspaces_prefs_get_single_safe($workspace, 'stats_only_admins');
if ($ret->is_error()) throw new WorkspacePrefFetchException('Workspace pref fetch failure');
return (bool)$ret->get();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment