[TASK] Move vendor/ directory out of contrib/
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Start / Install.php
1 <?php
2 /*
3 * This file is part of the TYPO3 CMS project.
4 *
5 * It is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License, either version 2
7 * of the License, or any later version.
8 *
9 * For the full copyright and license information, please read the
10 * LICENSE.txt file that was distributed with this source code.
11 *
12 * The TYPO3 project - inspiring people to share!
13 */
14
15 /**
16 * Entry point to the install tool and step installer.
17 *
18 * There are two main controllers: "step" and "tool".
19 * The step controller is always called first, and redirects to the tool controller
20 * if the basic core functionality is given (instance configuration exists, database
21 * connection works, ...)
22 * The tool controller is the main "install tool" with all the main functionality.
23 *
24 * The step controller handles the basic installation.
25 * During first installation it creates the basic file and folder structure, the
26 * configuration files, the database connection and a basic configuration. Those steps
27 * are cycled through and if some step returns TRUE on "needsExecution", an input
28 * form of this step is rendered.
29 * After initial installation, the step installer is still called if the install
30 * tool is accessed, so it will automatically come up if some basic configuration fails.
31 * If everything is ok, the step installer will redirect to the main install tool.
32 * The step installer also has some "silent" update scripts, for example it migrates
33 * a localconf.php to LocalConfiguration if needed.
34 *
35 * This ensures as soon as the tool controller is called, the basic configuration is ok.
36 *
37 * Whenever the bootstrap or other core elements figure the installation
38 * needs an update that is handled within the step controller, it should just
39 * redirect to the entry script and let the step controller do necessary work.
40 *
41 * The step installer initiates browser redirects if steps were executed. This simplifies
42 * internal logic by separating the different bootstrap states needed during installation
43 * from each other.
44 *
45 * There is also a backend module controller, that basically only shows a screen
46 * with the "enable install tool" button and then redirects to the entry script. Other
47 * than that, it does not interfere with step or tool controller and just sets a
48 * context GET parameter to indicate that the install tool is called within backend context.
49 *
50 * To coordinate different tasks within step and install controller and actions, several
51 * GET or POST parameters are used, all prefixed with "install".
52 * Parameters allowed as GET and POST are preserved during redirects, POST parameters are
53 * thrown away between redirects (HTTP status code 303).
54 *
55 * The following main GET and POST parameters are used:
56 * - GET/POST "install[context]" Preserved
57 * Either empty, 'standalone' or 'backend', fallback to 'standalone'. Set to 'backend'
58 * if install tool is called form the backend main module (BackendModuleController). This
59 * changes the view a bit and shows the doc header in the install tool, changes background
60 * color and such.
61 *
62 * - GET/POST "install[controller]" Preserved
63 * Either empty, 'step' or 'tool', fallback to 'step'. This coordinates whether the step
64 * or tool controller is called. This parameter is never set externally, so the step
65 * controller is always called first. It itself sets the type to 'tool' and redirects to
66 * the tool controller if needed.
67 * This means you could (but shouldn't) directly call the tool controller, but it
68 * will still require a login and session, then.
69 *
70 * - GET/POST "install[action]" Preserved
71 * Determine step and tool controller main action sanitized by step / tool controller and
72 * only executed if user is logged in. Form protection API relies on this.
73 *
74 * - GET/POST "install[redirectCount]"
75 * The install tool initiates redirects to itself if configuration parameters were changed.
76 * This may lead to infinite redirect loops under rare circumstances. This parameter is
77 * incremented for each redirect to break a loop after some iterations.
78 *
79 * - POST "install[set]"
80 * Contains keys to determine which sub-action of the action is requested,
81 * eg. "change install tool password" in "important actions". Set to 'execute' if some
82 * step should be executed.
83 *
84 * - POST "install[values]"
85 * Data values for a specific "install[set]" action
86 *
87 * - POST "install[token]"
88 * A session and instance specific token created from the instance specific
89 * encryptionKey (taken care of in an early point in the step controller). This hash
90 * is used as form protection against CSRF for all POST data. Both the step and tool
91 * controller will logout a user if the token check fails. The only exception to this
92 * handling is the very first installation step where no session and no encryption key
93 * can exist yet.
94 */
95
96 /*
97 * This check avoids a parse error "unexpected 'class'" for users installing TYPO3 CMS 7
98 * on PHP 5.4. Without it the redirect to the install tool does not work.
99 * @see https://forge.typo3.org/issues/64504
100 */
101 if (version_compare(PHP_VERSION, '5.5.0', '<')) {
102 die('TYPO3 CMS requires PHP 5.5 or above');
103 }
104
105 // set up bare minimum application: class loader, LocalConfiguration, but no extensions and such
106 call_user_func(function() {
107 $classLoader = require __DIR__ . '/../../../vendor/autoload.php';
108 (new \TYPO3\CMS\Install\Http\Application($classLoader))->run();
109 });