33581.patch

Peter Russ, 2012-02-01 10:34

Download (9.34 KB)

View differences:

Packages/Framework/TYPO3.FLOW3/Classes/Configuration/ConfigurationManager.php (revision )
35 35
	 * @var string
36 36
	 */
37 37
	protected $context;
38

  
39
	/**
38
    
39
/**
40
 * COREPATCH Telekom
41
 * by Peter Russ <peter.russ@telekom.de>
42
 * 01.02.12: added additional configuration options
43
 *
44
 */
45
    /**
46
   	 * The system the application is running on
47
   	 * @var string
48
   	 */
49
   	protected $subSystem;
50

  
51
    /**
52
   	 * Static Configuration file path and name to overule settings by an system admin
53
   	 * @var string
54
   	 */
55
   	protected $staticConfiguration;
56

  
57
/**
58
 * end COREPATCH
59
 */
60
	/**
40 61
	 * @var \TYPO3\FLOW3\Configuration\Source\YamlSource
41 62
	 */
42 63
	protected $configurationSource;
......
74 95
	 * Constructs the configuration manager
75 96
	 *
76 97
	 * @param string $context The application context to fetch configuration for
98
     * @param string $subSystem The application subsystem to fetch configuration for
77 99
	 */
78
	public function __construct($context) {
100
	public function __construct($context, $subSystem = '') {
79 101
		$this->context = $context;
102
        $this->subSystem = $subSystem;
80 103
		if (!is_dir(FLOW3_PATH_CONFIGURATION . $context) && !is_link(FLOW3_PATH_CONFIGURATION . $context)) {
81 104
			\TYPO3\FLOW3\Utility\Files::createDirectoryRecursively(FLOW3_PATH_CONFIGURATION . $context);
82 105
		}
......
84 107
		$this->loadConfigurationCache();
85 108
	}
86 109

  
87
	/**
110
/**
111
 * COREPATCH Telekom
112
 * by Peter Russ <peter.russ@telekom.de>
113
 * 01.02.12: setter for addtional configuration options
114
 *
115
 */
116
    
117
    /**
118
     * @param string Sets the subsystem this bootstrap was started in
119
     */
120
    public function setSubSystem($subSystem) {
121
        $this->subSystem = (string)$subSystem;
122
    }
123

  
124
    /**
125
   	 * Sets the path and filename for a static configuration.
126
     *  This will overrule other Settings and allows an admin to set server specific settings
127
     *  without publishing them.
128
   	 *
129
   	 * @param string The static configuration file path and name. Ending .yaml will be added automatically!!!
130
   	 */
131
    public function setStaticConfiguration($staticConfiguration) {
132
        $this->staticConfiguration = (string)$staticConfiguration;
133
    }
134

  
135
/**
136
 * end COREPATCH
137
 */
138
	/**
88 139
	 * Injects the configuration source
89 140
	 *
90 141
	 * @param \TYPO3\FLOW3\Configuration\Source\YamlSource $configurationSource
......
259 310
				foreach ($packages as $package) {
260 311
					$settings = \TYPO3\FLOW3\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load($package->getConfigurationPath() . $this->context . '/' . self::CONFIGURATION_TYPE_SETTINGS));
261 312
				}
262
				$settings = \TYPO3\FLOW3\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load(FLOW3_PATH_CONFIGURATION . $this->context . '/' . self::CONFIGURATION_TYPE_SETTINGS));
313
                $settings = \TYPO3\FLOW3\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load(FLOW3_PATH_CONFIGURATION . $this->context . '/' . self::CONFIGURATION_TYPE_SETTINGS));
314
/**
315
 * COREPATCH Telekom
316
 * by Peter Russ <peter.russ@telekom.de>
317
 * 01.02.12: get settings for addtional configuration
318
 *
319
 */
320
                if (!empty($this->subSystem)) {
321
                    $settings = \TYPO3\FLOW3\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load(FLOW3_PATH_CONFIGURATION . $this->context . '/'. $this->subSystem . '.' . self::CONFIGURATION_TYPE_SETTINGS));
322
                }
263 323

  
324
                if (!empty($this->staticConfiguration)) {
325
                    $settings = \TYPO3\FLOW3\Utility\Arrays::arrayMergeRecursiveOverrule($settings, $this->configurationSource->load($this->staticConfiguration));
326
                }
327

  
328
/**
329
 * end COREPATCH
330
 */
264 331
				if ($this->configurations[self::CONFIGURATION_TYPE_SETTINGS] !== array()) {
265 332
					$this->configurations[self::CONFIGURATION_TYPE_SETTINGS] = \TYPO3\FLOW3\Utility\Arrays::arrayMergeRecursiveOverrule($this->configurations[self::CONFIGURATION_TYPE_SETTINGS], $settings);
266 333
				} else {
......
437 504
		return $mergedSubRoutesConfigurations;
438 505
	}
439 506
}
440
?>
507
?>
Web/index.php (revision )
34 34

  
35 35
$context = getenv('FLOW3_CONTEXT') ?: (getenv('REDIRECT_FLOW3_CONTEXT') ?: 'Development');
36 36
$bootstrap = new \TYPO3\FLOW3\Core\Bootstrap($context);
37
/**
38
 * COREPATCH Telekom
39
 * by Peter Russ <peter.russ@telekom.de>
40
 * 01.02.2012: added additional environment settings
41
 *
42
 */
