Merge branch '5.5'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / action / CoreRewriteTestAction.class.php
1 <?php
2
3 namespace wcf\action;
4
5 use Laminas\Diactoros\Response\JsonResponse;
6 use wcf\system\exception\IllegalLinkException;
7
8 /**
9 * Internal action used to run a test for url rewriting.
10 *
11 * @author Alexander Ebert
12 * @copyright 2001-2019 WoltLab GmbH
13 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
14 * @since 3.1
15 */
16 final class CoreRewriteTestAction extends AbstractAction
17 {
18 const AVAILABLE_DURING_OFFLINE_MODE = true;
19
20 /**
21 * @inheritDoc
22 *
23 * @throws IllegalLinkException
24 */
25 public function readParameters()
26 {
27 parent::readParameters();
28
29 if (!isset($_GET['uuidHash']) || !\hash_equals(\hash('sha256', WCF_UUID), $_GET['uuidHash'])) {
30 throw new IllegalLinkException();
31 }
32 }
33
34 /**
35 * @inheritDoc
36 */
37 public function execute()
38 {
39 parent::execute();
40
41 return new JsonResponse(
42 [
43 'core_rewrite_test' => 'passed',
44 ],
45 200,
46 [
47 'access-control-allow-origin' => '*',
48 ]
49 );
50 }
51 }