Source for file Configurator.php
Documentation is available at Configurator.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 18: */
- 26: /**
- 27: * NEnvironment helper.
- 28: *
- 32: */
- 34: {
- 51: /**
- 52: * Detect environment mode.
- 55: */
- 57: {
- 60: // environment name autodetection
- 65: return NEnvironment::getMode('production') ? NEnvironment::PRODUCTION : NEnvironment::DEVELOPMENT;
- 66: }
- 69: // detects production mode by server IP address
- 76: // 10.0.0.0/8 Private network
- 77: // 127.0.0.0/8 Loopback
- 78: // 169.254.0.0/16 & ::1 Link-Local
- 79: // 172.16.0.0/12 Private network
- 80: // 192.168.0.0/16 Private network
- 86: }
- 91: default:
- 92: // unknown mode
- 94: }
- 95: }
- 99: /**
- 100: * Loads global configuration from file and process it.
- 103: */
- 105: {
- 115: }
- 118: }
- 120: // process environment variables
- 124: }
- 125: }
- 129: // process services
- 139: $locator->addService($key, $value->factory, isset($value->singleton) ? $value->singleton : TRUE, (array) $value->option);
- 140: }
- 143: }
- 144: }
- 145: }
- 146: }
- 148: // check temporary directory - TODO: discuss
- 149: /*
- 150: $dir = NEnvironment::getVariable('tempDir');
- 151: if ($dir && !(is_dir($dir) && is_writable($dir))) {
- 152: trigger_error("Temporary directory '$dir' is not writable", E_USER_NOTICE);
- 153: }
- 154: */
- 156: // process ini settings
- 160: }
- 165: }
- 172: }
- 173: }
- 174: }
- 181: }
- 208: default:
- 211: }
- 212: }
- 213: }
- 214: }
- 215: }
- 217: // define constants
- 221: }
- 222: }
- 224: // set modes
- 228: }
- 229: }
- 231: // auto-start services
- 234: }
- 238: }
- 242: /********************* service factories ****************d*g**/
- 246: /**
- 247: * Get initial instance of service locator.
- 249: */
- 251: {
- 255: }
- 257: }
- 261: /**
- 263: */
- 265: {
- 267: }
- 271: /**
- 273: */
- 275: {
- 278: //$loader->setCache(NEnvironment::getCache('Nette.NRobotLoader'));
- 279: $dirs = isset($options['directory']) ? $options['directory'] : array(NEnvironment::getVariable('appDir'), NEnvironment::getVariable('libsDir'));
- 283: }
- 285: }