Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>pull/45375/head
'OC\\Encryption\\Util' => $baseDir . '/lib/private/Encryption/Util.php', | 'OC\\Encryption\\Util' => $baseDir . '/lib/private/Encryption/Util.php', | ||||
'OC\\EventDispatcher\\EventDispatcher' => $baseDir . '/lib/private/EventDispatcher/EventDispatcher.php', | 'OC\\EventDispatcher\\EventDispatcher' => $baseDir . '/lib/private/EventDispatcher/EventDispatcher.php', | ||||
'OC\\EventDispatcher\\ServiceEventListener' => $baseDir . '/lib/private/EventDispatcher/ServiceEventListener.php', | 'OC\\EventDispatcher\\ServiceEventListener' => $baseDir . '/lib/private/EventDispatcher/ServiceEventListener.php', | ||||
'OC\\EventSource' => $baseDir . '/lib/private/EventSource.php', | |||||
'OC\\EventSourceFactory' => $baseDir . '/lib/private/EventSourceFactory.php', | 'OC\\EventSourceFactory' => $baseDir . '/lib/private/EventSourceFactory.php', | ||||
'OC\\Federation\\CloudFederationFactory' => $baseDir . '/lib/private/Federation/CloudFederationFactory.php', | 'OC\\Federation\\CloudFederationFactory' => $baseDir . '/lib/private/Federation/CloudFederationFactory.php', | ||||
'OC\\Federation\\CloudFederationNotification' => $baseDir . '/lib/private/Federation/CloudFederationNotification.php', | 'OC\\Federation\\CloudFederationNotification' => $baseDir . '/lib/private/Federation/CloudFederationNotification.php', | ||||
'OC_API' => $baseDir . '/lib/private/legacy/OC_API.php', | 'OC_API' => $baseDir . '/lib/private/legacy/OC_API.php', | ||||
'OC_App' => $baseDir . '/lib/private/legacy/OC_App.php', | 'OC_App' => $baseDir . '/lib/private/legacy/OC_App.php', | ||||
'OC_Defaults' => $baseDir . '/lib/private/legacy/OC_Defaults.php', | 'OC_Defaults' => $baseDir . '/lib/private/legacy/OC_Defaults.php', | ||||
'OC_EventSource' => $baseDir . '/lib/private/legacy/OC_EventSource.php', | |||||
'OC_FileChunking' => $baseDir . '/lib/private/legacy/OC_FileChunking.php', | 'OC_FileChunking' => $baseDir . '/lib/private/legacy/OC_FileChunking.php', | ||||
'OC_Files' => $baseDir . '/lib/private/legacy/OC_Files.php', | 'OC_Files' => $baseDir . '/lib/private/legacy/OC_Files.php', | ||||
'OC_Helper' => $baseDir . '/lib/private/legacy/OC_Helper.php', | 'OC_Helper' => $baseDir . '/lib/private/legacy/OC_Helper.php', |
'OC\\Encryption\\Util' => __DIR__ . '/../../..' . '/lib/private/Encryption/Util.php', | 'OC\\Encryption\\Util' => __DIR__ . '/../../..' . '/lib/private/Encryption/Util.php', | ||||
'OC\\EventDispatcher\\EventDispatcher' => __DIR__ . '/../../..' . '/lib/private/EventDispatcher/EventDispatcher.php', | 'OC\\EventDispatcher\\EventDispatcher' => __DIR__ . '/../../..' . '/lib/private/EventDispatcher/EventDispatcher.php', | ||||
'OC\\EventDispatcher\\ServiceEventListener' => __DIR__ . '/../../..' . '/lib/private/EventDispatcher/ServiceEventListener.php', | 'OC\\EventDispatcher\\ServiceEventListener' => __DIR__ . '/../../..' . '/lib/private/EventDispatcher/ServiceEventListener.php', | ||||
'OC\\EventSource' => __DIR__ . '/../../..' . '/lib/private/EventSource.php', | |||||
'OC\\EventSourceFactory' => __DIR__ . '/../../..' . '/lib/private/EventSourceFactory.php', | 'OC\\EventSourceFactory' => __DIR__ . '/../../..' . '/lib/private/EventSourceFactory.php', | ||||
'OC\\Federation\\CloudFederationFactory' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationFactory.php', | 'OC\\Federation\\CloudFederationFactory' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationFactory.php', | ||||
'OC\\Federation\\CloudFederationNotification' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationNotification.php', | 'OC\\Federation\\CloudFederationNotification' => __DIR__ . '/../../..' . '/lib/private/Federation/CloudFederationNotification.php', | ||||
'OC_API' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_API.php', | 'OC_API' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_API.php', | ||||
'OC_App' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_App.php', | 'OC_App' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_App.php', | ||||
'OC_Defaults' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Defaults.php', | 'OC_Defaults' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Defaults.php', | ||||
'OC_EventSource' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_EventSource.php', | |||||
'OC_FileChunking' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_FileChunking.php', | 'OC_FileChunking' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_FileChunking.php', | ||||
'OC_Files' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Files.php', | 'OC_Files' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Files.php', | ||||
'OC_Helper' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Helper.php', | 'OC_Helper' => __DIR__ . '/../../..' . '/lib/private/legacy/OC_Helper.php', |
<?php | <?php | ||||
use OCP\IRequest; | |||||
/** | /** | ||||
* @copyright Copyright (c) 2016, ownCloud, Inc. | * @copyright Copyright (c) 2016, ownCloud, Inc. | ||||
* | * | ||||
* along with this program. If not, see <http://www.gnu.org/licenses/> | * along with this program. If not, see <http://www.gnu.org/licenses/> | ||||
* | * | ||||
*/ | */ | ||||
class OC_EventSource implements \OCP\IEventSource { | |||||
namespace OC; | |||||
use OCP\IEventSource; | |||||
use OCP\IRequest; | |||||
class EventSource implements IEventSource { | |||||
/** | /** | ||||
* @var bool | * @var bool | ||||
*/ | */ | ||||
$this->started = true; | $this->started = true; | ||||
// prevent php output buffering, caching and nginx buffering | // prevent php output buffering, caching and nginx buffering | ||||
OC_Util::obEnd(); | |||||
\OC_Util::obEnd(); | |||||
header('Cache-Control: no-cache'); | header('Cache-Control: no-cache'); | ||||
header('X-Accel-Buffering: no'); | header('X-Accel-Buffering: no'); | ||||
$this->fallback = isset($_GET['fallback']) and $_GET['fallback'] == 'true'; | $this->fallback = isset($_GET['fallback']) and $_GET['fallback'] == 'true'; |
use OCP\IRequest; | use OCP\IRequest; | ||||
class EventSourceFactory implements IEventSourceFactory { | class EventSourceFactory implements IEventSourceFactory { | ||||
private IRequest $request; | |||||
public function __construct(IRequest $request) { | |||||
$this->request = $request; | |||||
public function __construct( | |||||
private IRequest $request, | |||||
) { | |||||
} | } | ||||
/** | |||||
* Create a new event source | |||||
* | |||||
* @return IEventSource | |||||
* @since 28.0.0 | |||||
*/ | |||||
public function create(): IEventSource { | public function create(): IEventSource { | ||||
return new \OC_EventSource($this->request); | |||||
return new EventSource($this->request); | |||||
} | } | ||||
} | } |