Changeset 747 for branches/0.4/web


Ignore:
Timestamp:
03/25/13 17:50:13 (11 years ago)
Author:
ramonb
Message:
  • replaced some string operations with strpos
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.4/web/addons/job_monarch/libtoga.php

    r746 r747  
    664664            foreach( $nodes as $hostname => $nimage )
    665665            {
    666                 if( substr( $hostname, $domain_len ) != $tdomain )
     666                if( strpos( $hostname, $tomdain ) !== false )
    667667                {
    668668                    $fqdn    = 0;
     
    677677        if( $tdomain && $fqdn )
    678678        {
    679             if( substr( $thostname, $domain_len ) != $tdomain )
     679            if( strpos( $thostname, $tdomain ) !== false )
    680680            {
    681681                $thostname = $thostname . '.'.$tdomain;
     
    724724            }
    725725        }
    726         else if( $name == 'METRIC' and strstr( $attrs['NAME'], 'zplugin_monarch' ) and $this->proc_cluster == $this->clustername )
    727         {
    728             if( strstr( $attrs['NAME'], 'zplugin_monarch_heartbeat' ) )
     726        else if( $name == 'METRIC' and ( strpos( $attrs['NAME'], 'zplugin_monarch' ) !== false ) and $this->proc_cluster == $this->clustername )
     727        {
     728            if( strpos( $attrs['NAME'], 'zplugin_monarch_heartbeat' ) !== false )
    729729            {
    730730                $this->heartbeat['time'] = $attrs['VAL'];
    731731            }
    732             else if( strstr( $attrs['NAME'], 'zplugin_monarch_down' ) )
     732            else if( strpos( $attrs['NAME'], 'zplugin_monarch_down' ) !== false )
    733733            {
    734734                $fields        = explode( ' ', $attrs['VAL'] );
     
    766766                }
    767767            }
    768             else if( strstr( $attrs['NAME'], 'zplugin_monarch_offline' ) )
     768            else if( strpos( $attrs['NAME'], 'zplugin_monarch_offline' ) !== false )
    769769            {
    770770                $fields        = explode( ' ', $attrs['VAL'] );
     
    802802                }
    803803            }
    804             else if( strstr( $attrs['NAME'], 'zplugin_monarch_job' ) )
     804            else if( strpos( $attrs['NAME'], 'zplugin_monarch_job' ) !== false )
    805805            {
    806806                sscanf( $attrs['NAME'], 'zplugin_monarch_job_%d_%s$', $monincr, $jobid );
     
    868868                            // Let's see if Ganglia use's FQDN or short hostnames
    869869                            //
    870                             if( substr( $first_host, $domain_len ) != $domain )
     870                            if( strpos( $first_host, $domain ) === false )
    871871                            {
    872872                                $this->fqdn    = 0;
     
    885885                            if( $this->fqdn && isset( $jobs[$jobid]['domain'] ) )
    886886                            {
    887                                 if( substr( $node, $domain_len ) != $domain )
     887                                if( strpos( $node, $domain ) === false )
    888888                                {
    889889                                    $host = $node. '.'.$domain;
Note: See TracChangeset for help on using the changeset viewer.