mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 14:03:52 +01:00
MDL-42891 logging: Add support for getting readers that implement a specific interface in log manager
This commit is contained in:
parent
8bae0d0d80
commit
e083efe0ac
@ -95,13 +95,17 @@ class manager implements \core\log\manager {
|
||||
*
|
||||
* This way the reports find out available sources of data.
|
||||
*
|
||||
* @param string $interface Returned stores must implement this interface.
|
||||
*
|
||||
* @return \core\log\reader[] list of available log data readers
|
||||
*/
|
||||
public function get_readers() {
|
||||
public function get_readers($interface = null) {
|
||||
$this->init();
|
||||
$return = array();
|
||||
foreach ($this->readers as $plugin => $reader) {
|
||||
$return[$plugin] = $reader;
|
||||
if (empty($interface) || ($reader instanceof $interface)) {
|
||||
$return[$plugin] = $reader;
|
||||
}
|
||||
}
|
||||
return $return;
|
||||
}
|
||||
|
@ -38,9 +38,11 @@ interface manager {
|
||||
/**
|
||||
* Return list of available log readers.
|
||||
*
|
||||
* @param string $interface All returned readers must implement this interface.
|
||||
*
|
||||
* @return \core\log\reader[]
|
||||
*/
|
||||
public function get_readers();
|
||||
public function get_readers($interface = null);
|
||||
|
||||
/**
|
||||
* Dispose all initialised stores.
|
||||
|
Loading…
x
Reference in New Issue
Block a user