Changeset 646 for trunk/web/addons/job_monarch/image.php
- Timestamp:
- 08/26/09 12:15:10 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/addons/job_monarch/image.php
r582 r646 33 33 } 34 34 35 function checkSessionData() 36 { 37 global $_SESSION; 38 39 session_start(); 40 41 if( isset( $_SESSION['data'] ) ) 42 { 43 $myxml_data = &$_SESSION['data']; 44 } 45 else 46 { 47 $myxml_data = 0; 48 } 49 50 if( !$myxml_data ) { 51 $ds = new DataSource(); 52 $myxml_data = $ds->getData(); 53 54 } 55 return $myxml_data; 56 } 57 35 function makeSession() 36 { 37 $ds = new DataSource(); 38 $myxml_data = &$ds->getData(); 39 40 unset( $_SESSION['data'] ); 41 42 $_SESSION['data'] = &$myxml_data; 43 $_SESSION['gather_time'] = time(); 44 } 45 46 global $session_active, $_SESSION, $myxml_data; 47 48 function checkSessionPollInterval( $poll_interval ) 49 { 50 global $session_active, $_SESSION; 51 52 if( ! session_active ) 53 { 54 return 0; 55 } 56 57 if( isset( $_SESSION['poll_interval'] ) ) 58 { 59 if( $poll_interval <> $_SESSION['poll_interval'] ) 60 { 61 $_SESSION['poll_interval'] = $poll_interval; 62 } 63 } 64 else 65 { 66 $_SESSION['poll_interval'] = $poll_interval; 67 } 68 69 session_write_close(); 70 71 $session_active = false; 72 } 73 74 function checkSession() 75 { 76 global $session_active, $_SESSION; 77 78 session_start(); 79 80 $session_active = true; 81 82 // I got nothing; create session 83 // 84 if( ! isset( $_SESSION['gather_time'] ) || ! isset( $_SESSION['data'] ) ) 85 { 86 makeSession(); 87 88 return 0; 89 } 90 91 if( isset( $_SESSION['poll_interval'] ) ) 92 { 93 $gather_time = $_SESSION['gather_time']; 94 $poll_interval = $_SESSION['poll_interval']; 95 96 $cur_time = time(); 97 98 // If poll_interval time elapsed since last update; recreate session 99 // 100 if( ($cur_time - $gather_time) >= $poll_interval ) 101 { 102 makeSession(); 103 104 return 0; 105 } 106 } 107 } 108 109 checkSession(); 110 $myxml_data = &$_SESSION['data']; 111 session_write_close(); 58 112 59 113 $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET ); … … 70 124 if( isset($query) && ($query!='')) $filter['query']=$query; 71 125 72 function drawHostImage() { 73 126 $data_gatherer = new DataGatherer( $clustername ); 127 $data_gatherer->parseXML( &$myxml_data ); 128 129 function drawHostImage() 130 { 74 131 global $clustername, $hostname, $data_gatherer; 75 132 76 $ds = new DataSource();77 $myxml_data = $ds->getData();78 79 $data_gatherer = new DataGatherer( $clustername );80 81 $data_gatherer->parseXML( $myxml_data );82 83 133 if( $data_gatherer->isJobmonRunning() ) 84 134 { … … 93 143 } 94 144 95 function drawSmallClusterImage() { 96 97 global $clustername, $data_gatherer; 98 99 $ds = new DataSource(); 100 $myxml_data = $ds->getData(); 101 102 $data_gatherer = new DataGatherer( $clustername ); 103 104 $data_gatherer->parseXML( $myxml_data ); 145 function drawSmallClusterImage() 146 { 147 global $clustername, $data_gatherer, $myxml_data; 105 148 106 149 if( $data_gatherer->isJobmonRunning() ) … … 117 160 } 118 161 119 function drawBigClusterImage() { 120 121 global $filter, $clustername; 122 123 $myxml_data = checkSessionData(); 162 function drawBigClusterImage() 163 { 164 global $filter, $clustername, $myxml_data; 124 165 125 166 $ic = new ClusterImage( $myxml_data, $clustername ); … … 136 177 } 137 178 138 switch( $view ) {139 179 switch( $view ) 180 { 140 181 case "small-clusterimage": 141 182
Note: See TracChangeset
for help on using the changeset viewer.