Ignore:
Timestamp:
03/25/13 17:58:46 (11 years ago)
Author:
ramonb
Message:
  • cleaned out stopElement XML parsing
File:
1 edited

Legend:

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

    r747 r748  
    537537            $error = sprintf( 'XML error: %s at %d', xml_error_string( xml_get_error_code( $this->parser ) ), xml_get_current_line_number( $this->parser ) );
    538538        }
     539        $handler = &$this->xmlhandler;
     540        $handler->finishUp();
    539541    }
    540542
     
    929931    }
    930932
    931     function stopElement( $parser, $name )
     933    function finishUp( )
    932934    {
    933935        $nodes    = $this->nodes;
    934936
    935         if( $name == "GANGLIA_XML" )
    936         {
    937             if( sizeof( $this->down_nodes ) > 0 )
    938             {
    939                 foreach( $this->down_nodes as $reported => $dnodes )
    940                 {
    941                     if( $reported == $this->heartbeat['time'] )
     937        if( sizeof( $this->down_nodes ) > 0 )
     938        {
     939            foreach( $this->down_nodes as $reported => $dnodes )
     940            {
     941                if( $reported == $this->heartbeat['time'] )
     942                {
     943                    $domain = $dnodes[1];
     944
     945                    foreach( $dnodes[0] as $downhost )
    942946                    {
    943                         $domain = $dnodes[1];
    944 
    945                         foreach( $dnodes[0] as $downhost )
     947                        $downhost = $this->makeHostname( $downhost, $domain );
     948
     949                        if( isset( $nodes[$downhost] ) )
    946950                        {
    947                             $downhost = $this->makeHostname( $downhost, $domain );
    948 
    949                             if( isset( $nodes[$downhost] ) )
    950                             {
    951                                 // OMG PHP4 is fking stupid!
    952                                 // $nodes[$downhost]->setDown( 1 ) won't work here..
    953                                 //
    954                                 $mynode = $nodes[$downhost];
    955                                 $mynode->setDown( 1 );
    956                                 $nodes[$downhost] = $mynode;
    957                             }
     951                            // OMG PHP4 is fking stupid!
     952                            // $nodes[$downhost]->setDown( 1 ) won't work here..
     953                            //
     954                            $mynode = $nodes[$downhost];
     955                            $mynode->setDown( 1 );
     956                            $nodes[$downhost] = $mynode;
    958957                        }
    959958                    }
    960959                }
    961960            }
    962 
    963             if( sizeof( $this->offline_nodes ) > 0 )
    964             {
    965                 foreach( $this->offline_nodes as $reported => $onodes )
    966                 {
    967                     if( $reported == $this->heartbeat['time'] )
     961        }
     962
     963        if( sizeof( $this->offline_nodes ) > 0 )
     964        {
     965            foreach( $this->offline_nodes as $reported => $onodes )
     966            {
     967                if( $reported == $this->heartbeat['time'] )
     968                {
     969                    $domain = $onodes[1];
     970
     971                    foreach( $onodes[0] as $offlinehost )
    968972                    {
    969                         $domain = $onodes[1];
    970 
    971                         foreach( $onodes[0] as $offlinehost )
     973                        $offlinehost = $this->makeHostname( $offlinehost, $domain );
     974
     975                        if( isset( $nodes[$offlinehost] ) )
    972976                        {
    973                             $offlinehost = $this->makeHostname( $offlinehost, $domain );
    974 
    975                             if( isset( $nodes[$offlinehost] ) )
    976                             {
    977                                 // OMG PHP4 is fking stupid!
    978                                 // $nodes[$offlinehost]->setDown( 1 ) won't work here..
    979                                 //
    980                                 $mynode = $nodes[$offlinehost];
    981                                 $mynode->setOffline( 1 );
    982                                 $nodes[$offlinehost] = $mynode;
    983                             }
     977                            // OMG PHP4 is fking stupid!
     978                            // $nodes[$offlinehost]->setDown( 1 ) won't work here..
     979                            //
     980                            $mynode = $nodes[$offlinehost];
     981                            $mynode->setOffline( 1 );
     982                            $nodes[$offlinehost] = $mynode;
    984983                        }
    985984                    }
     
    989988
    990989        $this->nodes = $nodes;
     990    }
     991
     992    function stopElement( $parser, $name )
     993    {
    991994    }
    992995
Note: See TracChangeset for help on using the changeset viewer.