mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 13:51:18 +08:00
DEV: Introduce plugin API for getting stats (#24829)
Before, when needed to get stats in a plugin, we called Core classes directly. Introducing plugin API will decouple plugins from Core and give as more freedom in refactoring stats in Core. Without this API, I wasn't able to do all refactorings I wanted when working on d91456f.
This commit is contained in:

committed by
GitHub

parent
368f4ef24d
commit
6e2201135f
@ -74,6 +74,11 @@ class Plugin::Instance
|
||||
@seed_fu_filter = filter
|
||||
end
|
||||
|
||||
# This method returns Core stats + stats registered by plugins
|
||||
def self.stats
|
||||
Stat.all_stats
|
||||
end
|
||||
|
||||
def self.find_all(parent_path)
|
||||
[].tap do |plugins|
|
||||
# also follows symlinks - http://stackoverflow.com/q/357754
|
||||
|
Reference in New Issue
Block a user