From fa3393674c854e884abf10d3b82dab03aca83c61 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 4 Sep 2014 01:10:02 +0200 Subject: [PATCH] Better phpdoc and method naming --- apps/files/ajax/newfile.php | 2 +- apps/files/ajax/scan.php | 2 +- core/ajax/update.php | 2 +- lib/private/appframework/core/api.php | 2 +- lib/private/server.php | 4 ++-- lib/public/ieventsource.php | 2 ++ lib/public/iservercontainer.php | 4 ++-- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/files/ajax/newfile.php b/apps/files/ajax/newfile.php index 1070246fca..46629e1b60 100644 --- a/apps/files/ajax/newfile.php +++ b/apps/files/ajax/newfile.php @@ -16,7 +16,7 @@ $content = isset( $_REQUEST['content'] ) ? $_REQUEST['content'] : ''; $source = isset( $_REQUEST['source'] ) ? trim($_REQUEST['source'], '/\\') : ''; if($source) { - $eventSource = \OC::$server->getEventSource(); + $eventSource = \OC::$server->createEventSource(); } else { OC_JSON::callCheck(); } diff --git a/apps/files/ajax/scan.php b/apps/files/ajax/scan.php index eed620113a..da5a2ce6f2 100644 --- a/apps/files/ajax/scan.php +++ b/apps/files/ajax/scan.php @@ -15,7 +15,7 @@ if (isset($_GET['users'])) { $users = array(OC_User::getUser()); } -$eventSource = \OC::$server->getEventSource(); +$eventSource = \OC::$server->createEventSource(); $listener = new ScanListener($eventSource); foreach ($users as $user) { diff --git a/core/ajax/update.php b/core/ajax/update.php index 89ce279837..2a586535e7 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -4,7 +4,7 @@ require_once '../../lib/base.php'; if (OC::checkUpgrade(false)) { $l = new \OC_L10N('core'); - $eventSource = \OC::$server->getEventSource(); + $eventSource = \OC::$server->createEventSource(); $updater = new \OC\Updater(\OC_Log::$object); $updater->listen('\OC\Updater', 'maintenanceStart', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned on maintenance mode')); diff --git a/lib/private/appframework/core/api.php b/lib/private/appframework/core/api.php index 0dd3a58386..279f4bf97f 100644 --- a/lib/private/appframework/core/api.php +++ b/lib/private/appframework/core/api.php @@ -114,7 +114,7 @@ class API implements IApi{ * @return \OCP\IEventSource a new open EventSource class */ public function openEventSource(){ - return \OC::$server->getEventSource(); + return \OC::$server->createEventSource(); } /** diff --git a/lib/private/server.php b/lib/private/server.php index 1c3b1b03ce..0c663e8553 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -494,11 +494,11 @@ class Server extends SimpleContainer implements IServerContainer { } /** - * Returns a search instance + * Create a new event source * * @return \OCP\IEventSource */ - function getEventSource() { + function createEventSource() { return new \OC_EventSource(); } } diff --git a/lib/public/ieventsource.php b/lib/public/ieventsource.php index ea4bfc73d4..eb7853c5e9 100644 --- a/lib/public/ieventsource.php +++ b/lib/public/ieventsource.php @@ -13,6 +13,8 @@ namespace OCP; * includes a fallback for older browsers and IE * * use server side events with caution, to many open requests can hang the server + * + * The event source will initialize the connection to the client when the first data is sent */ interface IEventSource { /** diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 24d8894d9f..1abf0d9938 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -237,9 +237,9 @@ interface IServerContainer { function getCertificateManager($user = null); /** - * Returns a search instance + * Create a new event source * * @return \OCP\IEventSource */ - function getEventSource(); + function createEventSource(); }