adding OC6 public API for activities

remotes/origin/stable6
Thomas Müller 11 years ago
parent 926b3c9b7b
commit 8e97752bf7
  1. 27
      lib/private/activitymanager.php
  2. 15
      lib/public/activity/iconsumer.php
  3. 7
      lib/public/activity/imanager.php

@ -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

Loading…
Cancel
Save