Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Session - count online users #48

Open
c-nv-s opened this issue Feb 14, 2021 · 2 comments
Open

Enhancement: Session - count online users #48

c-nv-s opened this issue Feb 14, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@c-nv-s
Copy link

c-nv-s commented Feb 14, 2021

Is it possible to make a USER>SESSION endpoint to GET the members statistic - number of online users

https://github.com/humhub/humhub/blame/0086c52945f32f5b2dd86c17a194a9014238dc2a/protected/humhub/modules/directory/widgets/MemberStatistics.php#L27

At the moment there only appears to be an option to DELETE sessions:
https://www.humhub.com/en/marketplace/rest/docs/html/user.html#tag/Session/paths/~1user~1session~1all~1{id}/delete

@luke- luke- added the enhancement New feature or request label Feb 15, 2021
@c-nv-s
Copy link
Author

c-nv-s commented Mar 4, 2021

I am currently also exploring any flexible, non-interactive ways of obtaining this value ( and any other useful values ) via the command line as well.

The https://docs.humhub.org/docs/admin/console/ commands are very useful, however I am not aware of a way to add a custom command outside of the base humhub installation, similar to the theming implementation.

I tried importing https://github.com/yiisoft/yii2-shell via composer to see if there is a non-interactive mode but this seems to downgrade and remove many essential humhub dependencies. Although the command did still seem to work in interactive mode

>>>  \humhub\modules\user\components\Session::getOnlineUsers()->count();
=> 1

I am guessing there should be a way to just run the command through vanilla psysh but then you'd have to import the yii2 framwork in the command too.

$ ./psysh --no-interactive ' include ... ; require ... ; \humhub\modules\user\components\Session::getOnlineUsers()->count(); '

Any help or advice for the best approach on this would be appreciated.

@luke-
Copy link
Contributor

luke- commented Mar 4, 2021

I think the REST API is the best way to do this. However, the endpoint for this is currently missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants