Changeset 379
- Timestamp:
- 07/29/08 16:02:41 (5 months ago)
- Files:
-
- branches/2.3/classes/phing/Phing.php (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/2.3/classes/phing/Phing.php
r342 r379 128 128 */ 129 129 private static $isLogFileUsed = false; 130 130 131 131 /** 132 132 * Array to hold original ini settings that Phing changes (and needs … … 152 152 */ 153 153 public static function start($args, array $additionalUserProperties = null) { 154 154 155 155 try { 156 156 $m = new Phing(); … … 280 280 self::$definedProps = new Properties(); 281 281 $this->searchForThis = null; 282 282 283 283 // 1) First handle any options which should always 284 284 // Note: The order in which these are executed is important (if multiple of these options are specified) 285 285 286 286 if (in_array('-help', $args) || in_array('-h', $args)) { 287 287 $this->printUsage(); 288 288 return; 289 289 } 290 290 291 291 if (in_array('-version', $args) || in_array('-v', $args)) { 292 292 $this->printVersion(); 293 293 return; 294 294 } 295 295 296 296 // 2) Next pull out stand-alone args. 297 297 // Note: The order in which these are executed is important (if multiple of these options are specified) 298 298 299 299 if (false !== ($key = array_search('-quiet', $args, true))) { 300 300 self::$msgOutputLevel = Project::MSG_WARN; 301 301 unset($args[$key]); 302 302 } 303 303 304 304 if (false !== ($key = array_search('-verbose', $args, true))) { 305 305 self::$msgOutputLevel = Project::MSG_VERBOSE; 306 306 unset($args[$key]); 307 307 } 308 308 309 309 if (false !== ($key = array_search('-debug', $args, true))) { 310 310 self::$msgOutputLevel = Project::MSG_DEBUG; 311 311 unset($args[$key]); 312 312 } 313 313 314 314 // 3) Finally, cycle through to parse remaining args 315 // 315 // 316 316 $keys = array_keys($args); // Use keys and iterate to max(keys) since there may be some gaps 317 317 for($i=0, $max = max(array_keys($args)); $i <= $max; $i++) { 318 318 319 319 if (!array_key_exists($i, $args)) { 320 320 // skip this argument, since it must have been removed above. 321 321 continue; 322 322 } 323 323 324 324 $arg = $args[$i]; 325 325 326 326 if ($arg == "-logfile") { 327 327 try { … … 590 590 throw new ConfigurationException($msg); 591 591 } 592 592 593 593 $listener = new $clz(); 594 594 595 595 if ($listener instanceof StreamRequiredBuildLogger) { 596 596 throw new ConfigurationException("Unable to add " . $listenerClassname . " as a listener, since it requires explicit error/output streams. (You can specify it as a -logger.)"); … … 697 697 698 698 if (self::$phpErrorCapture) { 699 699 700 700 self::$capturedPhpErrors[] = array('message' => $message, 'level' => $level, 'line' => $line, 'file' => $file); 701 701 702 702 } else { 703 703 704 704 $message = '[PHP Error] ' . $message; 705 705 $message .= ' [line ' . $line . ' of ' . $file . ']'; … … 949 949 $dotClassname = basename($dotPath); 950 950 $dotClassnamePos = strlen($dotPath) - strlen($dotClassname); 951 951 952 952 // 1- temporarily replace escaped '.' with another illegal char (#) 953 953 $tmp = str_replace('\.', '##', $dotClassname); … … 1055 1055 } 1056 1056 } else { 1057 // We're not using PEAR, so do one additional check based on path of 1057 // We're not using PEAR, so do one additional check based on path of 1058 1058 // current file (Phing.php) 1059 1059 $maybeHomeDir = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..'); 1060 $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path; 1060 $testPath = $maybeHomeDir . DIRECTORY_SEPARATOR . $path; 1061 1061 if (file_exists($testPath)) { 1062 1062 return $testPath; … … 1122 1122 self::setProperty('user.home', getenv('HOME')); 1123 1123 self::setProperty('application.startdir', getcwd()); 1124 self::setProperty('phing.startTime', gmdate('D, d M Y H:i:s', time()) . ' GMT'); 1124 1125 1125 1126 // try to detect machine dependent information … … 1135 1136 $sysInfo['version'] = php_uname('v'); 1136 1137 } 1137 1138 1138 1139 1139 1140 self::setProperty("host.name", isset($sysInfo['nodename']) ? $sysInfo['nodename'] : "unknown"); … … 1233 1234 */ 1234 1235 private static function setIni() { 1235 1236 1236 1237 self::$origIniSettings['error_reporting'] = error_reporting(E_ALL); 1237 1238 // We won't bother storing original max_execution_time, since 1) the value in 1239 // php.ini may be wrong (and there's no way to get the current value) and 1238 1239 // We won't bother storing original max_execution_time, since 1) the value in 1240 // php.ini may be wrong (and there's no way to get the current value) and 1240 1241 // 2) it would mean something very strange to set it to a value less than time script 1241 1242 // has already been running, which would be the likely change. 1242 1243 1243 1244 set_time_limit(0); 1244 1245 1245 1246 self::$origIniSettings['magic_quotes_gpc'] = ini_set('magic_quotes_gpc', 'off'); 1246 1247 self::$origIniSettings['short_open_tag'] = ini_set('short_open_tag', 'off'); … … 1249 1250 self::$origIniSettings['allow_call_time_pass_reference'] = ini_set('allow_call_time_pass_reference', 'on'); 1250 1251 self::$origIniSettings['track_errors'] = ini_set('track_errors', 1); 1251 1252 1252 1253 // should return memory limit in MB 1253 1254 $mem_limit = (int) ini_get('memory_limit'); … … 1258 1259 } 1259 1260 } 1260 1261 1261 1262 /** 1262 1263 * Restores [most] PHP INI values to their pre-Phing state. 1263 * 1264 * 1264 1265 * Currently the following settings are not restored: 1265 1266 * - max_execution_time (because getting current time limit is not possible) 1266 1267 * - memory_limit (which may have been increased by Phing) 1267 * 1268 * 1268 1269 * @return void 1269 1270 */ … … 1297 1298 * Sets up the Phing environment but does not initiate the build process. 1298 1299 * @return void 1299 * @throws Exception - If the Phing environment cannot be initialized. 1300 * @throws Exception - If the Phing environment cannot be initialized. 1300 1301 */ 1301 1302 public static function startup() {
