Use the public api to get event sources
This commit is contained in:
parent
dad53180bc
commit
65608d7c92
|
@ -16,7 +16,7 @@ $content = isset( $_REQUEST['content'] ) ? $_REQUEST['content'] : '';
|
||||||
$source = isset( $_REQUEST['source'] ) ? trim($_REQUEST['source'], '/\\') : '';
|
$source = isset( $_REQUEST['source'] ) ? trim($_REQUEST['source'], '/\\') : '';
|
||||||
|
|
||||||
if($source) {
|
if($source) {
|
||||||
$eventSource=new OC_EventSource();
|
$eventSource = \OC::$server->getEventSource();
|
||||||
} else {
|
} else {
|
||||||
OC_JSON::callCheck();
|
OC_JSON::callCheck();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ if (isset($_GET['users'])) {
|
||||||
$users = array(OC_User::getUser());
|
$users = array(OC_User::getUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
$eventSource = new OC_EventSource();
|
$eventSource = \OC::$server->getEventSource();
|
||||||
$listener = new ScanListener($eventSource);
|
$listener = new ScanListener($eventSource);
|
||||||
|
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
|
@ -39,12 +39,12 @@ class ScanListener {
|
||||||
private $lastCount = 0;
|
private $lastCount = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC_EventSource event source to pass events to
|
* @var \OCP\IEventSource event source to pass events to
|
||||||
*/
|
*/
|
||||||
private $eventSource;
|
private $eventSource;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \OC_EventSource $eventSource
|
* @param \OCP\IEventSource $eventSource
|
||||||
*/
|
*/
|
||||||
public function __construct($eventSource) {
|
public function __construct($eventSource) {
|
||||||
$this->eventSource = $eventSource;
|
$this->eventSource = $eventSource;
|
||||||
|
|
|
@ -4,7 +4,7 @@ require_once '../../lib/base.php';
|
||||||
|
|
||||||
if (OC::checkUpgrade(false)) {
|
if (OC::checkUpgrade(false)) {
|
||||||
$l = new \OC_L10N('core');
|
$l = new \OC_L10N('core');
|
||||||
$eventSource = new OC_EventSource();
|
$eventSource = \OC::$server->getEventSource();
|
||||||
$updater = new \OC\Updater(\OC_Log::$object);
|
$updater = new \OC\Updater(\OC_Log::$object);
|
||||||
$updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) {
|
$updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) {
|
||||||
$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
|
$eventSource->send('success', (string)$l->t('Turned on maintenance mode'));
|
||||||
|
|
|
@ -110,12 +110,11 @@ class API implements IApi{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* used to return and open a new eventsource
|
* used to return and open a new event source
|
||||||
* @return \OC_EventSource a new open EventSource class
|
* @return \OCP\IEventSource a new open EventSource class
|
||||||
*/
|
*/
|
||||||
public function openEventSource(){
|
public function openEventSource(){
|
||||||
# TODO: use public api
|
return \OC::$server->getEventSource();
|
||||||
return new \OC_EventSource();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue