Backport of #9562

remove dead code

do not filter groups. but update the user count according to the filter

improve phpdoc

improve metadata runtime cache

add metadata tests

fixing PHPDoc