[BUGFIX] TceformsUpdateWizard shows up too often
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Service / ContextService.php
1 <?php
2 namespace TYPO3\CMS\Install\Service;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2013 Ernesto Baschny <ernst@cron-it.de>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the text file GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 * This script is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * This copyright notice MUST APPEAR in all copies of the script!
27 ***************************************************************/
28 /**
29 * Service for determining the current context (as a backend module or in standalone mode)
30 */
31 class ContextService {
32
33 /**
34 * @var bool
35 */
36 private $backendContext = FALSE;
37
38 /**
39 * Constructor, prepare the context information
40 */
41 public function __construct() {
42 $formValues = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('install');
43 if (isset($formValues['context'])) {
44 $this->backendContext = ($formValues['context'] === 'backend');
45 }
46 }
47
48 /**
49 * Is the install tool running in the backend?
50 *
51 * @return boolean
52 */
53 public function isBackendContext() {
54 return $this->backendContext;
55 }
56
57 /**
58 * Is the install tool running as a standalone application?
59 *
60 * @return boolean
61 */
62 public function isStandaloneContext() {
63 return !$this->backendContext;
64 }
65
66 /**
67 * Is the install tool running as a standalone application?
68 *
69 * @return boolean
70 */
71 public function getContextString() {
72 return ( $this->isBackendContext() ? 'backend' : 'standalone' );
73 }
74 }