summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Larabel <michael@phx-laptop.(none)>2008-11-23 18:14:24 -0500
committerMichael Larabel <michael@phx-laptop.(none)>2008-11-23 18:14:24 -0500
commit2442442d0b3d158cf98b3c60e89daf46e278305c (patch)
tree2eeb3a8fafaba092a8d833f5ded936e2af8b2269
parent848de8d7681052a81a232378ea6806f672111d76 (diff)
downloadphoronix-test-suite-upstream-2442442d0b3d158cf98b3c60e89daf46e278305c.tar.gz
phoronix-test-suite-upstream-2442442d0b3d158cf98b3c60e89daf46e278305c.tar.xz
phoronix-test-suite-upstream-2442442d0b3d158cf98b3c60e89daf46e278305c.zip
pts-core: Improve usability for those without the PHP preg_* functions
-rw-r--r--TYDAL-CHANGE-LOG1
-rw-r--r--pts-core/functions/pts-functions-run.php9
-rw-r--r--pts-core/functions/pts-functions.php21
-rw-r--r--pts-core/functions/pts-functions_system_parsing.php13
-rw-r--r--pts-core/functions/pts-functions_tests.php2
-rw-r--r--pts-core/objects/pts_Graph.php2
6 files changed, 35 insertions, 13 deletions
diff --git a/TYDAL-CHANGE-LOG b/TYDAL-CHANGE-LOG
index 7ad9584..19b7808 100644
--- a/TYDAL-CHANGE-LOG
+++ b/TYDAL-CHANGE-LOG
@@ -3,6 +3,7 @@ Phoronix Test Suite (Git)
- pts-core: Fix for Self-Contained Test Profiles (SCTP) support
- pts-core: Fix in memory type detection
+- pts-core: Improve usability for those without the PHP preg_* functions
Phoronix Test Suite 1.6.0 Alpha 1
November 22, 2008
diff --git a/pts-core/functions/pts-functions-run.php b/pts-core/functions/pts-functions-run.php
index cff7971..412d1e5 100644
--- a/pts-core/functions/pts-functions-run.php
+++ b/pts-core/functions/pts-functions-run.php
@@ -159,7 +159,14 @@ function pts_promt_user_tags($default_tags = "")
if(!IS_BATCH_MODE)
{
echo "\nTags are optional and used on Phoronix Global for making it easy to share, search, and organize test results. Example tags could be the type of test performed (i.e. WINE tests) or the hardware used (i.e. Dual Core SMP).\n\nEnter the tags you wish to provide (separated by commas): ";
- $tags_input .= trim(preg_replace("/[^a-zA-Z0-9s, -]/", "", fgets(STDIN)));
+ $tags_input .= fgets(STDIN);
+
+ if(function_exists("preg_replace"))
+ {
+ $tags_input = preg_replace("/[^a-zA-Z0-9s, -]/", "", $tags_input);
+ }
+
+ $tags_input = trim($tags_input);
}
if(empty($tags_input))
diff --git a/pts-core/functions/pts-functions.php b/pts-core/functions/pts-functions.php
index 499fa8d..e80bb3b 100644
--- a/pts-core/functions/pts-functions.php
+++ b/pts-core/functions/pts-functions.php
@@ -33,11 +33,6 @@ require_once("pts-core/functions/pts-functions_tests.php");
require_once("pts-core/functions/pts-functions_types.php");
require_once("pts-core/functions/pts-functions_modules.php");
-if(IS_SCTP_MODE)
-{
- include_once("pts-core/functions/pts-functions-sctp.php");
-}
-
// User's home directory for storing results, module files, test installations, etc.
define("PTS_DIR", pts_directory());
define("PTS_USER_DIR", pts_user_home() . ".phoronix-test-suite/");
@@ -447,7 +442,10 @@ function pts_clean_information_string($str)
$str = str_ireplace($original_phrase, $new_phrase, $str);
}
- $str = trim(preg_replace("/\s+/", " ", $str));
+ if(function_exists("preg_replace"))
+ {
+ $str = trim(preg_replace("/\s+/", " ", $str));
+ }
return $str;
}
@@ -483,8 +481,15 @@ function pts_exit($string = "")
function pts_version_comparable($old, $new)
{
// Checks if there's a major version difference between two strings, if so returns false. If the same or only a minor difference, returns true.
- $old = explode(".", preg_replace("/[^.0-9]/", "", $old));
- $new = explode(".", preg_replace("/[^.0-9]/", "", $new));
+
+ if(function_exists("preg_replace"))
+ {
+ $old = preg_replace("/[^.0-9]/", "", $old);
+ $new = preg_replace("/[^.0-9]/", "", $new);
+ }
+
+ $old = explode(".", $old);
+ $new = explode(".", $new);
$compare = true;
if(count($old) >= 2 && count($new) >= 2)
diff --git a/pts-core/functions/pts-functions_system_parsing.php b/pts-core/functions/pts-functions_system_parsing.php
index a9beaf6..54e781d 100644
--- a/pts-core/functions/pts-functions_system_parsing.php
+++ b/pts-core/functions/pts-functions_system_parsing.php
@@ -521,7 +521,12 @@ function read_ati_overdrive($attribute, $adapter = 0)
if($od_option == $attribute)
{
$od_value = trim($line_r[1]);
- $od_value = preg_replace("/\s+/", " ", $od_value);
+
+ if(function_exists("preg_replace"))
+ {
+ $od_value = preg_replace("/\s+/", " ", $od_value);
+ }
+
$od_value = str_replace(array("%"), "", $od_value);
$od_value_r = explode(" ", $od_value);
@@ -574,7 +579,11 @@ function read_system_memory_usage($TYPE = "TOTAL", $READ = "USED")
if(!empty($grab_line))
{
- $grab_line = trim(preg_replace("/\s+/", " ", $grab_line));
+ if(function_exists("preg_replace"))
+ {
+ $grab_line = trim(preg_replace("/\s+/", " ", $grab_line));
+ }
+
$mem_parts = explode(" ", $grab_line);
if($READ == "USED")
diff --git a/pts-core/functions/pts-functions_tests.php b/pts-core/functions/pts-functions_tests.php
index 1efc67e..09a8ebd 100644
--- a/pts-core/functions/pts-functions_tests.php
+++ b/pts-core/functions/pts-functions_tests.php
@@ -635,7 +635,7 @@ function pts_test_version_compatible($version_compare = "")
{
$compatible = true;
- if(!empty($version_compare))
+ if(!empty($version_compare) && function_exists("preg_replace"))
{
$current = preg_replace("/[^0-9]/", "", PTS_VERSION);
diff --git a/pts-core/objects/pts_Graph.php b/pts-core/objects/pts_Graph.php
index 542fdab..99931d9 100644
--- a/pts-core/objects/pts_Graph.php
+++ b/pts-core/objects/pts_Graph.php
@@ -112,7 +112,7 @@ class pts_Graph
public function setRenderer($Renderer)
{
if($Renderer == "SVG")
- {
+ {
$this->graph_renderer = "SVG";
$this->graph_left_start += 10;
}