Magellan Linux

Diff of /alx-src/branches/alx-web-070/mageupgrade.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2595 by niro, Tue Jul 5 16:15:52 2011 UTC revision 2597 by niro, Tue Jul 5 16:37:58 2011 UTC
# Line 60  if($op=="calc") Line 60  if($op=="calc")
60   $out = sshdo('NOCOLORS=true /sbin/mage uppretend | egrep "\[.*\]" | sed "s:\[.*\]\ \(.*\):\1:" | sed "s:/:,:" | sed "s:\(.*\)-:\1,:" | sed "s:\(.*\)-:\1,:"', $ip);   $out = sshdo('NOCOLORS=true /sbin/mage uppretend | egrep "\[.*\]" | sed "s:\[.*\]\ \(.*\):\1:" | sed "s:/:,:" | sed "s:\(.*\)-:\1,:" | sed "s:\(.*\)-:\1,:"', $ip);
61   }   }
62   else {   else {
63   $out = sshdo('NOCOLORS=true /sbin/mageupgrade --calc-bash', $ip);   $out = sshdo('NOCOLORS=true /sbin/mageupgrade --calc-bash | cut -d, -f1-2,4 | sed "s/\(.*\)-r\(.*\)/\1,r\2/"', $ip);
64   }   }
65   echo '<pre>';   echo '<pre>';
66   echo '<table border="0">';   echo '<table border="0">';
67   if (array_key_exists("0", $out))   if (array_key_exists("0", $out))
68   {   {
69   foreach( $out as $i)   // tell that there are no updates if $out/$i is empty
70     if ( $out[1] == "")
71   {   {
72   // element 0 is always 0   echo "No updates available. The system is fully upgraded.";
73   if ($i=="0") continue;   } else {
74     foreach( $out as $i)
  $row=explode("\n", $i);  
  foreach( $row as $x)  
75   {   {
76   //ignore empty rows   // element 0 is always 0
77   //(the last one may empty)   if ($i=="0") continue;
78   if ($x=="") continue;  
79     $row=explode("\n", $i);
80     foreach( $row as $x)
81     {
82     //ignore empty rows
83     //(the last one may empty)
84     if ($x=="") continue;
85    
86   $item=explode(",",trim($x));   $item=explode(",",trim($x));
87   $pcat=$item[0];   $pcat=$item[0];
88   $pname=$item[1];   $pname=$item[1];
89   $pver=$item[2];   $pver=$item[2];
90   $pbuild=$item[3];   $pbuild=$item[3];
91    
92   echo '<tr><td>';   echo '<tr><td>';
93   echo '<font color=green>'.$pcat.'/'.$pname.'</font>';   echo '<font color=green>'.$pcat.'/'.$pname.'</font>';
94   echo '<td>';   echo '<td>';
95   echo '<font color=blue> => [ '.$pver.'-'.$pbuild.' ] </font>';   echo '<font color=blue> => [ '.$pver.'-'.$pbuild.' ] </font>';
96   echo '</td>';   echo '</td>';
97   echo '</td></tr>';   echo '</td></tr>';
98     }
99   }   }
100   }   }
101   }   }

Legend:
Removed from v.2595  
changed lines
  Added in v.2597