@@ -52,19 +52,40 @@ public function statementCount(){
5252 *
5353 **/
5454 public function actorCount (){
55-
56- $ count = $ this ->db ->statements ->aggregate (
55+ $ count_array = ['mbox ' => '' , 'openid ' => '' , 'mbox_sha1sum ' => '' , 'account ' => '' ];
56+
57+ $ count_array ['mbox ' ] = $ this ->db ->statements ->aggregate (
5758 array ('$match ' => $ this ->getMatch ( $ this ->lrs )),
5859 array ('$group ' => array ('_id ' => '$statement.actor.mbox ' )),
5960 array ('$group ' => array ('_id ' => 1 , 'count ' => array ('$sum ' => 1 )))
6061 );
62+
63+ $ count_array ['openid ' ] = $ this ->db ->statements ->aggregate (
64+ array ('$match ' => $ this ->getMatch ( $ this ->lrs )),
65+ array ('$group ' => array ('_id ' => '$statement.actor.openid ' )),
66+ array ('$group ' => array ('_id ' => 1 , 'count ' => array ('$sum ' => 1 )))
67+ );
68+
69+ $ count_array ['mbox_sha1sum ' ] = $ this ->db ->statements ->aggregate (
70+ array ('$match ' => $ this ->getMatch ( $ this ->lrs )),
71+ array ('$group ' => array ('_id ' => '$statement.actor.mbox_sha1sum ' )),
72+ array ('$group ' => array ('_id ' => 1 , 'count ' => array ('$sum ' => 1 )))
73+ );
74+
75+ $ count_array ['account ' ] = $ this ->db ->statements ->aggregate (
76+ array ('$match ' => $ this ->getMatch ( $ this ->lrs )),
77+ array ('$group ' => array ('_id ' => '$statement.actor.account.name ' )),
78+ array ('$group ' => array ('_id ' => 1 , 'count ' => array ('$sum ' => 1 )))
79+ );
6180
62- if ( isset ($ count ['result ' ][0 ]) ){
63- return $ count ['result ' ][0 ]['count ' ];
64- }else {
65- return 0 ;
81+ $ summary = 0 ;
82+ foreach ($ count_array as $ key => $ val ) {
83+ if ( isset ($ val ['result ' ][0 ]) ){
84+ $ summary += $ val ['result ' ][0 ]['count ' ];
85+ }
6686 }
67-
87+
88+ return $ summary ;
6889 }
6990
7091 /**
0 commit comments