diff options
author | Michael Larabel <michael@phx-laptop.(none)> | 2008-07-09 21:35:41 -0400 |
---|---|---|
committer | Michael Larabel <michael@phx-laptop.(none)> | 2008-08-03 11:49:19 -0400 |
commit | 38d8cd096963cfce3b669f728240adc783f7738a (patch) | |
tree | 4747024e336f7b543bebb1564a0ec5c7d12c6c2d /pts-core/functions/pts.php | |
parent | c04635b560b15bced41bccb376e2bb29ae7b3697 (diff) | |
download | phoronix-test-suite-upstream-38d8cd096963cfce3b669f728240adc783f7738a.tar.gz phoronix-test-suite-upstream-38d8cd096963cfce3b669f728240adc783f7738a.tar.xz phoronix-test-suite-upstream-38d8cd096963cfce3b669f728240adc783f7738a.zip |
pts-core: Variety of code cleaning and other general improvements
Diffstat (limited to 'pts-core/functions/pts.php')
-rw-r--r-- | pts-core/functions/pts.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pts-core/functions/pts.php b/pts-core/functions/pts.php index 578f609..cf7d43a 100644 --- a/pts-core/functions/pts.php +++ b/pts-core/functions/pts.php @@ -28,8 +28,46 @@ define("PTS_TYPE", "DESKTOP"); // Initalize common / needed PTS start-up work pts_init(); +function pts_directory() +{ + $dir = getenv("PTS_DIR"); + + if($dir == ".") + $dir = ""; + + if(!empty($dir)) + { + if(substr($dir, -1) != "/") + $dir .= "/"; + } + + return $dir; +} function pts_init() { + // Switch time-zone + date_default_timezone_set("UTC"); + + // PTS Defines + define("PTS_DIR", pts_directory()); + define("PTS_TEMP_DIR", "/tmp/phoronix-test-suite/"); + define("PHP_BIN", getenv("PHP_BIN")); + define("THIS_RUN_TIME", time()); + define("PTS_START_TIME", THIS_RUN_TIME); + + // Run in debug mode? + if(getenv("DEBUG") == "1" || ($debug_file = getenv("DEBUG_FILE")) != FALSE) + { + define("PTS_DEBUG_MODE", 1); + + if($debug_file != FALSE) + { + define("PTS_DEBUG_FILE", $debug_file); + $GLOBALS["DEBUG_CONTENTS"] = ""; + } + } + + // Operating System Detection $uname_o = strtolower(trim(shell_exec("uname -o"))); if(strpos($uname_o, "linux") !== FALSE) |