Announcement

Collapse
No announcement yet.

Patch to extend functionality of process checker

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Patch to extend functionality of process checker

    This patch allows applications with non-matching process names to be detected. It also accommodates distros that use different names for the same applications by allowing multiple process names to be set per application (see firefox and thunderbird changes).

    Code:
    diff --git a/pts-core/functions/pts-functions_system.php b/pts-core/functions/pts-functions_system.php
    index 81458af..e56c2b5 100644
    --- a/pts-core/functions/pts-functions_system.php
    +++ b/pts-core/functions/pts-functions_system.php
    @@ -15,9 +15,17 @@ function pts_process_running_string($process_arr)
            if(!is_array($process_arr))
                    $process_arr = array($process_arr);
    
    -       foreach($process_arr as $process)
    -               if(pts_process_running_bool($process))
    -                       array_push($p, $process);
    +       foreach($process_arr as $p_name => $p_process)
    +       {
    +               if(!is_array($p_process))
    +                       $p_process = array($p_process);
    +
    +               foreach($p_process as $process)
    +                       if(pts_process_running_bool($process))
    +                               array_push($p, $p_name);
    +       }
    +
    +       $p = array_keys(array_flip($p));
    
            if(($p_count = count($p)) > 0)
            {
    
    diff --git a/pts-core/pts-run-benchmark.php b/pts-core/pts-run-benchmark.php
    index b456fd7..60e65f7 100644
    --- a/pts-core/pts-run-benchmark.php
    +++ b/pts-core/pts-run-benchmark.php
    @@ -231,7 +231,13 @@ else
    
     if($SAVE_RESULTS)
     {
    -       $test_notes = pts_process_running_string(array("Compiz", "Firefox", "Thunderbird"));
    +       $running_process=array(
    +               "Compiz" => array("compiz"),
    +               "Firefox" => array("firefox","mozilla-firefox","mozilla-firefox-bin"),
    +               "Thunderbird" => array("thunderbird", "mozilla-thunderbird", "mozilla-thunderbird-bin")
    +       );
    +
    +       $test_notes = pts_process_running_string($running_process);
    
            if(defined("TEST_GRAPHICS"))
            {

  • #2
    Committed to git, thanks.
    Michael Larabel
    https://www.michaellarabel.com/

    Comment

    Working...
    X