[zi-cvs] packages/com.zzoss.zic packages_download.php,1.9,1.10

Sandro Zic <[email protected]> Wed, 07 Apr 2004 09:38:44 +0000
Newsgroups gmane.comp.php.zzoss.installer.cvs
Message-ID <[email protected]>
Update of /cvsroot/zzossinstaller/packages/com.zzoss.zic
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14207/com.zzoss.zic

Modified Files:
	packages_download.php 
Log Message:
deal with nummeric and non nummeric array of .tgz download

Index: packages_download.php
===================================================================
RCS file: /cvsroot/zzossinstaller/packages/com.zzoss.zic/packages_download.php,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** packages_download.php	7 Apr 2004 07:53:59 -0000	1.9
--- packages_download.php	7 Apr 2004 09:38:41 -0000	1.10
***************
*** 90,101 ****
                              $dir_package = $dir_packages.$package['name'].'-'.$package['release']['version'].DIRECTORY_SEPARATOR;
                              
                              $log .= "[".$package['name'].'-'.$package['release']['version']."]\n";
!                             if(isset($package['filelist']['file']['#']) && strlen($package['filelist']['file']['#'])>2) {
                                  // download archive and extract it
!                                 $pkg_dl = $dir_downloads.basename($package['filelist']['file']['#']);
                                  
!                                 $log .= "Downloading remote package archive ...\n";
                                  
!                                 $download->download($package['filelist']['file']['#'], $pkg_dl);
                                  //$bar->executeListHorizontal();
                                      
--- 90,109 ----
                              $dir_package = $dir_packages.$package['name'].'-'.$package['release']['version'].DIRECTORY_SEPARATOR;
                              
+                             //print_r($package['filelist']['file']);
+                             
+                             $pkg_remote = NULL;
+                             if(isset($package['filelist']['file'][0]['#']) && strlen($package['filelist']['file'][0]['#'])>2) {
+                                 $pkg_remote = $package['filelist']['file'][0]['#'];
+                             } elseif(isset($package['filelist']['file']['#']) && strlen($package['filelist']['file']['#'])>2) {
+                                 $pkg_remote = $package['filelist']['file']['#'];
+                             }
                              $log .= "[".$package['name'].'-'.$package['release']['version']."]\n";
!                             if(!is_null($pkg_remote)) {
                                  // download archive and extract it
!                                 $pkg_dl = $dir_downloads.basename($pkg_remote);
                                  
!                                 $log .= "Downloaded remote package archive:\n".$pkg_remote."\n";
                                  
!                                 $download->download($pkg_remote, $pkg_dl);
                                  //$bar->executeListHorizontal();
                                      
***************
*** 110,113 ****
--- 118,123 ----
                                      //unlink($pkg_dl);
                                  }
+                             } else {
+                                 PEAR::raiseError("No download location specified for the archive (.tgz).");
                              }
                              
***************
*** 120,131 ****
                                  }
                                  copy($xml_dl, $xml_dest);
!                                 unlink($xml_dl);
                              }                        
!                             //echo $package['filelist']['descriptor']['#'];
                              if(isset($package['filelist']['descriptor']['#']) && strlen($package['filelist']['descriptor']['#'])>2) {
                                  $xml_dl = $dir_downloads.$package['name'].'-'.$package['release']['version'].'.xml';
                                  
                                  // download specified remote package XML
!                                 $log .= "\nDownloading remote package XML ...\n";
                                  $download->download($package['filelist']['descriptor']['#'], $xml_dl);
                                  $log .= $download->getLog();
--- 130,141 ----
                                  }
                                  copy($xml_dl, $xml_dest);
!                                 //unlink($xml_dl);
                              }                        
!                             //print_r($package['filelist']);
                              if(isset($package['filelist']['descriptor']['#']) && strlen($package['filelist']['descriptor']['#'])>2) {
                                  $xml_dl = $dir_downloads.$package['name'].'-'.$package['release']['version'].'.xml';
                                  
                                  // download specified remote package XML
!                                 $log .= "Downloaded remote package XML:\n".$package['filelist']['descriptor']['#']."\n";
                                  $download->download($package['filelist']['descriptor']['#'], $xml_dl);
                                  $log .= $download->getLog();
***************
*** 142,148 ****
                              if(file_exists($xml_dest)) {
                                  $zi_registry->replacePackage($package['id'], $xml_dest, $dir_package);
!                                 $log .= 'registered new package '.$package['name']."-".$package['release']['version']."\n";
                              } else {
!                                 $log .= 'error: no package.xml in package '.$package['name'].'-'.$package['release']['version']."\n";
                                  $error = true;
                              }
--- 152,158 ----
                              if(file_exists($xml_dest)) {
                                  $zi_registry->replacePackage($package['id'], $xml_dest, $dir_package);
!                                 $log .= 'Registered new package '.$package['name']."-".$package['release']['version'].".\n";
                              } else {
!                                 $log .= 'Error: no package.xml in package '.$package['name'].'-'.$package['release']['version'].".\n";
                                  $error = true;
                              }
***************
*** 192,199 ****
      <h1>Download Packages</h1>
  <h2><a href="info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>" onclick="javascript:window.open('info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>', 'ApplicationInformation', 'width=500,height=500,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,dependent=0');void(0);javascript:return(false);" target="_blank" title="<?php echo $application["summary"].' '.$application['release']['version']; ?>"><?php echo $application["summary"].' '.$application['release']['version']; ?></a></h2>
  <?php
  $result = downloadPackages($a);
  ?>
! <br clear="all"/>
  <?php
  	$zi_buttons['back'] = "packages_confirm.php".zi_form_querystr();
--- 202,212 ----
      <h1>Download Packages</h1>
  <h2><a href="info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>" onclick="javascript:window.open('info.php?mode=<?php echo $_REQUEST['mode']; ?>&type=application&distribution=<?php echo $_REQUEST['distribution']; ?>', 'ApplicationInformation', 'width=500,height=500,resizable=1,status=0,scrollbars=1,toolbar=0,location=0,directories=0,menubar=0,dependent=0');void(0);javascript:return(false);" target="_blank" title="<?php echo $application["summary"].' '.$application['release']['version']; ?>"><?php echo $application["summary"].' '.$application['release']['version']; ?></a></h2>
+ 
+ <h2>Download Process</h2>
  <?php
  $result = downloadPackages($a);
  ?>
! <h2>Download Log</h2>
! <pre><?php echo $result['log']; ?></pre>
  <?php
  	$zi_buttons['back'] = "packages_confirm.php".zi_form_querystr();



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click