Skip to content
Snippets Groups Projects
Commit 8e97752b authored by Thomas Müller's avatar Thomas Müller
Browse files

adding OC6 public API for activities

parent 926b3c9b
Branches
No related tags found
No related merge requests found
......@@ -10,24 +10,44 @@ namespace OC;
use OCP\Activity\IConsumer;
use OCP\Activity\IManager;
class ActivityManager implements \OCP\Activity\IManager {
class ActivityManager implements IManager {
private $consumers = array();
/**
* @param $app
* @param $subject
* @param $subjectParams
* @param $message
* @param $messageParams
* @param $file
* @param $link
* @param $affectedUser
* @param $type
* @param $priority
* @return mixed
*/
function publishActivity($app, $subject, $message, $file, $link) {
function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority) {
foreach($this->consumers as $consumer) {
$c = $consumer();
if ($c instanceof IConsumer) {
$c->receive($app, $subject, $message, $file, $link);
try {
$c->receive(
$app,
$subject,
$subjectParams,
$message,
$messageParams,
$file,
$link,
$affectedUser,
$type,
$priority);
} catch (\Exception $ex) {
// TODO: log the excepetion
}
}
}
......@@ -45,4 +65,5 @@ class ActivityManager implements \OCP\Activity\IManager {
function registerConsumer(\Closure $callable) {
array_push($this->consumers, $callable);
}
}
......@@ -24,6 +24,19 @@
namespace OCP\Activity;
interface IConsumer {
function receive($app, $subject, $message, $file, $link);
/**
* @param $app
* @param $subject
* @param $subjectParams
* @param $message
* @param $messageParams
* @param $file
* @param $link
* @param $affectedUser
* @param $type
* @param $priority
* @return mixed
*/
function receive($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority );
}
......@@ -28,12 +28,17 @@ interface IManager {
/**
* @param $app
* @param $subject
* @param $subjectParams
* @param $message
* @param $messageParams
* @param $file
* @param $link
* @param $affectedUser
* @param $type
* @param $priority
* @return mixed
*/
function publishActivity($app, $subject, $message, $file, $link);
function publishActivity($app, $subject, $subjectParams, $message, $messageParams, $file, $link, $affectedUser, $type, $priority);
/**
* In order to improve lazy loading a closure can be registered which will be called in case
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment