diff --git a/lib/base.php b/lib/base.php index d98d60fee109..fe0288c662ce 100644 --- a/lib/base.php +++ b/lib/base.php @@ -913,11 +913,6 @@ public static function handleRequest() { throw $e; } catch (Symfony\Component\Routing\Exception\ResourceNotFoundException $e) { //header('HTTP/1.0 404 Not Found'); - $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->dispatch(\OCP\Http\HttpEvents::EVENT_404, new OCP\Http\HttpEvents( - \OCP\Http\HttpEvents::EVENT_404, - OC::$server->getRequest() - )); } catch (Symfony\Component\Routing\Exception\MethodNotAllowedException $e) { OC_Response::setStatus(405); return; diff --git a/lib/public/Http/HttpEvents.php b/lib/public/Http/HttpEvents.php deleted file mode 100644 index 532c932e0952..000000000000 --- a/lib/public/Http/HttpEvents.php +++ /dev/null @@ -1,64 +0,0 @@ - - * - * @copyright Copyright (c) 2018, ownCloud GmbH - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see - * - */ - -namespace OCP\Http; - -use OCP\IRequest; -use Symfony\Component\EventDispatcher\Event; - -/** - * @since 10.0.3 - */ -class HttpEvents extends Event { - /** @var string */ - const EVENT_404 = 'resource.not_found'; - - /** @var string */ - protected $event; - /** @var IRequest */ - protected $request; - - /** - * @param string $event - * @param IRequest $request - * @since 10.0.3 - */ - public function __construct($event, $request) { - $this->event = $event; - $this->request = $request; - } - - /** - * @return string - * @since 10.0.3 - */ - public function getEvent() { - return $this->event; - } - - /** - * @return IRequest - * @since 10.0.3 - */ - public function getRequest() { - return $this->request; - } -} diff --git a/ocs/v1.php b/ocs/v1.php index c149b7cbf2c4..4ba42ccfa94b 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -11,7 +11,6 @@ * @author Thomas Müller * @author Tom Needham * @author Vincent Petry - * @author Semih Serhat Karakaya * * @copyright Copyright (c) 2018, ownCloud GmbH * @license AGPL-3.0 @@ -64,11 +63,6 @@ OC::$server->getRouter()->match('/ocs'.\OC::$server->getRequest()->getRawPathInfo()); return; } catch (ResourceNotFoundException $e) { - $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->dispatch(\OCP\Http\HttpEvents::EVENT_404, new OCP\Http\HttpEvents( - \OCP\Http\HttpEvents::EVENT_404, - OC::$server->getRequest() - )); // Fall through the not found } catch (MethodNotAllowedException $e) { OC_API::setContentType(); @@ -91,11 +85,6 @@ } catch (LoginException $e) { OC_API::respond(new Result(null, \OCP\API::RESPOND_UNAUTHORISED, 'Unauthorised'), OC_API::requestedFormat()); } catch (ResourceNotFoundException $e) { - $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->dispatch(\OCP\Http\HttpEvents::EVENT_404, new OCP\Http\HttpEvents( - \OCP\Http\HttpEvents::EVENT_404, - OC::$server->getRequest() - )); OC_API::setContentType(); OC_API::notFound(); } catch (MethodNotAllowedException $e) { diff --git a/public.php b/public.php index 48eecfde055b..2d274695e64a 100644 --- a/public.php +++ b/public.php @@ -43,11 +43,6 @@ if (!$pathInfo && $request->getParam('service', '') === '') { \header('HTTP/1.0 404 Not Found'); - $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->dispatch(\OCP\Http\HttpEvents::EVENT_404, new OCP\Http\HttpEvents( - \OCP\Http\HttpEvents::EVENT_404, - OC::$server->getRequest() - )); exit; } elseif ($request->getParam('service', '')) { $service = $request->getParam('service', ''); @@ -58,11 +53,6 @@ $file = \OC::$server->getConfig()->getAppValue('core', 'public_' . \strip_tags($service)); if ($file === null) { \header('HTTP/1.0 404 Not Found'); - $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->dispatch(\OCP\Http\HttpEvents::EVENT_404, new OCP\Http\HttpEvents( - \OCP\Http\HttpEvents::EVENT_404, - OC::$server->getRequest() - )); exit; } diff --git a/remote.php b/remote.php index 9914b141f484..87d67db8dd4a 100644 --- a/remote.php +++ b/remote.php @@ -123,11 +123,6 @@ function resolveService($service) { $request = \OC::$server->getRequest(); $pathInfo = $request->getPathInfo(); if ($pathInfo === false || $pathInfo === '') { - $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->dispatch(\OCP\Http\HttpEvents::EVENT_404, new OCP\Http\HttpEvents( - \OCP\Http\HttpEvents::EVENT_404, - OC::$server->getRequest() - )); throw new RemoteException('Path not found', OC_Response::STATUS_NOT_FOUND); } if (!$pos = \strpos($pathInfo, '/', 1)) { @@ -138,11 +133,6 @@ function resolveService($service) { $file = resolveService($service); if ($file === null) { - $dispatcher = \OC::$server->getEventDispatcher(); - $dispatcher->dispatch(\OCP\Http\HttpEvents::EVENT_404, new OCP\Http\HttpEvents( - \OCP\Http\HttpEvents::EVENT_404, - OC::$server->getRequest() - )); throw new RemoteException('Path not found', OC_Response::STATUS_NOT_FOUND); }