Skip to content

Instantly share code, notes, and snippets.

@mneuhaus
Created October 12, 2012 10:01
Show Gist options
  • Save mneuhaus/3878498 to your computer and use it in GitHub Desktop.
Save mneuhaus/3878498 to your computer and use it in GitHub Desktop.
Shared hosting Environmentshandling
<?php
$conditions = array(
"SCRIPT_FILENAME" => array(
"/kunden/350350_33330/flow/package-catalog/flow" => array(
"FLOW_CONTEXT" => "Production",
"FLOW_ROOTPATH" => "/kunden/350350_33330/flow/package-catalog/"
)
),
"HTTP_HOST" => array(
"package-catalog.flow.famelo.com" => array(
"FLOW_CONTEXT" => "Production"
)
)
);
foreach ($conditions as $variable => $cases) {
if (isset($_SERVER[$variable])) {
foreach ($cases as $case => $enviromentVariables) {
if ($_SERVER[$variable] == $case) {
foreach ($enviromentVariables as $key => $value) {
putenv($key . "=" . $value);
}
}
}
}
}
?>
#!/usr/local/bin/php5-53LATEST-CLI
<?php
/* *
* This script belongs to the Flow framework. *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
* The TYPO3 project - inspiring people to share! *
* */
/**
* Bootstrap for the command line
*/
require(__DIR__ . "/Configuration/Environment.php");
require(__DIR__ . '/Packages/Framework/TYPO3.Flow/Scripts/flow.php');
?>
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/* *
* This script belongs to the TYPO3 Flow framework. *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
* The TYPO3 project - inspiring people to share! *
* */
$rootPath = isset($_SERVER['FLOW_ROOTPATH']) ? $_SERVER['FLOW_ROOTPATH'] : FALSE;
if ($rootPath === FALSE && isset($_SERVER['REDIRECT_FLOW_ROOTPATH'])) {
$rootPath = $_SERVER['REDIRECT_FLOW_ROOTPATH'];
}
if ($rootPath === FALSE) {
$rootPath = dirname(__FILE__) . '/../';
} elseif (substr($rootPath, -1) !== '/') {
$rootPath .= '/';
}
require($rootPath . 'Packages/Framework/TYPO3.Flow/Classes/TYPO3/Flow/Core/Bootstrap.php');
require($rootPath . "Configuration/Environment.php");
$context = getenv('FLOW_CONTEXT') ?: (getenv('REDIRECT_FLOW_CONTEXT') ?: 'Development');
$bootstrap = new \TYPO3\Flow\Core\Bootstrap($context);
$bootstrap->run();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment