Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 38 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | use Symfony\Component\HttpFoundation\RedirectResponse; |
| 15 | use Symfony\Component\HttpFoundation\Response; |
| 16 | use Symfony\Component\Routing\Exception\ExceptionInterface; |
| 17 | use Symfony\Component\Routing\Exception\RouteNotFoundException; |
| 18 | |
| 19 | /** |
| 20 | */ |
| 21 | define('IN_PHPBB', true); |
| 22 | $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; |
| 23 | $phpEx = substr(strrchr(__FILE__, '.'), 1); |
| 24 | include($phpbb_root_path . 'common.' . $phpEx); |
| 25 | |
| 26 | // Do not update users last page entry |
| 27 | $user->session_begin(false); |
| 28 | $auth->acl($user->data); |
| 29 | |
| 30 | $cron_type = $request->variable('cron_type', ''); |
| 31 | |
| 32 | $get_params_array = $request->get_super_global(\phpbb\request\request_interface::GET); |
| 33 | |
| 34 | /* @var $http_kernel \Symfony\Component\HttpKernel\HttpKernel */ |
| 35 | $http_kernel = $phpbb_container->get('http_kernel'); |
| 36 | |
| 37 | /* @var $symfony_request \phpbb\symfony_request */ |
| 38 | $symfony_request = $phpbb_container->get('symfony_request'); |
| 39 | |
| 40 | /** @var \phpbb\controller\helper $controller_helper */ |
| 41 | $controller_helper = $phpbb_container->get('controller.helper'); |
| 42 | $cron_route = 'phpbb_cron_run'; |
| 43 | |
| 44 | try |
| 45 | { |
| 46 | $response = new RedirectResponse( |
| 47 | $controller_helper->route($cron_route, $get_params_array, false), |
| 48 | Response::HTTP_MOVED_PERMANENTLY |
| 49 | ); |
| 50 | $response->send(); |
| 51 | $http_kernel->terminate($symfony_request, $response); |
| 52 | exit(); |
| 53 | } |
| 54 | catch (RouteNotFoundException $exception) |
| 55 | { |
| 56 | $error = 'ROUTE_NOT_FOUND'; |
| 57 | $error_parameters = $cron_route; |
| 58 | $error_code = Response::HTTP_NOT_FOUND; |
| 59 | } |
| 60 | catch (ExceptionInterface $exception) |
| 61 | { |
| 62 | $error = 'ROUTE_INVALID_MISSING_PARAMS'; |
| 63 | $error_parameters = $cron_route; |
| 64 | $error_code = Response::HTTP_BAD_REQUEST; |
| 65 | } |
| 66 | catch (Throwable $exception) |
| 67 | { |
| 68 | $error = $exception->getMessage(); |
| 69 | $error_parameters = []; |
| 70 | $error_code = Response::HTTP_INTERNAL_SERVER_ERROR; |
| 71 | } |
| 72 | |
| 73 | $language = $phpbb_container->get('language'); |
| 74 | $response = new Response( |
| 75 | $language->lang($error, $error_parameters), |
| 76 | $error_code |
| 77 | ); |
| 78 | $response->send(); |
| 79 | $http_kernel->terminate($symfony_request, $response); |