Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. <?php
  2.  
  3. $debugMode = FALSE;
  4. $httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['GITLAB_CI']) ? 'GITLAB_CI-' .$_SERVER['CI_COMMIT_REF_NAME'] : (PHP_SAPI === 'cli' ? 'cli' : 'localhost'));
  5. $configSection = 'production';
  6. $storageDir = INDEX_DIR . '/storage';
  7.  
  8. $debugModeSetup = array(
  9. '*.dev.andweb.cz' => TRUE,
  10. '*.test.andweb.cz' => TRUE,
  11. '*.dev7.andweb.cz' => TRUE,
  12. '*.test7.andweb.cz' => TRUE,
  13. '*.local' => TRUE,
  14. 'GITLAB_CI-*' => TRUE,
  15. 'cli' => TRUE,
  16. );
  17.  
  18. $configSectionSetup = array(
  19. '*.dev.andweb.cz' => 'development',
  20. '*.dev7.andweb.cz' => 'development',
  21. '*.local' => 'development',
  22. '*.test.andweb.cz' => 'development', // 'development'
  23. '*.test7.andweb.cz' => 'development', // 'development'
  24. '*.pripravujeme.eu' => 'development',
  25. 'GITLAB_CI-www' => 'production',
  26. 'GITLAB_CI-*' => 'development',
  27. 'cli' => 'development',
  28. );
  29.  
  30. $storageDirSetup = array(
  31. '*.dev.andweb.cz' => 'http://cukrarstvi-viktoriacz.pripravujeme.eu/storage',
  32. '*.dev7.andweb.cz' => 'http://cukrarstvi-viktoriacz.pripravujeme.eu/storage',
  33. '*.local' => 'http://cukrarstvi-viktoriacz.pripravujeme.eu/storage',
  34. );
  35.  
  36.  
  37. if (defined('ANDWEB_DEBUG_MODE')) {
  38. $debugMode = ANDWEB_DEBUG_MODE;
  39. } else {
  40. foreach($debugModeSetup as $domain => $enable) {
  41. if(fnmatch($domain, $httpHost)) {
  42. $debugMode = $enable;
  43. break;
  44. }
  45. }
  46. }
  47.  
  48. // enable debug mode if want
  49. if (isset($_GET) && isset($_GET['debugMode']) && $_GET['debugMode'] == 1) {
  50. $debugMode = TRUE;
  51. }
  52.  
  53. foreach ($configSectionSetup as $domain => $section) {
  54. if (fnmatch($domain, $httpHost)) {
  55. $configSection = $section;
  56. break;
  57. }
  58. }
  59.  
  60. foreach ($storageDirSetup as $domain => $storageDirCandidate) {
  61. if (fnmatch($domain, $httpHost)) {
  62. $storageDir = $storageDirCandidate;
  63. break;
  64. }
  65. }
  66.  
  67. define('STORAGE_DIR', $storageDir);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement