Zend - The PHP Company




External

Add Code


RPM List with contents  

Type: application
Added by: data
Entered: 03/03/2000
Last modified: 04/12/2009
Rating: - (fewer than 3 votes)
Views: 5827
Lists a dir with RPM's (updates) and makes a link in directory ./htmls with information and a link in ./updates where we store the RPM's. Useful to mantain a mirror information system. Just an example of how we can manage with files...


<?php
   $line1 
exec('/bin/ls updates/*'$output$error);
   while (list(,
$line) = each($output)){
    echo 
"<tr>n";
    
$parts explode('/'$line);
    
$file $parts[1]; 
    
$fp fopen("htmls/".$file.".html" 'w') or print("Cannot write $path<BR>n"); 
        if (
$fp){ 
        
fwrite($fp"<html>n<body>n<a href=../$line>$line</a>n<br><pre>n"); 
        
$info1 exec("/bin/rpm -qpi '$line'"$out$errors);
        while (list(,
$info) = each($out)){
          
fwrite($fp$info."n");
        }
        
fwrite($fp"</pre>n</body>n</html>");
        
fclose($fp); 
      } 
    echo 
"<a href=htmls/"$file".html>"$file"</a>n";
   }
 if (
$error){ 
 echo 
"Unix error code: $error<BR>n"
exit; 
}
  if (
$errors){ 
 echo 
"Unix error code: $errors<BR>n"
exit; 
}
echo 
"</pre>n";
?>


Usage Example


See the example


Rate This Script





Search



This Category All Categories