SET HTTP_PROXY=http://тутIP:тутPORT
$data = array();
foreach ( ORM::factory('Role')->find_all() as $role) {
$data[$role->name] = $role->users->count_all();
}
arsort($data);
echo Debug::vars($data);
$data = DB::select(DB::expr('count(user_id) cnt, roles.name'))
->distinct(TRUE)
->from('roles_users')
->join('roles', 'RIGHT')
->on('roles_users.role_id', '=', 'roles.id')
->group_by('role_id')
->order_by('cnt', 'DESC')
->execute();
echo Debug::vars($data->as_array());