43

  
44
$subSystem = getenv('FLOW3_SUBSYSTEM') ?: '';
45
if (!empty($subSystem)) {
46
    $bootstrap->setSubSystem($subSystem);
47
}
48
$staticConfiguration = getenv('FLOW3_STATIC_CONFIGURATION') ?: '';
49
if (!empty($staticConfiguration)) {
50
    $bootstrap->setStaticConfiguration($staticConfiguration);
51
}
52
/**
53
 * end COREPATCH
54
 */
37 55
$bootstrap->run();
38 56

  
39 57
?>
Packages/Framework/TYPO3.FLOW3/Classes/Core/Bootstrap.php (revision )
41 41
	 */
42 42
	protected $context;
43 43

  
44
	/**
44
/**
45
 * COREPATCH Telekom
46
 * by Peter Russ <peter.russ@telekom.de>
47
 * 01.02.12: added additional configuration options
48
 *
49
 */
50
    /**
51
   	 * The system the application is running on
52
   	 * @var string
53
   	 */
54
   	protected $subSystem;
55

  
56
    /**
57
   	 * The path for a static configuration setting to overrule other settings by an admin
58
   	 * @var string
59
   	 */
60
   	protected $staticConfiguration;
61

  
62
/**
63
 * end COREPATCH
64
 */
65
	/**
45 66
	 * @var \TYPO3\FLOW3\Configuration\ConfigurationManager
46 67
	 */
47 68
	protected $configurationManager;
......
119 140
	 * Constructor
120 141
	 *
121 142
	 * @param string $context The application context
143
     * @param string $subSystem The system the application is running on
122 144
	 * @return void
123 145
	 * @api
124 146
	 */
125
	public function __construct($context) {
147
	public function __construct($context, $subSystem = '') {
126 148
		$this->defineConstants();
127 149
		$this->ensureRequiredEnvironment();
128 150

  
......
137 159
			require_once(FLOW3_PATH_FLOW3 . 'Tests/BaseTestCase.php');
138 160
			require_once(FLOW3_PATH_FLOW3 . 'Tests/FunctionalTestCase.php');
139 161
		}
162

  
163
        if (!empty($subSystem)) {
164
            $this->subSystem = (string)$subSystem;
140
	}
165
        }
166
	}
141 167

  
142 168
	/**
143 169
	 * Returns the context this bootstrap was started in.
......
149 175
		return $this->context;
150 176
	}
151 177

  
152
	/**
178
/**
179
 * COREPATCH Telekom
180
 * by Peter Russ <peter.russ@telekom.de>
181
 * 01.02.12: added getter and setter for additional configuration options
182
 *
183
 */
184
    /**
185
     * @param string Sets the subsystem this bootstrap was started in
186
     */
187
    public function setSubSystem($subSystem) {
188
        $this->subSystem = (string)$subSystem;
189
    } 
190
    
191
    /**
192
   	 * Returns the subsystem this bootstrap was started in.
193
   	 *
194
   	 * @return string The subsystem, for example "MyVhost"
195
   	 * @api
196
   	 */
197
   	public function getSubSystem() {
198
   		return $this->subSystem;
199
   	}
200

  
201

  
202
    /**
203
   	 * Sets the path and filename for a static configuration.
204
     *  This will overrule other Settings and allows an admin to set server specific settings
205
     *  without publishing them.
206
   	 *
207
   	 * @param string The static configuration file path and name. Ending .yaml will be added automatically!!!
208
   	 * @api
209
   	 */
210
    public function setStaticConfiguration($staticConfiguration) {
211
        $this->staticConfiguration = (string)$staticConfiguration;
212
    }
213

  
214
/**
215
 * end COREPATCH
216
 */
217
	/**
153 218
	 * Runs the the FLOW3 Framework by resolving an appropriate bootstrap sequence and passing control to it.
154 219
	 *
155 220
	 * @return void
......
536 601
	 * @see initialize()
537 602
	 */
538 603
	protected function initializeConfiguration() {
604
/**
605
 * COREPATCH Telekom
606
 * by Peter Russ <peter.russ@telekom.de>
607
 * 01.02.12: forward additional configuration option to configuration manager
608
 *
609
 */
539 610
		$this->configurationManager = new \TYPO3\FLOW3\Configuration\ConfigurationManager($this->context);
611
        
612
        if (!empty($this->subSystem)) {
613
            $this->configurationManager->setSubSystem($this->subSystem);
614
        }
615

  
616
        if (!empty($this->staticConfiguration)) {
617
            $this->configurationManager->setStaticConfiguration($this->staticConfiguration);
618
        }
619

  
620
/**
621
 * end COREPATCH
622
 */
540 623
		$this->configurationManager->injectConfigurationSource(new \TYPO3\FLOW3\Configuration\Source\YamlSource());
541 624
		$this->configurationManager->setPackages($this->packageManager->getActivePackages());
542 625